[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mail-delivery-agents?



Rob Browning <osiris@cs.utexas.edu> writes:

Several people have asked me for my Gnus setup, so I'll post it here.
Hope no one's offended, but it has a fairly high signal to noise ratio
if you're interested in gnus for mail with debian.  This is stuff I've
sent to a couple of people before.  Feel free to ask if you have any
questions.


Gnus supports a number of backends for mail.  It can handle RMAIL, mh,
etc, but I would recommend that you switch to using the nnml back end.
It's much faster since it generates NOV overview databases (the same
ones used by news servers) for all the mail folders.  Other than that
it stores mail just like mh, one message per file.  Makes scripting
over messages easy, but it can be hard on the inodes :>

 I think that nnml is compatible with mh, but only if you don't use
both at the same time.  I think that gnus won't notice changes made by
mh with this method until restart and vice versa.

I'f you're already using mh, you don't have to do anything special to
use nnml other than tell gnus to use it.  It will then run over your
mh heirarchy and automatically generate the databases.  That's what I
did.  All my code assumes you are using nnml, but that should only be
an issue in a couple of places where I set up the mail group servers.

I'm going to assume for now that you don't want to use the bleeding
edge release, and that the one that came with your emacs is OK.  Is it
emacs-19.31.1?  If not, you may need the newer version of Gnus (or
emacs).  I will have info below about how to use the bleeding edge if
you're interested.  I'm using 5.2.38 to write this and it works great.

Gnus treats mail groups (as opposed to news groups) specially with
respect to deleting articles.  The normal rule is: "if it's a mail
group, never delete anything unless specifically told to, and then
only after the expiration period."

You expire mail articles with "E" in the summary buffer.  The default
expire period is two weeks.  If any article is two weeks old and has
been expired, it is deleted.  This is kind of nice if you later
(within two weeks) decide you really did need some old message.  Also,
expired articles (until their deletion) still show up in threading
histories, etc.

You should also look in the info pages (gnus' are quite complete, Lars
is insanely prolific) at the section on "Topics".  This allows you to
organize your groups in collapsible outline form.

With respect to file system layout, I have my groups set up like this:

~/Mail/Incoming/inbox        (incoming mail that doesn't go anywhere else)
~/Mail/Incoming/debian-bugs  (debian bug list)
~/Mail/Incoming/...          (other assorted mail groups)

and for outgoing stuff:

~/Mail/Outgoing/misc-mail 
~/Mail/Outgoing/misc-news 

this used to be the default in gnus, but in the latest version, it
saves no mail by default, so I explicitly enable this in my .emacs.

For news (don't forget to check out the info pages on persistent
articles and asynchronous fetching -- too cool):

~/News/...  (all Gnus related stuff for *incoming* news goes here)

Note that it might make more semantic sense for misc-news to go under
~/News, but it turns out that would be pretty awkward to manage with
the way Gnus wants to handle things right now.  I don't think you
could do it without more hassle than it's worth, and the way I have it
now, all personal writings are in one subdir.

A couple of other things of note.  If you just want to read mail,
without going through the time consuming (at 28.8) process of
contacting the news server and getting the current news group status,
you just use M-x gnus-no-server instead of M-x gnus to launch gnus.

One caveat, you might notice that all of the mail groups vanish along
with the news groups when you do this (i.e. when you run
gnus-no-server).  That's just because groups have levels of
"activeness", and gnus-no-server only shows groups of level 2 or
lower.  Unfortunately all groups, including mail groups, are created
at level 3 by default, so they vanish with gnus-no-server.  To see
them again, you just need to launch gnus the old fashioned way (M-x
gnus) and then use the set level command to set the level of all your
mail groups to 2.  You can set the levels via "S l" with the cursor on
the relevant group in the Group buffer.

In order to actually get your mail, you might be able to use pop
directly from gnus (I think that's supported now, but I'm not sure),
but I just use popclient to grab my mail from all the relevant
machines, and then let gnus suck up the mail from my normal system
mailbox, which it does by default.

Gnus automatically gets your new mail when you launch it, but if you
want to incorporate all the new mail after launching gnus, you can use
"g" from the group buffer which updates all the mail and news groups,
or "2 g" which only does groups level 2 or higher, i.e. the mail
groups (there are other commands too, see M-g, for example, which
works from a mail summary buffer).

Incoming mail is split into sub-groups (if you want) via
gnus-nnmail-split-methods.  There's an example below.  It will
automatically create a new group when it needs one according to the
rules and the incoming mail.  Gnus can recognize most duplicates in
incoming mail.  It does this by keeping a cache of article numbers.
It can be told to delete them, but I have it shunt them to a separate
group instead with the split-methods.

I hope I anticipated all your problems, but if not, feel free to ask
me any questions.  I would, of course, recommend first backing up your
mail setup just in case.

Here's the Gnus relevant bits from my current .emacs.  Note that there
are a couple of places where I have either "osiris" or my name.
You'll need to change all those.  Make sure you do this *before* the
first time you run gnus.  Some of the things it does are hard to undo
without starting over with an empty .newsrc.eld

Also, be warned, this is not necessarily organized in any particular
fashion, except that I moved most of the stuff that I could find that
you *must* change to the beginning.

=== Begin gnus .emacs stuff

;; I like these, and they affect gnus too.
(line-number-mode 1)
(global-font-lock-mode t)
(transient-mark-mode 1)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Gnus setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; You have to change these:

;; Your primary server
(setq gnus-select-method '(nntp "newshost.cc.utexas.edu"))

;; So the server will accept me
(setq gnus-local-domain "cs.utexas.edu")

;; So the from field will be reasonable.
(setq gnus-user-from-line "Rob Browning <osiris@cs.utexas.edu>")
(setq user-mail-address "osiris@cs.utexas.edu")
(setq gnus-local-organization "The University of Texas at Austin")

;; Change the name osiris below to whatever you like.  As far as gnus
;; is concerned, it's the name of the mail server.

;; "server" for all incoming mail
(setq gnus-secondary-select-methods 
      '((nnml "osiris" 
              (nnml-directory "~/Mail/Incoming")
              (nnml-active-file "~/Mail/Incoming/active")
              )))

