]> git.eshelyaron.com Git - emacs.git/commitdiff
(mouse-menu-bar-buffers): Include % and * in each item.
authorRichard M. Stallman <rms@gnu.org>
Fri, 25 Jun 1993 22:30:49 +0000 (22:30 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 25 Jun 1993 22:30:49 +0000 (22:30 +0000)
Calculate amount of space needed for longest buffer name.

lisp/menu-bar.el

index 0f174f1fab9f9557ff4d3ec5628fcb9d00af3af9..67df0d261850a636c69675da820ef9801830671a 100644 (file)
@@ -160,8 +160,16 @@ and selects that window."
          (list "Buffer Menu"
                (cons "Select Buffer"
                      (let ((tail buffers)
+                           (maxbuf 0)
                            (maxlen 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 buffers)
                        (while tail
                          (let ((elt (car tail)))
                            (if (not (string-match "^ "
@@ -169,8 +177,13 @@ 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)))