/[emacs]/emacs/lisp/buff-menu.el
ViewVC logotype

Diff of /emacs/lisp/buff-menu.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.54.4.8 by miles, Thu Nov 4 13:12:40 2004 UTC revision 1.54.4.9 by miles, Wed Dec 8 23:31:42 2004 UTC
# Line 1  Line 1 
1  ;;; buff-menu.el --- buffer menu main function and support functions  ;;; buff-menu.el --- buffer menu main function and support functions
2    
3  ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 2000, 2001, 2002, 03, 2004  ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2000, 2001, 2002, 2003,
4  ;;   Free Software Foundation, Inc.  ;;   2004  Free Software Foundation, Inc.
5    
6  ;; Maintainer: FSF  ;; Maintainer: FSF
7  ;; Keywords: convenience  ;; Keywords: convenience
# Line 632  For more information, see the function ` Line 632  For more information, see the function `
632                                 (Buffer-menu-sort ,column))))                                 (Buffer-menu-sort ,column))))
633                          map)))                          map)))
634    
635  (defun list-buffers-noselect (&optional files-only)  (defun list-buffers-noselect (&optional files-only buffer-list)
636    "Create and return a buffer with a list of names of existing buffers.    "Create and return a buffer with a list of names of existing buffers.
637  The buffer is named `*Buffer List*'.  The buffer is named `*Buffer List*'.
638  Note that buffers with names starting with spaces are omitted.  Note that buffers with names starting with spaces are omitted.
639  Non-null optional arg FILES-ONLY means mention only file buffers.  Non-null optional arg FILES-ONLY means mention only file buffers.
640    
641    If BUFFER-LIST is non-nil, it should be a list of buffers;
642    it means list those buffers and no others.
643    
644  For more information, see the function `buffer-menu'."  For more information, see the function `buffer-menu'."
645    (let* ((old-buffer (current-buffer))    (let* ((old-buffer (current-buffer))
646           (standard-output standard-output)           (standard-output standard-output)
# Line 649  For more information, see the function ` Line 652  For more information, see the function `
652                           "  "                           "  "
653                           (Buffer-menu-make-sort-button "Mode" 4) mode-end                           (Buffer-menu-make-sort-button "Mode" 4) mode-end
654                           (Buffer-menu-make-sort-button "File" 5) "\n"))                           (Buffer-menu-make-sort-button "File" 5) "\n"))
655           list desired-point name mode file)           list desired-point)
656      (when Buffer-menu-use-header-line      (when Buffer-menu-use-header-line
657        (let ((pos 0))        (let ((pos 0))
658          ;; Turn spaces in the header into stretch specs so they work          ;; Turn spaces in the header into stretch specs so they work
# Line 669  For more information, see the function ` Line 672  For more information, see the function `
672          (insert (Buffer-menu-buffer+size "------" "----"))          (insert (Buffer-menu-buffer+size "------" "----"))
673          (insert "  ----" mode-end "----\n")          (insert "  ----" mode-end "----\n")
674          (put-text-property 1 (point) 'intangible t))          (put-text-property 1 (point) 'intangible t))
675        (setq list        (if buffer-list
676              (delq t            (setq list buffer-list)
677                    (mapcar          ;; Collect info for every buffer we're interested in.
678                     (lambda (buffer)          (dolist (buffer (buffer-list))
679                       (with-current-buffer buffer            (with-current-buffer buffer
680                         (setq name (buffer-name)              (let ((name (buffer-name))
681                               mode (concat (format-mode-line mode-name nil nil buffer)                    (file buffer-file-name))
682                                            (if mode-line-process                (cond
683                                                (format-mode-line mode-line-process nil nil buffer)))                 ;; Don't mention internal buffers.
684                               file (buffer-file-name))                 ((and (string= (substring name 0 1) " ") (null file)))
685                         (cond                 ;; Maybe don't mention buffers without files.
686                          ;; Don't mention internal buffers.                 ((and files-only (not file)))
687                          ((and (string= (substring name 0 1) " ") (null file)))                 ((string= name "*Buffer List*"))
688                          ;; Maybe don't mention buffers without files.                 ;; Otherwise output info.
689                          ((and files-only (not file)))                 (t
690                          ((string= name "*Buffer List*"))                  (let ((mode (concat (format-mode-line mode-name nil nil buffer)
691                          ;; Otherwise output info.                                      (if mode-line-process
692                          (t                                          (format-mode-line mode-line-process
693                           (unless file                                                            nil nil buffer))))
694                             ;; No visited file.  Check local value of                        (bits (string
695                             ;; list-buffers-directory.                               (if (eq buffer old-buffer) ?. ?\ )
696                             (when (and (boundp 'list-buffers-directory)                               ;; Handle readonly status.  The output buffer
697                                        list-buffers-directory)                               ;; is special cased to appear readonly; it is
698                               (setq file list-buffers-directory)))                               ;; actually made so at a later date.
699                           (list buffer                               (if (or (eq buffer standard-output)
700                                 (format "%c%c%c "                                       buffer-read-only)
701                                         (if (eq buffer old-buffer) ?. ? )                                   ?% ?\ )
702                                         ;; Handle readonly status.  The output buffer is special                               ;; Identify modified buffers.
703                                         ;; cased to appear readonly; it is actually made so at a                               (if (buffer-modified-p) ?* ?\ )
704                                         ;; later date.                               ;; Space separator.
705                                         (if (or (eq buffer standard-output)                               ?\ )))
706                                                 buffer-read-only)                    (unless file
707                                             ?% ? )                      ;; No visited file.  Check local value of
708                                         ;; Identify modified buffers.                      ;; list-buffers-directory.
709                                         (if (buffer-modified-p) ?* ? ))                      (when (and (boundp 'list-buffers-directory)
710                                 name (buffer-size) mode file)))))                                 list-buffers-directory)
711                     (buffer-list))))                        (setq file list-buffers-directory)))
712                      (push (list buffer bits name (buffer-size) mode file)
713                            list)))))))
714            ;; Preserve the original buffer-list ordering, just in case.
715            (setq list (nreverse list)))
716          ;; Place the buffers's info in the output buffer, sorted if necessary.
717        (dolist (buffer        (dolist (buffer
718                 (if Buffer-menu-sort-column                 (if Buffer-menu-sort-column
719                     (sort list                     (sort list
# Line 750  For more information, see the function ` Line 758  For more information, see the function `
758        (set-buffer-modified-p nil)        (set-buffer-modified-p nil)
759        (current-buffer))))        (current-buffer))))
760    
761  ;;; arch-tag: e7dfcfc9-6cb2-46e4-bf55-8ef1936d83c6  ;; arch-tag: e7dfcfc9-6cb2-46e4-bf55-8ef1936d83c6
762  ;;; buff-menu.el ends here  ;;; buff-menu.el ends here

Legend:
Removed from v.1.54.4.8  
changed lines
  Added in v.1.54.4.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26