From af2a85fe3903e1c8ee2de2dd72459e4471f5260c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 25 Jun 1993 22:33:57 +0000 Subject: [PATCH] (mouse-buffer-menu): Include % and * in each item. Calculate amount of space needed for longest buffer name. --- lisp/mouse.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index 7a712e20930..63048af5054 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -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))))