Unmunge-general : Installation and Usage

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-mail-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. Do 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 unmunge-alist
          '(("alt.religion.emacs" . unmunge-default-address)
    	("emacs" . "gowen+emacs@my.domain")
            ("alt.binaries" . my-binary-mail-address)
    	("^nntp" . unmunge-default-address)
       	("^nn" . unmunge-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 "alt.binaries"). 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.

    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.

    Note the last two in this list identify groups whose names start "nn" as email groups, except for those that start "nntp". This is the default setting, and it is usually advisable to have these as the last two pairs.

  3. 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-sigfile-default ; For Usenet
    unmunge-sigfile-mail ; For email
    unmunge-sigfile-alist ; For matching

    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
        ("^nntp" . unmunge-default-address)
        ("^nn" . unmunge-mail-address)))

; Set up some apposite signatures
(setq unmunge-sigfile-alist
      '(("alt.fan.warlord" . nil)
        ("linux" . "~/.signature.linux)    ; linux groups
        ("vega" . "~/.signature.vega")     ; Suzanne Vega mailing list
        ("^nntp" . unmunge-sigfile-default); Safety first
        ("^nn" . unmunge-sigfile-mail)))

Last modified: Thu Jul 9 18:58:51 BST 1998 Valid HTML 4.0!