comparison lisp/buff-menu.el @ 58954:bb8424d9ff97

(list-buffers-noselect): Collect internal info for every buffer in BUFFER-LIST arg too.
author Juri Linkov <juri@jurta.org>
date Tue, 14 Dec 2004 02:24:33 +0000
parents 5049881e14d7
children 58f1100f0a9e
comparison
equal deleted inserted replaced
58953:fa562c0fdafe 58954:bb8424d9ff97
669 (put-text-property 0 3 'face 'fixed-pitch header) 669 (put-text-property 0 3 'face 'fixed-pitch header)
670 ;; Add a "dummy" leading space to align the beginning of the 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 671 ;; line with the beginning of the text (rather than with the left
672 ;; scrollbar or the left fringe). –-Stef 672 ;; scrollbar or the left fringe). –-Stef
673 (setq header (concat (propertize " " 'display '(space :align-to 0)) 673 (setq header (concat (propertize " " 'display '(space :align-to 0))
674 header)) 674 header)))
675 )
676 (with-current-buffer (get-buffer-create "*Buffer List*") 675 (with-current-buffer (get-buffer-create "*Buffer List*")
677 (setq buffer-read-only nil) 676 (setq buffer-read-only nil)
678 (erase-buffer) 677 (erase-buffer)
679 (setq standard-output (current-buffer)) 678 (setq standard-output (current-buffer))
680 (unless Buffer-menu-use-header-line 679 (unless Buffer-menu-use-header-line
682 (insert header 681 (insert header
683 (apply 'string 682 (apply 'string
684 (mapcar (lambda (c) 683 (mapcar (lambda (c)
685 (if (memq c '(?\n ?\ )) c underline)) 684 (if (memq c '(?\n ?\ )) c underline))
686 header))))) 685 header)))))
687 (if buffer-list 686 ;; Collect info for every buffer we're interested in.
688 (setq list buffer-list) 687 (dolist (buffer (or buffer-list (buffer-list)))
689 ;; Collect info for every buffer we're interested in. 688 (with-current-buffer buffer
690 (dolist (buffer (buffer-list)) 689 (let ((name (buffer-name))
691 (with-current-buffer buffer 690 (file buffer-file-name))
692 (let ((name (buffer-name)) 691 (unless (and (not buffer-list)
693 (file buffer-file-name)) 692 (or
694 (cond 693 ;; Don't mention internal buffers.
695 ;; Don't mention internal buffers. 694 (and (string= (substring name 0 1) " ") (null file))
696 ((and (string= (substring name 0 1) " ") (null file))) 695 ;; Maybe don't mention buffers without files.
697 ;; Maybe don't mention buffers without files. 696 (and files-only (not file))
698 ((and files-only (not file))) 697 (string= name "*Buffer List*")))
699 ((string= name "*Buffer List*")) 698 ;; Otherwise output info.
700 ;; Otherwise output info. 699 (let ((mode (concat (format-mode-line mode-name nil nil buffer)
701 (t 700 (if mode-line-process
702 (let ((mode (concat (format-mode-line mode-name nil nil buffer) 701 (format-mode-line mode-line-process
703 (if mode-line-process 702 nil nil buffer))))
704 (format-mode-line mode-line-process 703 (bits (string
705 nil nil buffer)))) 704 (if (eq buffer old-buffer) ?. ?\ )
706 (bits (string 705 ;; Handle readonly status. The output buffer
707 (if (eq buffer old-buffer) ?. ?\ ) 706 ;; is special cased to appear readonly; it is
708 ;; Handle readonly status. The output buffer 707 ;; actually made so at a later date.
709 ;; is special cased to appear readonly; it is 708 (if (or (eq buffer standard-output)
710 ;; actually made so at a later date. 709 buffer-read-only)
711 (if (or (eq buffer standard-output) 710 ?% ?\ )
712 buffer-read-only) 711 ;; Identify modified buffers.
713 ?% ?\ ) 712 (if (buffer-modified-p) ?* ?\ )
714 ;; Identify modified buffers. 713 ;; Space separator.
715 (if (buffer-modified-p) ?* ?\ ) 714 ?\ )))
716 ;; Space separator. 715 (unless file
717 ?\ ))) 716 ;; No visited file. Check local value of
718 (unless file 717 ;; list-buffers-directory.
719 ;; No visited file. Check local value of 718 (when (and (boundp 'list-buffers-directory)
720 ;; list-buffers-directory. 719 list-buffers-directory)
721 (when (and (boundp 'list-buffers-directory) 720 (setq file list-buffers-directory)))
722 list-buffers-directory) 721 (push (list buffer bits name (buffer-size) mode file)
723 (setq file list-buffers-directory))) 722 list))))))
724 (push (list buffer bits name (buffer-size) mode file) 723 ;; Preserve the original buffer-list ordering, just in case.
725 list))))))) 724 (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. 725 ;; Place the buffers's info in the output buffer, sorted if necessary.
729 (dolist (buffer 726 (dolist (buffer
730 (if Buffer-menu-sort-column 727 (if Buffer-menu-sort-column
731 (sort list 728 (sort list
732 (if (eq Buffer-menu-sort-column 3) 729 (if (eq Buffer-menu-sort-column 3)