;; "server" for all outgoing mail and news
(setq gnus-message-archive-method
      '(nnml "outgoing" 
						 (nnml-directory "~/Mail/Outgoing") 
             (nnml-active-file "~/Mail/Outgoing/active")
						 (nnml-get-new-mail nil)))

;; Change this to be whatever you like, but make sure that the last
;; item in the list has an empty regex.  That's where all the
;; unmatched mail goes.  If you don't, gnus will happily trash the
;; mail that doesn't match a regex.
(setq		
 nnmail-split-methods
 '(
   ("debian-bugs" "^Subject: \\(Re: \\)?Bug#[0-9]+:")
   ("guile" "^Sender: owner-guile@cygnus.com")
   ("duplicates"  "^Gnus-Warning:")
   ("inbox"       "")))  



;; This is *only* if you want to use the latest gnus, and you build it
;; in the directory mentioned. (also see the footnote*** at the end.)
;;(setq load-path 
;;      (cons (expand-file-name 
;;             "/usr/local/lib/emacs/site-lisp/gnus/lisp") 
;;            load-path))


;; This is stuff that you probably want, but don't have to change.

;; Very nice...
(setq gnus-asynchronous t)

;; Make all new groups zombies.  You can peruse them at your leisure
;; (with "A z" from the group buffer) and either subscribe (with "u",
;; from the group buffer.  It's a toggle) or kill them (C-k) as
;; desired.
(setq gnus-subscribe-newsgroup-method 'gnus-subscribe-zombies)

;; All kinds of good config stuff.  I think you can leave this alone
;; until/unless you feel like figuring it out.
(setq gnus-check-new-newsgroups 'ask-server)
(setq gnus-save-newsrc-file nil)
(setq gnus-extract-address-components 'mail-extract-address-components)
(setq gnus-auto-select-next t)
(setq gnus-auto-select-same t)
(setq gnus-use-cross-reference 'all)
(setq gnus-auto-select-newsgroup nil)
(setq gnus-summary-check-current t)
(setq gnus-fetch-old-headers 'some)
(setq gnus-thread-hide-subtree t)
(setq gnus-thread-indent-level 2)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
(setq gnus-use-cache 'passive)
(setq gnus-permanently-visible-groups "^nnml+")
(setq gnus-build-sparse-threads 'some)
(setq gnus-keep-backlog 50)

;; Tell gnus where to put outgoing copies
(setq gnus-message-archive-group 
      '((if (message-news-p)
            "misc-news" 
          "misc-mail")))

;;; Score file stuff
(setq gnus-kill-killed t)  ;; so you can re-kill a set of articles

;; Change this as indicated in the info pages if you actually want
;; gnus to delete the duplicates.
(setq nnmail-delete-duplicates 'warn)

(setq gnus-uu-user-view-rules
      (list 
       '("\\.\\(jpe?g\\|gif\\|tiff?\\|p[pgb]m\\|xwd\\|xbm\\|pcx\\)$" "xv -8")))


=== End gnus .emacs stuff

*** If you do want the bleeding edge gnus, you need to uncomment the
relevant bit in the .emacs code above, build the latest version in the
directory mentioned, and add the following to your .bashrc:

export INFOPATH=/usr/local/lib/emacs/site-lisp/gnus/texi:/usr/local/info:/usr/info

so you get the right info pages.  Note that you can't just add to your
INFOPATH with:

export INFOPATH=/usr/local/lib/emacs/site-lisp/gnus/texi:${INFOPATH}

because the environment variable is not normally set at all.  Info has
defaults that it uses if there's no INFOPATH.


Hope this helps
--
Rob



Reply to: