Unmunge-general : Installation and Usage

"munge: verb,transitive 1. [derogatory] To imperfectly transform information. 2. A comprehensive rewrite of a routine, data structure or the whole program. 3. To modify data in some way the speaker doesn't need to go into right now or cannot describe succinctly (compare mumble).

This term is often confused with mung, which probably was derived from it. However, it also appears the word `munge' was in common use in Scotland in the 1940s, and in Yorkshire in the 1950s, as a verb, meaning to munch up into a masticated mess, and as a noun, meaning the result of munging something up (the parallel with the kluge/kludge pair is amusing)." [The Jargon File]

Now covers unmunge Version 0.5. If you are using version 0.4 see version 0.4 instructions.

Starting from the assumption that you have little idea what you're doing. Read the emacs manual, or my quick start guide for more info.

Installation

  1. Put the file somewhere where emacs knows about it.
    By this I mean, someone that emacs looks for emacs-lisp files. (Check the value of the variable load-path). You add new directories to this list with a command like

    (setq load-path (cons load-path "~/lisp")

    in your ~/.emacs file. This adds a directory lisp in your home directory to the list.

  2. Byte compile it.
    This will make it go faster, which is a Good Thing. Type

    M-x byte-compile-file

    in emacs, and the type the file name when prompted.

  3. Load it when you run gnus.
    Put the following in your .gnus.el file

    (require 'unmunge-general)

    This will load the package whenever gnus starts.
    NOTE: I use the file ~/.gnus.el as my gnus startup file. ~/.gnus also works. Try and only use one at a time, though.

    To use the address munging you must add

    (add-hook 'message-header-setup-hook 'unmunge-address-function)

    to your .gnus.el.

    To use the sig-changer, add

    (add-hook 'message-signature-setup-hook 'unmunge-sigfile-function)

    to you .gnus.el

This will now add a small amount of default functionality. A really small amount. To get it to work usefully, you need to configure it.

Configuration

  1. Set up the default email addresses
    Tell emacs what you'd like your email and usenet email address to appear to be in the From: line. If you don't do this, it defaults to something vaguely sensible, but not as sensible as actually saying what you want. Unmunge uses two variables for this purpose. Include something like the following in your .gnus.el file

    (setq unmunge-default-address "address1@my.domain")

    Obviously, replace address1@my.domain with a valid email address. (Leave the quotes though.) This address will be your email address whenever unmunge thinks you are posting to Usenet.
    Also add to your .gnus.el

    (setq unmunge-mail-address "address2@my.domain")

    This address will be used when unmunge thinks you're sending email correspondence.

  2. Customise your address on a per-newsgroup basis
    You can now only set up your lists of pairs of newsgroup names and email addresses, with each address being used if the newsgroup being posted to matches the newsgroup name in the list. This list is stored in the emacs variable unmunge-alist. An example should clarify things.
     (setq my-linux-mail-address "gowen+linux@ma.man.ac.uk")
     (setq unmunge-alist
          '(("alt.religion.emacs" . unmunge-default-address)
    	("emacs" . "gowen+emacs@my.domain")
            ("linux" . my-linux-mail-address)))
    When I post to a newsgroup, say, gnu.emacs.misc, unmunge compares "gnu.emacs.misc" to each of the first elements in list of pairs, starting with the first (i.e. "alt.religion.emacs", then "emacs", then "linux"). When it first gets a match (i.e. the list element is contained in the newsgroup name) unmunge uses the second element in that pair as the email address.

    Note: It was formerly necessary to specify "^nn" as a regexp in unmunge-alist to catch mail groups. This is no longer necessary, since unmunge looks for a ``To:'' line at the beginning of a buffer and chooses between the mail and newsgroup defaults accordingly.

    So, in the case of my example, unmunge would first compare "gnu.emacs.misc" with "alt.religion.emacs". These don't match and so it would compare "gnu.emacs.misc"with "emacs". The word "emacs" is contained "gnu.emacs.misc", so these match and unmunge will use "gowen+emacs@my.domain" as my email address for that posting.

  3. Customise your email address according to the recipient
    The previous section covers varying your email address based on newsgroup name. It is now possible to modify your email address, according to whom you are sending the email. The variable for dealing with this is called unmunge-addressee-address-alist. This works in a similar way to unmunge-alist, only it matches using the email addresses of the recipients. Another sample of code from a typical .emacs.
    (setq unmunge-addressee-address-alist
          '(("abuse@" . "gowen+spam@ma.man.ac.uk"))
            ("postmaster@" . "gowen+spam@ma.man.ac.uk"))
    
    To be honest, I don't find this as useful as the ability to change signature according to recipient. Your mileage may vary, of course.

  4. Customise your signature in the same way
    Similar variables cover the use of various signatures, only instead of addresses they should be set to the names of files containing your signature or nil for no signature at all.

    The variables are

    unmunge-default-sigfile ; For Usenet
    unmunge-mail-sigfile ; For email
    unmunge-sigfile-alist ; For matching signatures to newsgroup names.
    unmunge-addressee-sigfile-alist ; For matching signatures to recipient email addresses.

    See the example below, to see just how similar they are to the email address versions explained above.

Examples

By way of example, here's what various bits of my .gnus file would look like if I kept it well commented:-
(setq user-mail-address "gowen@ma.man.ac.uk") ;Used by other programs
(require 'unmunge-general)

; Set the defaults
(setq unmunge-default-address "gowen+usenet@ma.man.ac.uk")
(setq unmunge-mail-address "gowen@ma.man.ac.uk")
(setq unmunge-sigfile-default "~/.signature")
(setq unmunge-sigfile-mail "~/.signature.mail")

; Change email address
(setq unmunge-alist
      '(("spam" . "gowen+spam@ma.man.ac.uk")))
                         ; For complaining in my spam mail group

(setq unmunge-addressee-address-alist
      '(("abuse@" . "gowen+spam@ma.man.ac.uk"))
        ("postmaster@" . "gowen+spam@ma.man.ac.uk"))
                         ; For complaining elsewhere

; Set up some apposite signatures
; First for newsgroups and mail ,
(setq unmunge-sigfile-alist
      '(("alt.fan.warlord" . nil)
        ("linux" . "~/.signature.linux")  ; linux groups
        ("vega" . "~/.signature.vega")    ; Suzanne Vega mailing list
        ("emacs" . "~/.signature.emacs"))); Emacs groups (Duh?)
;Then for individual email addresses
(setq unmunge-addressee-sigfile-alist
      '(("ero2\\|cooper@biol\\|brian@arq\\|owenk001\\|DaveyOwen" . nil)
                    ; No sigs for friends and family
	("@ma.man.ac.uk" . "~/.sigfixed"))) ; People in the department get
                                            ; a room/phone number, which 
                                            ; no one else needs

Last modified: Sun Sep 6 15:32:16 BST 1998 Valid HTML 4.0!

Home
Mail Me