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

lisp/mouse.el

index 7a712e20930c1e4d13c1c3baf019c0240b4afddd..63048af5054d5bb7c64298840b6fe05db25add74 100644 (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))))