Thursday, September 4, 2014

Fixing Wanderlust Next/Previous Navigation

Navigating with Wanderlust can be a painful experience if you have the expectation that keystrokes sent to a particular window will not move you to another window unless you explicitly execute a command whose sole purpose is to cause the Window focus to move.

Wanderlust comes with a default configuration such that pressing space or n or p (or N or P) in the Summary Window or the Message Window can service two purposes: it can move you to the next "element" or close the current window and navigate to the next "element" in the "parent" window.

For example, if done at the beginning or end of the summary window, typing "n" in the summary window can close the current summary and move you to the summary of the next folder (depending on whether you have wl-auto-select-next set, but even if that is set to nil, it still closes the current summary -- nil only prevents opening the next folder, not closing the current one).  This can be quite irritating.  At least in my experience, you never know when you are at the top or bottom -- whether the next n or p (or space or backspace) will scroll up or close the buffer you are navigating.  Likewise, hitting space at the end of a Message window could take you to the next MIME element (if there is one -- and you do not know if there is one if you cannot see all the elements), or it could take you to the next message in the Summary window (you just thought you were done reading that email, right? It's really fun having to navigate back to where you were after this happens in a lengthy email.)

While I can see the need for the default settings for someone who has five to ten emails whose entire content always fits in the Message Window, I personally think this feature should have been optional.

I worked around this issue with the following hooks:

(defun my-wl-end-of-list ()
  (message "End of list.")
  t)

(add-hook
 'wl-message-buffer-created-hook
 '(lambda ()
    (setq mime-preview-over-to-next-method-alist nil)
    (setq mime-preview-over-to-previous-method-alist nil)
    ))

(add-hook
 'wl-summary-mode-hook
 '(lambda ()
    (set 'wl-summary-buffer-next-folder-function 'my-wl-end-of-list)
    (set 'wl-summary-buffer-prev-folder-function 'my-wl-end-of-list)
    ))

I do not know if there is a better way to approach this, but, it works for me.

No comments:

Post a Comment