Gnus miscellanea

GnusI’ve spent part of the morning setting up Gnus on my OS X, to replace Mail.app and ease synchronization with my GNU/Linux boxes. I won’t enter in the details of basic Gnus setup (see, for instance, the Gnus tutorial), but offer some customization tips, and mention two of my favourite Gnus-enhancing packages (which are not OS X-specific, by the way).

First thing was to import my Mail.app mailboxes. Easy. Open the mailbox in Mail, select all messages and execute the menu command Save as... (under File); in the save dialog, be sure to select Raw Message Source. The saved file is in mbox format, a Gnus import friendly one. All you need to get those messages into Gnus is to press B f in the *Group* buffer, providing your mbox file when asked. A new group is created with all your messages. You can, for instance, mark all of them and B c to copy them in, say, a regular nnml group.

Setting Gnus to read and send messages via Gmail was also easy following the instructions here. A caveat: you'll need also the file ssl.el from the Gnus CVS repository to make POP3 work (and of course gnutls, which i installed via the fink package gnutls14; be sure to tell Emacs about your fink path: (add-to-list 'exec-path "/sw/bin")).

With that, I had a functional Gnus running and could move on to more interesting stuff. I don't know about you, but i absolutely need random mail signatures, selected from my growing collection. To that end, i've been using randomsig.el since i can remember. Just put the file in your load path (or, if you're on Debian, install the gnus-bonus-el package), and add to your initialisation files something along the lines of:

(when (require 'randomsig nil t)
  (define-key message-mode-map (kbd "C-c s") 'randomsig-replace-sig)
  (define-key message-mode-map (kbd "C-c S") 'randomsig-select-sig)
  (require 'gnus-sum) ; probably required for `gnus-summary-save-map'
  (define-key gnus-summary-save-map "-" 'gnus/randomsig-summary-read-sig)
  (setq randomsig-dir "~/Library/Emacs/Gnus/")
  (setq randomsig-files '("signatures.txt"))
  ;; or (setq randomsig-files (randomsig-search-sigfiles))
  ;; or (setq randomsig-files 'randomsig-search-sigfiles)
  (setq message-signature 'randomsig-signature)
  (setq randomsig-delimiter-pattern "^--"))

As you can see, i put my signatures in a file called signatures.txt. Now, every time i start editing an email, a random signature taken from this file is inserted for me. If i don't like it, i can request another one typing C-c s. And if i'm reading anything inside and Emacs buffer and find a new text to add to my signatures.txt, M-x randomsig-message-read-sig will add the region marked in the buffer to my collection. Perfect bliss.

Mail.app comes with a sophisticated search engine based on Spotlight. But i've noticed that i never use the 95% of its features, not to mention that it's annoyingly slow. What i really need is a simple and quick keyword search, and i've had it for many years now with Gnus and nnir.el. This package provides an Emacs/Gnus front-end to several indexers, my preferred one being namazu. So, besides getting nnir.el, you'll need to install it. In Debian, it's as easy as installing the corresponding package (namazu2), but, theres no namazu package to be seen in fink. Fortunately, you can compile it from source just by following the instructions: they worked in my MacBook without a glitch. With namazu installed, you can index your extant email in a breeze: create a directory to hold the index files (i use ~/Library/Caches/namazu) and type:

cd ~/Library/Caches/namazu
mknmz --mailnews ~/Library/Emacs/Gnus/Mail

(using the appropriate directories, of course), and the index directory will get populated. Now, with nnir.el in your load path, tell Emacs how to find those index files:

(when (require 'nnir nil t)
  (setq nnir-search-engine 'namazu)
  (setq nnir-namazu-index-directory
        (expand-file-name "~/Library/Caches/namazu"))
  (setq nnir-namazu-remove-prefix
        (expand-file-name "~/Library/Emacs/Gnus/Mail/"))
  (setq nnir-mail-backend (nth 0 gnus-secondary-select-methods)))

(i put this code in my Gnus configuration file). We are all setup: go to the *Group* buffer and type G G to search your emails. A temporal group containing the messages that match your query will be created for you, for your browsing pleasure. Inside that group, G T will teletransport you to the original message, in case you need to recover its context. As you'll notice, namazu searches are at least an order of magnitude faster than Spotlight.

The only bit left is to set an entry in your crontab running mknmz for you periodically (i've got it set up with a period of one hour). Indexing is incremental, i.e., fast. Yeah, it's not that immediate indexing of Spotlight or Beagle, but, you know, it's not like i get a mail every five seconds, or that i need engine to find a mail i read twenty minutes ago.

There are many other tricks to play with Gnus, but i'll save them for future posts :-).

About these ads

10 Responses to “Gnus miscellanea”

  1. Simao Says:

    Anyone with luck setting up gnus and gmail under windows with cygwin?

    Sessions hangs when I try to send email.

  2. Petteri Says:

    I would recommend checking out Wanderlust http://www.gohome.org/wl/. Some find it nice.

  3. jaaron Says:

    I appreciate the suggestions. I was looking for a good search for gnus. You can read about my experiences with gnus on os x here:

    http://cubiclemuses.com/cm/blog/2006/gnus_gmail_os_x.html

  4. genehack.org » Blog Archive » Tab dump // 20070205 Says:

    [...] Gnus misc — several things in there that I need to get set up too… [...]

  5. shanks Says:

    Does this help?

    http://www.mail-archive.com/info-gnus-english@gnu.org/msg03039.html

    see the complete thread for more info.

    Shanks

  6. dmg Says:

    Hi JO,

    I have created fink packages for namazu. They are here:
    http://turingmachine.org/blog/index.php?/archives/12-Namazu-for-OS-X-via-fink.html

    And thanks for the stories. They are always interesting.

    dmg

  7. dig Says:

    Hi,

    The B f in the *Group* buffer did not worked for me, but the G f works.

    ,—-[ C-h f gnus-group-make-doc-group RET ]
    | gnus-group-make-doc-group is an interactive compiled Lisp function in `gnus-group.el’.
    | (gnus-group-make-doc-group file type)
    |
    | Create a group that uses a single file as the source.
    |
    | If called with a prefix argument, ask for the file type.
    `—-

  8. @Siamo Says:

    Why not use the windows version of Emacs, in which gnus seems to work fine

  9. Rebecca Waymouth Says:

    Once you’ve installed wordpress you have a basic functioning web site. At this point you can easily download free (and paid) themes and plugins. THey just go into your public_htmlwp_contenttemplates or plugins folder.

  10. Edgar Uriel Says:

    Hi, I’m noob with emacs and gnus, I have a issue with the summary buffer in gnus. When there is a new mail or article, the summary buffer shows only the new ones. Sometimes I’m looking for a old article and I’ve not time for read the new articles, so for look my old article I must check the new. Is there a way for show all articles in summary buffer all time??


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: