1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-13 19:25:37 -08:00

(mouse-buffer-menu): Include % and * in each item.

Calculate amount of space needed for longest buffer name.
This commit is contained in:
Richard M. Stallman 1993-06-25 22:33:57 +00:00
parent b9d07cf711
commit af2a85fe39

View file

@ -371,7 +371,15 @@ and selects that window."
(list "Buffer Menu"
(cons "Select Buffer"
(let ((tail (buffer-list))
(maxbuf 0)
head)
(while tail
(or (eq ?\ (aref (buffer-name (car tail)) 0))
(setq maxbuf
(max maxbuf
(length (buffer-name (car tail))))))
(setq tail (cdr tail)))
(setq tail (buffer-list))
(while tail
(let ((elt (car tail)))
(if (not (string-match "^ "
@ -379,8 +387,14 @@ and selects that window."
(setq head (cons
(cons
(format
"%-14s %s"
(format "%%%ds %%s%%s %%s"
maxbuf)
(buffer-name elt)
(if (buffer-modified-p elt)
"*" " ")
(save-excursion
(set-buffer elt)
(if buffer-read-only "%" " "))
(or (buffer-file-name elt) ""))
elt)
head))))