I would like my all my wanderlust *Summary* buffers to be sorted by "number" in "reverse" order.

I know how to manually request a sort, but I want this specified sort order to always be the default in all cases, without my having to run any commands.

I have tried doing (setq wl-summary-default-sort-spec 'number), but it doesn't seem to alter the *Summary* buffer sort order.

I haven't found anything in the wanderlust docs about specifying this default *Summary* sort order.

Can anyone point me to docs or examples of how to make this happen?

Thank you.

1 Answer 1


I figured out a possible solution ...

(defun my-wl-summary-prepared-hook ()                                                                                          
    (wl-summary-rescan "number" t)))                                                                                            

(add-hook 'wl-summary-prepared-hook 'my-wl-summary-prepared-hook) 

I had tried 'number instead of "number", because 'number appeared in the sort spec. That didn't work. However, once I tried the string version of that symbol, this started working.

I need save-excursion, because wl-summary-rescan can move the point.

I don't know if this is the recommended way to set this default sort order, but it seems to work.

  • There are two potential functions that I seem to recall considering when tackling it. Looking briefly at my custom setup, I see that I have modified wl-summary-insert-sequential so that it goes to point-min instead of point-max and I remember rebuilding all of my saved summaries. There are a few inboxes that are initially sorted out of order, and I need to manually sort them. After the initial manual sort, all new entries are inserted at point-min -- unless I decide to throw-out/delete my saved summary database. Once it is set setup, I have gone months without need of a manual sort
    – lawlist
    May 1, 2017 at 7:10
  • I chose the above-mentioned because of the time loss that it took to otherwise resort each time new entries were added to the bottom of the buffer. By adding everything to the top of the buffer from the get-go, there is no need to ever sort -- assuming you want the newest entries at the top. In a nutshell, I resorted for a couple of years and dealt with the lost time until I had enough Emacs-foo to find and modify the above function.
    – lawlist
    May 1, 2017 at 7:14
  • Inserting at (point-min) is indeed a good idea to prevent the need for a reverse sort. I will look into doing something similar with wl-summary-insert-sequential. Then, I don't have to sort by 'number at all, since the newest messages always end up at the top of the list.
    – HippoMan
    May 1, 2017 at 12:52
  • I disabled my wl-summary-prepared-hook and overrode wl-summary-insert-sequential as you described. It seems like the *Summary* buffer is still getting sorted somewhere else, and this combined with the wl-summary-insert-sequential change causes the buffer to end up in reverse order. Do you know what other wanderlust code might be sorting the *Summary* buffer, so I can disable that code? I'll check myself a little later, but I'm traveling soon and don't have time today. Eventually I'll find this, though.
    – HippoMan
    May 1, 2017 at 18:50
  • Likely suspects would be whatever calls wl-summary-rescan -- a brief word-search of the code lead me to a mandatory scan if wl-summary-cache-use is nil. I'd put a message in wl-summary-rescan to see if it is being triggered, and then, if it is triggered, do the same thing -- word-search/grep for its usages. I also see a forced rescan in a few other circumstances ... You could also insert an (error "stop") and set debug-on-error to t and then the *Backtrace* buffer will give you a trail to follow ... if you prefer that over manually tracing with find-function ...
    – lawlist
    May 1, 2017 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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