07 April, 2010


Customising Wanderlust

I've used a combination of Mutt, Emacs, Fetchmail, Procmail and Nullmailer for a long time now. Nearly a decade. But since most of the rest of my computer life is spentfi inside Emacs and I've swapped from paper-based task tracking to remember-mode, I thought I'd give Wanderlust a try.

The articles on getting started with Wanderlust at emacs-fu are great (Part 1 Part 2 Part 3) and left me with a working mail client. Unfortunately, it worked in a way I didn't quite like as much as Mutt.

Here's how I fixed it.

All of the lisp bits in this post can go in your .wl file, so you don't have to pollute your .emacs.

Summary lines

The first thing that bothered me about Wanderlust was the short summary lines. I have a fairly high-resolution monitor, and there was a lot of wasted space in the summary buffer. Even on my low-resolution laptop, I had empty space to the right of the truncated subjects. Here's the solution:

I was also a bit miffed by the date format and spacing of the elements in the summary lines, so I swapped those around to be correct (that is, British):

(setq wl-summary-line-format "%n%T%P %D/%M (%W) %h:%m %t%[%25(%c %f%) %] %s")
(setq wl-summary-width 150)


Being used to Mutt, I kept pressing "q" to close the message preview. In Wanderlust, when shoeing an e-mail, you don't actually jump into its buffer, so all this kept doing was closing the summary. If you had any marks on messages or operations that hadn't been executed, this could be a real pain because they were all forgotten. I found that you could make a summary "sticky" with M-s, which makes the contents of the summary persistent in a Wanderlust session, but you have to remember to actually do that when you open a summary buffer. Then I found out how to make all summaries sticky by default:

 (setq wl-summary-always-sticky-folder-list t)

Virtual Folders

One of the things I liked most about Mutt was the powerful searching functions. Wanderlust has something even better: virtual folders.

Use V to create one. You can search by body, from, to, etc., but also by Flag, so a search for Flag of Unread shows all new mails. You can also use ! to invert the search: !Flag, for example.

V can be used in a summary or from the Folders buffer. If you press it at your Desktop item, the virtual folder pulls mails from everything beneath it.

Even better, if you use "m f" to make a virtual folder in the folders view, it becomes a new mailbox. And, if you save the folder buffer, it updates your .folders file. You can put nicer names on them, too. I have these two items in my .folders:

 /flag:unread/.inbox    "Unread/inbox"
/!flag:unread/.inbox "Read/inbox"

Which got me out of the habit of moving read mail into a separate mailbox, as I used to have done automagically in Mutt - in-box zero makes me feel good. This is a good thing, because if you're using the brilliant remember-mode, the e-mails don't move around after you've added to-do items that link to them.

Automatic signature

I know you can press a few keystrokes and insert your signature in a draft e-mail, but I don't like it. Mutt used to append the signature automatically.

Using mu-cite, I added this behaviour again. Notice how bad at lisp I am - I cobbled this together from bits I found on the Internet. 1=1 /is/ true, though :)

(require 'mu-cite)
(add-hook 'mail-citation-hook 'mu-cite-original)

(setq signature-file-name "~/.signature"
signature-insert-at-eof t
signature-delete-blank-lines-at-eof t)

'(lambda ()
;; Add support for (signature . "filename")
(unless (assq 'signature wl-draft-config-sub-func-alist)
(wl-append wl-draft-config-sub-func-alist
'((signature . wl-draft-config-sub-signature))))

(defun mime-edit-insert-signature (&optional arg)
"Redefine to insert a signature file directly, not as a tag."
(interactive "P")
(insert-signature arg))

;; Keep track of recently used Email addresses
;;(recent-addresses-mode 1)

(defun wl-draft-config-sub-signature (content)
"Insert the signature at the end of the MIME message."
(let ((signature-insert-at-eof nil)
(signature-file-name content))
(goto-char (mime-edit-content-end))

Cite the way I like it

I also always had a custom line at the start of any replies/forwards. Here's how to do that in Wanderlust.

 (setq mu-cite-top-format '("On " date "," from " spake thus:\n"))

Black and white printing

I haven't tried this yet, but I found a note in the Wanderlust docs about printing to a black and white printer.

 (setq wl-ps-print-buffer-function 'ps-print-buffer)

Calling fetchmail

At first I was doing this in an eshell buffer. I don't like to have it run automatically, because sometimes I want to read my mail on the web, but ultimately like to download my mail to local Maildirs. You'd understand if you had to live with the regular mail service fubars here at Coventry University :)

I've bound it to C-x M-m, so it matches up with C-x m (write e-mail).

 (defun fetchmail-fetch ()
(shell-command "fetchmail")
(global-set-key "\C-x\M-m" 'fetchmail-fetch)


Just for the fun of it, I have X-Face support. I've checked my e-mail for the past month and not a single other person inserts an X-Face header line, so there's not much point other than to see my own grinning face when I look in my sent mail folder. Still, that's enough reason for me.

First add X-Face to the visible field list:

 (setq  wl-message-visible-field-list

And then just make sure you have a suitable ~/.xface file. By default, wl-auto-insert-x-face is set to t, so it should just work.

Feel free to e-mail me at csx239 AT coventry DOT ac DOT uk if you want to have someone to e-mail that uses x-face. It would make my day.

I found many useful tips in your writeup -- thank you. I was not able to get the automatic signature insertion to work -- this works on the developmental build for OSX (i.e., post-24.3, pre-24.4):

(add-hook 'wl-mail-setup-hook
'(lambda ()

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?

Social bookmarks


Bookmark this on Delicious


Support The Commons

This site:

Free your code: