diff options
Diffstat (limited to 'lisp/buff-menu.el')
| -rw-r--r-- | lisp/buff-menu.el | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 990ab32c9a4..1c3fa704041 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el | |||
| @@ -484,14 +484,19 @@ in the selected frame." | |||
| 484 | "Make the other window select this line's buffer. | 484 | "Make the other window select this line's buffer. |
| 485 | The current window remains selected." | 485 | The current window remains selected." |
| 486 | (interactive) | 486 | (interactive) |
| 487 | (display-buffer (Buffer-menu-buffer t))) | 487 | (let ((pop-up-windows t) |
| 488 | same-window-buffer-names | ||
| 489 | same-window-regexps) | ||
| 490 | (display-buffer (Buffer-menu-buffer t)))) | ||
| 488 | 491 | ||
| 489 | (defun Buffer-menu-2-window () | 492 | (defun Buffer-menu-2-window () |
| 490 | "Select this line's buffer, with previous buffer in second window." | 493 | "Select this line's buffer, with previous buffer in second window." |
| 491 | (interactive) | 494 | (interactive) |
| 492 | (let ((buff (Buffer-menu-buffer t)) | 495 | (let ((buff (Buffer-menu-buffer t)) |
| 493 | (menu (current-buffer)) | 496 | (menu (current-buffer)) |
| 494 | (pop-up-windows t)) | 497 | (pop-up-windows t) |
| 498 | same-window-buffer-names | ||
| 499 | same-window-regexps) | ||
| 495 | (delete-other-windows) | 500 | (delete-other-windows) |
| 496 | (switch-to-buffer (other-buffer)) | 501 | (switch-to-buffer (other-buffer)) |
| 497 | (pop-to-buffer buff) | 502 | (pop-to-buffer buff) |
| @@ -671,8 +676,7 @@ For more information, see the function `buffer-menu'." | |||
| 671 | ;; line with the beginning of the text (rather than with the left | 676 | ;; line with the beginning of the text (rather than with the left |
| 672 | ;; scrollbar or the left fringe). –-Stef | 677 | ;; scrollbar or the left fringe). –-Stef |
| 673 | (setq header (concat (propertize " " 'display '(space :align-to 0)) | 678 | (setq header (concat (propertize " " 'display '(space :align-to 0)) |
| 674 | header)) | 679 | header))) |
| 675 | ) | ||
| 676 | (with-current-buffer (get-buffer-create "*Buffer List*") | 680 | (with-current-buffer (get-buffer-create "*Buffer List*") |
| 677 | (setq buffer-read-only nil) | 681 | (setq buffer-read-only nil) |
| 678 | (erase-buffer) | 682 | (erase-buffer) |
| @@ -684,47 +688,45 @@ For more information, see the function `buffer-menu'." | |||
| 684 | (mapcar (lambda (c) | 688 | (mapcar (lambda (c) |
| 685 | (if (memq c '(?\n ?\ )) c underline)) | 689 | (if (memq c '(?\n ?\ )) c underline)) |
| 686 | header))))) | 690 | header))))) |
| 687 | (if buffer-list | 691 | ;; Collect info for every buffer we're interested in. |
| 688 | (setq list buffer-list) | 692 | (dolist (buffer (or buffer-list (buffer-list))) |
| 689 | ;; Collect info for every buffer we're interested in. | 693 | (with-current-buffer buffer |
| 690 | (dolist (buffer (buffer-list)) | 694 | (let ((name (buffer-name)) |
| 691 | (with-current-buffer buffer | 695 | (file buffer-file-name)) |
| 692 | (let ((name (buffer-name)) | 696 | (unless (and (not buffer-list) |
| 693 | (file buffer-file-name)) | 697 | (or |
| 694 | (cond | 698 | ;; Don't mention internal buffers. |
| 695 | ;; Don't mention internal buffers. | 699 | (and (string= (substring name 0 1) " ") (null file)) |
| 696 | ((and (string= (substring name 0 1) " ") (null file))) | 700 | ;; Maybe don't mention buffers without files. |
| 697 | ;; Maybe don't mention buffers without files. | 701 | (and files-only (not file)) |
| 698 | ((and files-only (not file))) | 702 | (string= name "*Buffer List*"))) |
| 699 | ((string= name "*Buffer List*")) | 703 | ;; Otherwise output info. |
| 700 | ;; Otherwise output info. | 704 | (let ((mode (concat (format-mode-line mode-name nil nil buffer) |
| 701 | (t | 705 | (if mode-line-process |
| 702 | (let ((mode (concat (format-mode-line mode-name nil nil buffer) | 706 | (format-mode-line mode-line-process |
| 703 | (if mode-line-process | 707 | nil nil buffer)))) |
| 704 | (format-mode-line mode-line-process | 708 | (bits (string |
| 705 | nil nil buffer)))) | 709 | (if (eq buffer old-buffer) ?. ?\ ) |
| 706 | (bits (string | 710 | ;; Handle readonly status. The output buffer |
| 707 | (if (eq buffer old-buffer) ?. ?\ ) | 711 | ;; is special cased to appear readonly; it is |
| 708 | ;; Handle readonly status. The output buffer | 712 | ;; actually made so at a later date. |
| 709 | ;; is special cased to appear readonly; it is | 713 | (if (or (eq buffer standard-output) |
| 710 | ;; actually made so at a later date. | 714 | buffer-read-only) |
| 711 | (if (or (eq buffer standard-output) | 715 | ?% ?\ ) |
| 712 | buffer-read-only) | 716 | ;; Identify modified buffers. |
| 713 | ?% ?\ ) | 717 | (if (buffer-modified-p) ?* ?\ ) |
| 714 | ;; Identify modified buffers. | 718 | ;; Space separator. |
| 715 | (if (buffer-modified-p) ?* ?\ ) | 719 | ?\ ))) |
| 716 | ;; Space separator. | 720 | (unless file |
| 717 | ?\ ))) | 721 | ;; No visited file. Check local value of |
| 718 | (unless file | 722 | ;; list-buffers-directory. |
| 719 | ;; No visited file. Check local value of | 723 | (when (and (boundp 'list-buffers-directory) |
| 720 | ;; list-buffers-directory. | 724 | list-buffers-directory) |
| 721 | (when (and (boundp 'list-buffers-directory) | 725 | (setq file list-buffers-directory))) |
| 722 | list-buffers-directory) | 726 | (push (list buffer bits name (buffer-size) mode file) |
| 723 | (setq file list-buffers-directory))) | 727 | list)))))) |
| 724 | (push (list buffer bits name (buffer-size) mode file) | 728 | ;; Preserve the original buffer-list ordering, just in case. |
| 725 | list))))))) | 729 | (setq list (nreverse list)) |
| 726 | ;; Preserve the original buffer-list ordering, just in case. | ||
| 727 | (setq list (nreverse list))) | ||
| 728 | ;; Place the buffers's info in the output buffer, sorted if necessary. | 730 | ;; Place the buffers's info in the output buffer, sorted if necessary. |
| 729 | (dolist (buffer | 731 | (dolist (buffer |
| 730 | (if Buffer-menu-sort-column | 732 | (if Buffer-menu-sort-column |