2010-02-23

wanderlust iii

Wanderlust

I have been using the Wanderlust E-mail client for almost a year now, and I am very happy with it. In previous postings I already discussed setup and some tips and tricks; and I also had somewhat related posts on bbdb (the address book) and warning you about new mail. But I think it's time for an update.

maintenance

One question that I have received quite a few times was about the maintenance of Wanderlust; it's may be a nice e-mail client, but little seems to have happened in the last few years. It's reasonable concern.

Fortunately, it seems the situation has improved significantly. There's more traffic on the mailing lists, both from old and new users. Various improvements are circulating; the place to get the latest stuff is in David Abrahams' git-repository: semi, flim, apel and wanderlust. The plan is to gradually apply the changes to the upstream (CVS) repository.

bugs

Although I have been quite happy with Wanderlust, there was one bug #5534 that has bitten me a few times, causing occasional hangs when saving (draft) messages with non-ascii characters. It seemed finally to be a bug in emacs itself, which is triggered by something in Wanderlust. A fix will probably be available for the next emacs version; until then, you can work around this by using an external MIME-encoder. To do this, add the following to your WL initialization code (thanks to various helpful people on the WL mailing list):

(setq mel-b-ccl-module nil)
(setq mel-q-ccl-module nil)
(setq base64-external-encoder '("mimencode"))
(setq base64-external-decoder '("mimencode" "-u"))
(setq base64-external-decoder-option-to-specify-file '("-o"))
(setq quoted-printable-external-encoder '("mimencode" "-q"))
(setq quoted-printable-external-decoder '("mimencode" "-q" "-u"))
(setq quoted-printable-external-decoder-option-to-specify-file '("-o"))
(setq base64-internal-decoding-limit 0)
(setq base64-internal-encoding-limit 0)
(setq quoted-printable-internal-decoding-limit 0)
(setq quoted-printable-internal-encoding-limit 0)

(setq-default mime-transfer-level 8)
(setq mime-header-accept-quoted-encoded-words t)

This requires the mimencode-program, which is part of the metamail-package. For the time being, this seems to be the best solution when using Wanderlust with Emacs 23.

one more trick: reformatting

Let's finish with one more trick. Sometimes, incoming mail is formatted quite badly; in particular, the new lines are too long for comfortable reading. From the WL-mailing list, here's a trick to deal with that:

(require 'filladapt)

;; from a WL mailing list post by Per b. Sederber
;; Re-fill messages that arrive poorly formatted
(defun wl-summary-refill-message (all)
  (interactive "P")
  (if (and wl-message-buffer (get-buffer-window wl-message-buffer))
      (progn
        (wl-summary-toggle-disp-msg 'on)
        (save-excursion
          (set-buffer wl-message-buffer)
          (goto-char (point-min))
          (re-search-forward "^$")
          (while (or (looking-at "^\\[[1-9]") (looking-at "^$"))
            (forward-line 1))
          (let* ((buffer-read-only nil)
                 (find (lambda (regexp)
                         (save-excursion
                           (if (re-search-forward regexp nil t)
                               (match-beginning 0)
                             (point-max)))))
                 (start (point))
                 (end (if all
                          (point-max)
                        (min (funcall find "^[^>\n]* wrote:[ \n]+")
                             (funcall find "^>>>>>")
                             (funcall find "^ *>.*\n *>")
                             (funcall find "^-----Original Message-----")))))
            (save-restriction
              (narrow-to-region start end)
              (filladapt-mode 1)
              (fill-region (point-min) (point-max)))))
        (message "Message re-filled"))
    (message "No message to re-fill")))

(define-key wl-summary-mode-map "\M-q" 'wl-summary-refill-message)

Now, you can refill your messages with M-q when in the Summary.

If you have any other nifty WL-tricks that could be useful for others, please share them in the comments, thanks!

22 comments:

Greg said...

For filling, I simply use this:

(add-hook 'mime-view-mode-hook
'(lambda ()
(setq fill-column 79)
(longlines-mode t)))

This usually works wonderfully, except that after opening something like two dozen messages (sometimes less, sometimes more), it suddenly stops working :-( It seems longlines suddenly ignores the line endings and fills the whole message as if it was only one line... I can't reliably reproduce the bug, and I don't know what causes it; it certainly nothing about the message itself, since sometimes the same messages are filled correctly, sometimes they aren't. The only thing that seems to be the same is that the bug occurs after many messages have been opened.

I like this method since it does the filling automatically and more reliably than the suggestion above -- unless of course the bug is triggered, in which case you have to restart wl.

Does anyone know what might cause this problem?

Greg said...

I should add that the problem with using filladapt above is that it only treats blank lines as paragraph separators. So it will reformat signatures, the headers of forwarded messages, closing greetings (e.g., "Best, XX") and any mail in which paragraphs are not separated by blank lines. Longlines-mode deals with these properly. Except for the bug.

Anonymous said...

Hi,

To send messages containing non-ascii characters, have you customised things into your .wl or have you had to perform deeper modifications, like patching the wl sources?

Thanks!

Anonymous said...

Hi again,

Regarding email indexing, you could have a look at mairix http://www.rpcurnow.force9.co.uk/mairix/
and this file for configuration:
http://www.emacswiki.org/emacs/hgw-init-wl.el

Regards,

djcb said...

@dismantr: note, sending non-ascii usually works fine; the problem is with long
messages. All the customizations are for your .wl (or similar), no further
patching needed.

Regarding indexing/searching mail, I am using my own, it's called mu.

Anonymous said...

So, that's only me :-(...
With non-ASCII characters like é,è,à,ä, etc, I get a "byte-code: Attempt to change byte length of a string" message in the mini-buffer and no sending. When I replace the non-ASCII characters by ASCII characters (é by e, etc...), the email is being sent without any problem... Strange...

I use the wl-beta, like you are.

About mu, I know that, I just would like to point out an other solution I found while crowling the www :-).

Regards,

Anonymous said...

Oh, about my last post: The complete log, after entering in draft-mode:

Type C-c C-x C-z to exit MIME mode, and type C-c C-x ? to get help.
Saving...done
Send current draft? (y or n)
Type C-c C-x C-z to exit MIME mode, and type C-c C-x ? to get help.
Exit MIME editor mode.
Sending...
byte-code: Attempt to change byte length of a string

If you have any idea... Please suggest, I don't see what to change in my config file :-(

djcb said...

@dismantr: actually, right now I am using the git versions (as mentioned in the post). however, I had the same problems in wl-beta as in the git version.

with the config changes mentioned, I no longer have these problems. That is, just put the blob in your config, and it should work.

Anonymous said...

To anyone looking for a Emacs mail client: VM (View Mail) also went through a quiet period of very little development, but now a new maintainer has picked things up. Version 8.1.0 was recently released. It has, among other things, support for Emacs 23 and finally full support for IMAP folders. See

https://launchpad.net/vm

McKnight said...

hi, terrific article

I am using wl now. But a problem bugs me: whenever I opened a mime-message, it always shows some tags like
[1 ]
[1.1 ]
some text here
[1.2 ]

Do you kinda know how to get rid of this?

djcb said...

@McKnight: well, I guess you can get used to them... AFAIK there's no configuration setting to not show them, but I suppose you can use e.g. Hidelines to get rid of them.

dmaus said...

@McKnight:

There is the customization variable `mime-view-buttons-visible'. If set to nil, the MIME buttons are not shown. Drawback: Without the buttons you cannot AFAIK access message attachments.

Eric said...

McKnight, for the extra mime info, what I do is use a different face for these lines, one that is visible but only just. The face to customise is mime-button-face.

My own bug-bear with wanderlust, which I've been using pretty much happily for quite a while now, is that the message composition window breaks so many emacs' modes of operation... e.g. C-l does its own version of recentering and colouring does not use the standard font-lock mode (and this applies to the summary window as well).

The problem with VM is the lack of support for maildir (I believe that's still true).

kakachi sensei said...

Thank you for the good tutorial. I just want some more informations: I am kind of facing a bug in threaded message display, the vertical bar doesn't appear at all! When I tried to subscribe to the mailing list of wanderlust I had no response. Could you please help in fix or tell me how to join the wanderlust mailing list?
PS: I am running last wanderlust version 2.15.6 (almost real) with emacs 23.2.5.

djcb said...

@zabuza: not sure what vertical bar you mean... but you should be able to subscribe to the wl mailing list with the instructions from the web page.

Daniel said...

About the formatting thing: I think that visual line mode should do the trick.

Actually, when I activate it manually it formats the message quite nicely. However, I tried the following:

(add-hook 'mime-view-mode-hook 'turn-on-visual-line-mode)

this seems to turn on word-wrap but not actually wrap anything. when I then deactivate visual-line-mode manually and reactivate it, it works.

I cannot really find why that is.
Yet, if I get it working, this should probably also solve Greg's problem with the longlines-mode.

- Daniel

Evan said...

@Daniel:

(add-hook 'mime-view-mode-hook
'(lambda ()
(visual-line-mode t)))

This is what you're looking for. It needs to be lambda'd and the explicit 't' makes sure that it's idempotent (doesn't toggle off and on as you revisit previous MIME-View buffers).

Chris Monsanto said...

I sympathize with the poster who was annoyed with the composition window's non-font-lock-ness. Here is a 5 min hack around it, that also has the nice benefit of putting some space around your text and the quoted reply (and lets you press enter anywhere on the quote line):

(defun cm/rehighlight-mime-newline ()
(interactive)
(if (save-excursion
(beginning-of-line)
(looking-at wl-highlight-citation-prefix-regexp))
(progn (end-of-line)
(newline)
(newline)
(newline)
(previous-line)
(put-text-property (point-min) (point-max) 'face nil)
(wl-highlight-message (point-min) (point-max) t))
(newline)))

Bind to C-m or in wl-draft-mode-map.

Dave Abrahams said...

So, now what? Since the host for their CVS repo and mailing lists shut down, I don't know where to find official information about WL. Everything seems to point at something dead or outdated. I started working with Gnus again a while back because of slow NNTP access to large groups in WL. Is it being maintained?

Has anything been done to speed up access to large NNTP groups?

What source code repositories are being used?
The ones at https://github.com/wanderlust are still marked as
"Unofficial." http://www.emacswiki.org/emacs-zh/WanderLust#toc13 calls
those repos "semi-official"

Thanks,

djcb said...

@Dave Abrahams: at least I am using mu4e now instead of wanderlust, trying to implement some of the things I like about wanderlust. mu4e does not support nntp directly though.

Anonymous said...

> mu4e does not support nntp directly though.

Is it planned to get nntp support so we could use it instead of Gnus?

djcb said...

@gour: mu4e won't support nntp directly (but neither does it support imap or pop3 directly).

however, it could work if you fetch the posts and put them in some maildirs.