diff options
| author | Richard M. Stallman | 1993-06-25 22:33:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-25 22:33:57 +0000 |
| commit | af2a85fe3903e1c8ee2de2dd72459e4471f5260c (patch) | |
| tree | b2d56b3c83610f964bbc6bbbec5726c37da9b4dd | |
| parent | b9d07cf7118787c8f11b41884c7d60cecedd6643 (diff) | |
| download | emacs-af2a85fe3903e1c8ee2de2dd72459e4471f5260c.tar.gz emacs-af2a85fe3903e1c8ee2de2dd72459e4471f5260c.zip | |
(mouse-buffer-menu): Include % and * in each item.
Calculate amount of space needed for longest buffer name.
| -rw-r--r-- | lisp/mouse.el | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 7a712e20930..63048af5054 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -371,16 +371,30 @@ and selects that window." | |||
| 371 | (list "Buffer Menu" | 371 | (list "Buffer Menu" |
| 372 | (cons "Select Buffer" | 372 | (cons "Select Buffer" |
| 373 | (let ((tail (buffer-list)) | 373 | (let ((tail (buffer-list)) |
| 374 | (maxbuf 0) | ||
| 374 | head) | 375 | head) |
| 375 | (while tail | 376 | (while tail |
| 377 | (or (eq ?\ (aref (buffer-name (car tail)) 0)) | ||
| 378 | (setq maxbuf | ||
| 379 | (max maxbuf | ||
| 380 | (length (buffer-name (car tail)))))) | ||
| 381 | (setq tail (cdr tail))) | ||
| 382 | (setq tail (buffer-list)) | ||
| 383 | (while tail | ||
| 376 | (let ((elt (car tail))) | 384 | (let ((elt (car tail))) |
| 377 | (if (not (string-match "^ " | 385 | (if (not (string-match "^ " |
| 378 | (buffer-name elt))) | 386 | (buffer-name elt))) |
| 379 | (setq head (cons | 387 | (setq head (cons |
| 380 | (cons | 388 | (cons |
| 381 | (format | 389 | (format |
| 382 | "%-14s %s" | 390 | (format "%%%ds %%s%%s %%s" |
| 391 | maxbuf) | ||
| 383 | (buffer-name elt) | 392 | (buffer-name elt) |
| 393 | (if (buffer-modified-p elt) | ||
| 394 | "*" " ") | ||
| 395 | (save-excursion | ||
| 396 | (set-buffer elt) | ||
| 397 | (if buffer-read-only "%" " ")) | ||
| 384 | (or (buffer-file-name elt) "")) | 398 | (or (buffer-file-name elt) "")) |
| 385 | elt) | 399 | elt) |
| 386 | head)))) | 400 | head)))) |