emacs-pretest-bug
[Top][All Lists]
Advanced

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

Buffer-menu-toggle-files-only should use Buffer-menu-revert, not revert-


From: Drew Adams
Subject: Buffer-menu-toggle-files-only should use Buffer-menu-revert, not revert-buffer
Date: Sun, 21 Nov 2004 11:11:01 -0800

`Buffer-menu-toggle-files-only' calls `revert-buffer', but it should instead
call `Buffer-menu-revert'. This is the definition that should be changed:

(defun Buffer-menu-toggle-files-only (arg)
  "Toggle whether the current buffer-menu displays only file buffers.
With a positive ARG display only file buffers.  With zero or
negative ARG, display other buffers as well."
  (interactive "P")
  (setq Buffer-menu-files-only
        (cond ((not arg) (not Buffer-menu-files-only))
              ((> (prefix-numeric-value arg) 0) t)))
  (revert-buffer))       ; <== SHOULD BE (Buffer-menu-revert)


Motivation:

The following change by a user to `Buffer-menu-revert' lets him provide for
font-lock highlighting of *Buffer List* (this could alternatively be done
via defadvice, but this shows the relevant code):

(defun Buffer-menu-revert ()
  "Update the list of buffers."
  (interactive)
  (revert-buffer)
  (font-lock-fontify-buffer)) ; <== NOT IN VANILLA EMACS

(BTW, It would be good to have a hook here, so that redefinition or
defadvice would not be needed. Similarly, a hook would be useful at the end
of `buffer-menu'.  Hook `buffer-menu-mode-hook', at the end of
`Buffer-menu-mode', is not sufficient, IMO.)

Because `Buffer-menu-toggle-files-only' does not call `Buffer-menu-revert',
a user-defined or advised version of `Buffer-menu-revert' is not taken into
account by `Buffer-menu-toggle-files-only'. In the example shown, toggling
twice from a font-locked *Buffer List* results in an un-font-locked buffer.

Note: There is no font-lock highlighting of *Buffer List* in vanilla Emacs.
The highlighting of the buffer name is done specially in
`list-buffers-noselect' - this highlighting is unconnected with
font-lock-mode. Fixing this bug will make it easier for libraries that do,
themselves, font-lock *Buffer List*.



In GNU Emacs 21.3.50.1 (i386-mingw-nt5.1.2600)
 of 2004-07-26 on BERATUNG4
configured using `configure --with-gcc
(3.3) --cflags -I../../jpeg-6b-1/include -I../../libpng-1.2.4-1/include -I..
/../tiff-3.5.7/include -I../../xpm-nox-4.2.0/include -I../../zlib-1.1.4-1/in
clude'





reply via email to

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