aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-06-25 22:30:49 +0000
committerRichard M. Stallman1993-06-25 22:30:49 +0000
commitb9d07cf7118787c8f11b41884c7d60cecedd6643 (patch)
tree974117cae0161dd659d3d6f5ce265f742f99e1bd
parent1438263db4f48e948ee83a7a014b3043b03307ee (diff)
downloademacs-b9d07cf7118787c8f11b41884c7d60cecedd6643.tar.gz
emacs-b9d07cf7118787c8f11b41884c7d60cecedd6643.zip
(mouse-menu-bar-buffers): Include % and * in each item.
Calculate amount of space needed for longest buffer name.
-rw-r--r--lisp/menu-bar.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 0f174f1fab9..67df0d26185 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -160,17 +160,30 @@ and selects that window."
160 (list "Buffer Menu" 160 (list "Buffer Menu"
161 (cons "Select Buffer" 161 (cons "Select Buffer"
162 (let ((tail buffers) 162 (let ((tail buffers)
163 (maxbuf 0)
163 (maxlen 0) 164 (maxlen 0)
164 head) 165 head)
165 (while tail 166 (while tail
167 (or (eq ?\ (aref (buffer-name (car tail)) 0))
168 (setq maxbuf
169 (max maxbuf
170 (length (buffer-name (car tail))))))
171 (setq tail (cdr tail)))
172 (setq tail buffers)
173 (while tail
166 (let ((elt (car tail))) 174 (let ((elt (car tail)))
167 (if (not (string-match "^ " 175 (if (not (string-match "^ "
168 (buffer-name elt))) 176 (buffer-name elt)))
169 (setq head (cons 177 (setq head (cons
170 (cons 178 (cons
171 (format 179 (format
172 "%14s %s" 180 (format "%%%ds %%s%%s %%s"
181 maxbuf)
173 (buffer-name elt) 182 (buffer-name elt)
183 (if (buffer-modified-p elt) "*" " ")
184 (save-excursion
185 (set-buffer elt)
186 (if buffer-read-only "%" " "))
174 (or (buffer-file-name elt) "")) 187 (or (buffer-file-name elt) ""))
175 elt) 188 elt)
176 head))) 189 head)))