(list-buffers-noselect): Collect internal info
for every buffer in BUFFER-LIST arg too.
This commit is contained in:
parent
37d8fcc253
commit
a6a2fd5e30
1 changed files with 40 additions and 43 deletions
|
@ -671,8 +671,7 @@ For more information, see the function `buffer-menu'."
|
||||||
;; line with the beginning of the text (rather than with the left
|
;; line with the beginning of the text (rather than with the left
|
||||||
;; scrollbar or the left fringe). –-Stef
|
;; scrollbar or the left fringe). –-Stef
|
||||||
(setq header (concat (propertize " " 'display '(space :align-to 0))
|
(setq header (concat (propertize " " 'display '(space :align-to 0))
|
||||||
header))
|
header)))
|
||||||
)
|
|
||||||
(with-current-buffer (get-buffer-create "*Buffer List*")
|
(with-current-buffer (get-buffer-create "*Buffer List*")
|
||||||
(setq buffer-read-only nil)
|
(setq buffer-read-only nil)
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
|
@ -684,47 +683,45 @@ For more information, see the function `buffer-menu'."
|
||||||
(mapcar (lambda (c)
|
(mapcar (lambda (c)
|
||||||
(if (memq c '(?\n ?\ )) c underline))
|
(if (memq c '(?\n ?\ )) c underline))
|
||||||
header)))))
|
header)))))
|
||||||
(if buffer-list
|
;; Collect info for every buffer we're interested in.
|
||||||
(setq list buffer-list)
|
(dolist (buffer (or buffer-list (buffer-list)))
|
||||||
;; Collect info for every buffer we're interested in.
|
(with-current-buffer buffer
|
||||||
(dolist (buffer (buffer-list))
|
(let ((name (buffer-name))
|
||||||
(with-current-buffer buffer
|
(file buffer-file-name))
|
||||||
(let ((name (buffer-name))
|
(unless (and (not buffer-list)
|
||||||
(file buffer-file-name))
|
(or
|
||||||
(cond
|
;; Don't mention internal buffers.
|
||||||
;; Don't mention internal buffers.
|
(and (string= (substring name 0 1) " ") (null file))
|
||||||
((and (string= (substring name 0 1) " ") (null file)))
|
;; Maybe don't mention buffers without files.
|
||||||
;; Maybe don't mention buffers without files.
|
(and files-only (not file))
|
||||||
((and files-only (not file)))
|
(string= name "*Buffer List*")))
|
||||||
((string= name "*Buffer List*"))
|
;; Otherwise output info.
|
||||||
;; Otherwise output info.
|
(let ((mode (concat (format-mode-line mode-name nil nil buffer)
|
||||||
(t
|
(if mode-line-process
|
||||||
(let ((mode (concat (format-mode-line mode-name nil nil buffer)
|
(format-mode-line mode-line-process
|
||||||
(if mode-line-process
|
nil nil buffer))))
|
||||||
(format-mode-line mode-line-process
|
(bits (string
|
||||||
nil nil buffer))))
|
(if (eq buffer old-buffer) ?. ?\ )
|
||||||
(bits (string
|
;; Handle readonly status. The output buffer
|
||||||
(if (eq buffer old-buffer) ?. ?\ )
|
;; is special cased to appear readonly; it is
|
||||||
;; Handle readonly status. The output buffer
|
;; actually made so at a later date.
|
||||||
;; is special cased to appear readonly; it is
|
(if (or (eq buffer standard-output)
|
||||||
;; actually made so at a later date.
|
buffer-read-only)
|
||||||
(if (or (eq buffer standard-output)
|
?% ?\ )
|
||||||
buffer-read-only)
|
;; Identify modified buffers.
|
||||||
?% ?\ )
|
(if (buffer-modified-p) ?* ?\ )
|
||||||
;; Identify modified buffers.
|
;; Space separator.
|
||||||
(if (buffer-modified-p) ?* ?\ )
|
?\ )))
|
||||||
;; Space separator.
|
(unless file
|
||||||
?\ )))
|
;; No visited file. Check local value of
|
||||||
(unless file
|
;; list-buffers-directory.
|
||||||
;; No visited file. Check local value of
|
(when (and (boundp 'list-buffers-directory)
|
||||||
;; list-buffers-directory.
|
list-buffers-directory)
|
||||||
(when (and (boundp 'list-buffers-directory)
|
(setq file list-buffers-directory)))
|
||||||
list-buffers-directory)
|
(push (list buffer bits name (buffer-size) mode file)
|
||||||
(setq file list-buffers-directory)))
|
list))))))
|
||||||
(push (list buffer bits name (buffer-size) mode file)
|
;; Preserve the original buffer-list ordering, just in case.
|
||||||
list)))))))
|
(setq list (nreverse list))
|
||||||
;; Preserve the original buffer-list ordering, just in case.
|
|
||||||
(setq list (nreverse list)))
|
|
||||||
;; Place the buffers's info in the output buffer, sorted if necessary.
|
;; Place the buffers's info in the output buffer, sorted if necessary.
|
||||||
(dolist (buffer
|
(dolist (buffer
|
||||||
(if Buffer-menu-sort-column
|
(if Buffer-menu-sort-column
|
||||||
|
|
Loading…
Add table
Reference in a new issue