From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Matthias Meulien Newsgroups: gmane.emacs.bugs Subject: list buffers Date: 14 Nov 2004 13:56:56 +0530 Organization: Chennai Mathematical Institute Message-ID: <5bd5ygal9r.fsf@pelican.cmi.ac.in> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1100420873 25502 80.91.229.6 (14 Nov 2004 08:27:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 14 Nov 2004 08:27:53 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 14 09:27:39 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CTFjW-0000n1-00 for ; Sun, 14 Nov 2004 09:27:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTFs9-0007O9-VD for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Nov 2004 03:36:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CTFs8-0007Nx-Ni for bug-gnu-emacs@gnu.org; Sun, 14 Nov 2004 03:36:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CTFs7-0007NY-VH for bug-gnu-emacs@gnu.org; Sun, 14 Nov 2004 03:36:32 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTFs7-0007NV-R3 for bug-gnu-emacs@gnu.org; Sun, 14 Nov 2004 03:36:31 -0500 Original-Received: from [61.11.73.30] (helo=macaque.cmi.ac.in) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CTFj9-0004Yw-Ah for bug-gnu-emacs@gnu.org; Sun, 14 Nov 2004 03:27:16 -0500 Original-Received: from gaur.cmi.ac.in (root@gaur.cmi.ac.in [192.168.52.2]) by macaque.cmi.ac.in (8.12.11/8.12.11/Debian-3) with ESMTP id iAE8Qw1S011453 for ; Sun, 14 Nov 2004 13:56:58 +0530 Original-Received: from pelican.cmi.ac.in (root@pelican.cmi.ac.in [192.168.52.22]) by gaur.cmi.ac.in (8.12.11/8.12.11/Debian-3) with ESMTP id iAE8Qwwu017633 for ; Sun, 14 Nov 2004 13:56:58 +0530 Original-Received: from pelican.cmi.ac.in (meulien@localhost [127.0.0.1]) by pelican.cmi.ac.in (8.12.11/8.12.11/Debian-3) with ESMTP id iAE8QwG0014089 for ; Sun, 14 Nov 2004 13:56:58 +0530 Original-Received: (from meulien@localhost) by pelican.cmi.ac.in (8.12.11/8.12.11/Debian-3) id iAE8QuYo014086; Sun, 14 Nov 2004 13:56:56 +0530 Original-To: bug-gnu-emacs@gnu.org X-Home-Page: www.math.uvsq.fr/~meulien Original-Lines: 82 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:9689 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:9689 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