emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

buff-menu.el - minor enhancement to sort columns up or down


From: Drew Adams
Subject: buff-menu.el - minor enhancement to sort columns up or down
Date: Sat, 16 Oct 2004 17:33:21 -0700

This is a minor enhancement to buff-menu.el. It lets you sort *Buffer List*
columns in ascending or descending order (consecutive heading clicks reverse
direction), and it highlights the heading of the sorted column (indicating
the current direction).

To try it:

1. Patch file buff-menu.el from CVS using the attached patch.
2. Compile the patched file, then load the compiled patched file.
   Or, load cl.el, then load the uncompiled patched file.
3. (setq Buffer-menu-sort-column 1)
   Buffer-menu-sort-column was preloaded with dumped emacs, so the defvar
for
   it in the patched file doesn't take effect. You need to do this, or you
   will get an error because the dumped value for it is nil.
4. C-x C-b, to display buffer *Buffer List*.
5. Click in the *Buffer List* window.
   (This should not be necessary. I've just filed a bug on this:
   command `buffer-menu' doesn't select buffer *Buffer List* as it should.)

>From now on, when you click a column header in *Buffer List*:

 - Consecutive clicks of the same header reverse the previous sort order.
 - The sorted column has its heading underlined or overlined, depending on
the sort direction. This tells you 1) which column is sorted and 2) the sort
direction.
 - A message in the echo area also tells you what the new order is (which
column is sorted, and whether ascending or descending).

You can click column heading "CRM" to get the "visited" order that is the
default order. When the buffer is sorted that way, the CRM heading is in
inverse video (there is no reverse of this sort order).

Note: The attached patch patches the latest buff-menu.el from CVS. However,
I'm using a Windows binary from 7-26-2004. The version of buff-menu.el that
corresponds to my binary has a different version of `list-buffers-noselect'.
The newer, CVS version uses a 4-argument form of format-mode-line that is
not available in my binary. So, I've tested this by patching the older
`list-buffers-noselect' that works with my binary. (In fact, I tested it
with a version of `list-buffers-noselect' that fixes a bug that doesn't let
you use it with dedicated windows.) Let me know if you have a pb with the
patched CVS version.

Since this is a minor code change, how about including it in Emacs now?

(Something similar could perhaps be done for Dired column headings, later.)

Attachment: diff-buff-menu-w-new-sort.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]