Wanderlust uses "mime-view" internally for displaying mail messages. Sometimes "text/plain" messages actually have very long lines (like "text/flowed".

If in mime-view I toggle visual-line-mode message is displayed correctly. I've tried to add the following hook:

(add-hook 'mime-display-text/plain-hook
  (lambda ()
    (visual-line-mode t)))

Unfortunately it doesn't work - visual-line-mode is set, but message is still displayed unwrapped. Any ideas how that could be solved?

  • Change mime-display-text/plain-hook to mime-view-mode-hook and you should be in business. – lawlist May 8 '15 at 15:45
  • Nope, that didn't work – Valerii Hiora May 8 '15 at 16:04
  • Something else then is likely affecting your configuration -- consider recursively bisecting your configuration to find out why the mime-view-mode-hook is insufficient to enable visual-line-mode locally in a message buffer that is being viewed with Wanderlust. It should be sufficient. And, if you haven't restarted Emacs, you of course want to do that. – lawlist May 8 '15 at 16:22
  • The thing which confuses me is that visual-line-mode is actually enabled, but it has no effect until disabling/enabling again. – Valerii Hiora May 8 '15 at 16:31
  • If you open up simple.el and search for define-minor-mode visual-line-mode you will see all of the variables that are used to give the user a visual-line-mode experience. You likely have something in your configuration that conflicts by setting one or more of those variables that are used by visual-line-mode. To fix your problem, you will need to remove the conflicting items from your personal user configuration. That is the most likely scenario. Of course, check your *Messages* buffer to see if there are any errors when loading Emacs and/or when using Wanderlust. – lawlist May 8 '15 at 16:42

Format text/plain should not have long lines — wrapping is only allowed for text/plain; format=flowed. Unfortunately, while Apple did get it correct in previous versions, recent versions of Apple's Mail.app tend to send text/plain with long lines.

I work around this with the following code:

(defun wl-summary-refill-message ()
    (goto-char (point-min))
    (re-search-forward "^$")
    (while (looking-at "^$")
      (forward-line 1))
    (let ((buffer-read-only nil))
      (fill-region (point) (point-max)))))

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

When I encounter an incorrect message, I type M-q in the summary buffer, which wraps the text. The wrapped message will get cached, so the wrapping will persist if you come back to the message. You can undo the wrapping with C-u ..

  • I've ended up with a similar solution through additional key binding, although I use the same method as above, i.e. forcing visual-line-mode. – Valerii Hiora May 13 '15 at 12:14
  • 1
    and unfortunately it's not related only to Apple Mail messages – Valerii Hiora May 13 '15 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.