From: Matthias Meulien <meulien@cmi.ac.in>
Subject: list buffers
Date: 14 Nov 2004 13:56:56 +0530 [thread overview]
Message-ID: <5bd5ygal9r.fsf@pelican.cmi.ac.in> (raw)
In GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2004-04-07 on raven, modified by Debian
configured using `configure '--build=i386-linux' '--host=i386-linux' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--with-x=yes' '--with-x-toolkit=athena' 'CFLAGS=-DDEBIAN -g -O2' 'build_alias=i386-linux' 'host_alias=i386-linux''
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
I describe a missing feature rather than a bug. I hope it's the right
place to do so (there is no maintener email in the file
`buff-menu.el').
One wants to be able to browse, delete, etc buffers that will be saved
by the library `desktop.el' (for example such a function could be in
the `kill-emacs-query-functions' variable).
The following function (written by Kevin Rodgers) return the right
list of buffers:
(defun desktop-save-buffer-list ()
"Return the list of buffers that `desktop-save' would save."
(let ((buffer-list '()))
(mapc (lambda (buffer)
(with-current-buffer buffer
(when (desktop-save-buffer-p (buffer-file-name)
(buffer-name)
major-mode)
(setq buffer-list (cons buffer buffer-list)))))
(buffer-list))
(nreverse buffer-list)))
But the browsing, deleting, etc facilities are missing.
To fix this, one needs a light improvment of `list-buffers-noselect'.
It should be possible to pass a second optional argument to this
function, namely a list of buffers; in case this argument is non-nil,
the displayed list of buffers in the buffer *Buffer List* is the one
passed as argument so that the user can browse, etc this list of
buffers.
For clarity, I insert the (trivial) code to implement this:
(defun list-buffers-noselect (&optional files-only arg)
"Create and return a buffer with a list of names of existing buffers.
The buffer is named `*Buffer List*'.
Note that buffers with names starting with spaces are omitted.
Non-null optional arg FILES-ONLY means mention only file buffers.
If the optional arg ARG is non-null, then it is interpreted as the list
of buffers to be listed.
The M column contains a * for buffers that are modified.
The R column contains a % for buffers that are read-only."
(let ((old-buffer (current-buffer))
(standard-output standard-output)
desired-point)
(save-excursion
(set-buffer (get-buffer-create "*Buffer List*"))
(setq buffer-read-only nil)
(erase-buffer)
(setq standard-output (current-buffer))
(princ "\
MR Buffer Size Mode File
-- ------ ---- ---- ----
")
;; Record the column where buffer names start.
(setq Buffer-menu-buffer-column 4)
(dolist (buffer (or arg (buffer-list)))
(let ((name (buffer-name buffer))
(...)
Here is the wanted example:
(defun list-desktop-buffers (&optional files-only)
"Display a list of names of buffers that will be saved by
`desktop-save. The list is displayed in a buffer named `*Buffer List*'
(see `list-buffers')."
(interactive "P")
(display-buffer (list-buffers-noselect
files-only (desktop-save-buffer-list))))
Regards,
--
Matthias Meulien
reply other threads:[~2004-11-14 8:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bd5ygal9r.fsf@pelican.cmi.ac.in \
--to=meulien@cmi.ac.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).