comparison lisp/buff-menu.el @ 90054:f2ebccfa87d4

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-709 Update from CVS: src/indent.c (Fvertical_motion): Fix last change. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-710 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-715 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 08 Dec 2004 05:02:30 +0000
parents b637c617432f 5049881e14d7
children fb79180b618d
comparison
equal deleted inserted replaced
90053:fff5f1a61d92 90054:f2ebccfa87d4
1 ;;; buff-menu.el --- buffer menu main function and support functions 1 ;;; buff-menu.el --- buffer menu main function and support functions -*- coding:utf-8 -*-
2 2
3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2000, 2001, 2002, 2003, 3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2000, 2001, 2002, 2003,
4 ;; 2004 Free Software Foundation, Inc. 4 ;; 2004 Free Software Foundation, Inc.
5 5
6 ;; Maintainer: FSF 6 ;; Maintainer: FSF
188 #'(lambda (&optional noconfirm) 'fast)) 188 #'(lambda (&optional noconfirm) 'fast))
189 (setq truncate-lines t) 189 (setq truncate-lines t)
190 (setq buffer-read-only t) 190 (setq buffer-read-only t)
191 (run-hooks 'buffer-menu-mode-hook)) 191 (run-hooks 'buffer-menu-mode-hook))
192 192
193 ;; This function exists so we can make the doc string of Buffer-menu-mode
194 ;; look nice.
193 (defun Buffer-menu-revert () 195 (defun Buffer-menu-revert ()
194 "Update the list of buffers." 196 "Update the list of buffers."
195 (interactive) 197 (interactive)
196 (revert-buffer)) 198 (revert-buffer))
197 199
643 645
644 For more information, see the function `buffer-menu'." 646 For more information, see the function `buffer-menu'."
645 (let* ((old-buffer (current-buffer)) 647 (let* ((old-buffer (current-buffer))
646 (standard-output standard-output) 648 (standard-output standard-output)
647 (mode-end (make-string (- Buffer-menu-mode-width 2) ? )) 649 (mode-end (make-string (- Buffer-menu-mode-width 2) ? ))
648 (header (concat " " (propertize "CRM " 'face 'fixed-pitch) 650 (header (concat "CRM "
649 (Buffer-menu-buffer+size 651 (Buffer-menu-buffer+size
650 (Buffer-menu-make-sort-button "Buffer" 2) 652 (Buffer-menu-make-sort-button "Buffer" 2)
651 (Buffer-menu-make-sort-button "Size" 3)) 653 (Buffer-menu-make-sort-button "Size" 3))
652 " " 654 " "
653 (Buffer-menu-make-sort-button "Mode" 4) mode-end 655 (Buffer-menu-make-sort-button "Mode" 4) mode-end
658 ;; Turn spaces in the header into stretch specs so they work 660 ;; Turn spaces in the header into stretch specs so they work
659 ;; regardless of the header-line face. 661 ;; regardless of the header-line face.
660 (while (string-match "[ \t]+" header pos) 662 (while (string-match "[ \t]+" header pos)
661 (setq pos (match-end 0)) 663 (setq pos (match-end 0))
662 (put-text-property (match-beginning 0) pos 'display 664 (put-text-property (match-beginning 0) pos 'display
663 ;; Assume fixed-size chars 665 ;; Assume fixed-size chars in the buffer.
664 (list 'space :align-to (1- pos)) 666 (list 'space :align-to pos)
665 header)))) 667 header)))
668 ;; Try to better align the one-char headers.
669 (put-text-property 0 3 'face 'fixed-pitch header)
670 ;; Add a "dummy" leading space to align the beginning of the header
671 ;; line with the beginning of the text (rather than with the left
672 ;; scrollbar or the left fringe). –-Stef
673 (setq header (concat (propertize " " 'display '(space :align-to 0))
674 header))
675 )
666 (with-current-buffer (get-buffer-create "*Buffer List*") 676 (with-current-buffer (get-buffer-create "*Buffer List*")
667 (setq buffer-read-only nil) 677 (setq buffer-read-only nil)
668 (erase-buffer) 678 (erase-buffer)
669 (setq standard-output (current-buffer)) 679 (setq standard-output (current-buffer))
670 (unless Buffer-menu-use-header-line 680 (unless Buffer-menu-use-header-line
671 (insert header (propertize "---" 'face 'fixed-pitch) " ") 681 (let ((underline (if (char-displayable-p ?—) ?— ?-)))
672 (insert (Buffer-menu-buffer+size "------" "----")) 682 (insert header
673 (insert " ----" mode-end "----\n") 683 (apply 'string
674 (put-text-property 1 (point) 'intangible t)) 684 (mapcar (lambda (c)
685 (if (memq c '(?\n ?\ )) c underline))
686 header)))))
675 (if buffer-list 687 (if buffer-list
676 (setq list buffer-list) 688 (setq list buffer-list)
677 ;; Collect info for every buffer we're interested in. 689 ;; Collect info for every buffer we're interested in.
678 (dolist (buffer (buffer-list)) 690 (dolist (buffer (buffer-list))
679 (with-current-buffer buffer 691 (with-current-buffer buffer