From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Buffer listing in multiple frames/ttys Date: Thu, 08 Dec 2005 09:48:42 +0200 Organization: JURTA Message-ID: <874q5k9jpp.fsf@jurta.org> References: <87wtinrypp.fsf@jurta.org> <87u0dqm5ta.fsf@jurta.org> <87pso9wvjo.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1134032182 402 80.91.229.2 (8 Dec 2005 08:56:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2005 08:56:22 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 08 09:56:18 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EkHY7-00032D-GN for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2005 09:54:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EkHYO-0006fc-Fi for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2005 03:55:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EkGdV-0006cl-Tl for emacs-devel@gnu.org; Thu, 08 Dec 2005 02:56:18 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EkGdV-0006cW-0h for emacs-devel@gnu.org; Thu, 08 Dec 2005 02:56:17 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EkGdS-0006bz-Pp for emacs-devel@gnu.org; Thu, 08 Dec 2005 02:56:15 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EkGeQ-00088D-35; Thu, 08 Dec 2005 02:57:14 -0500 Original-Received: from mail.neti.ee (80-235-37-157-dsl.mus.estpak.ee [80.235.37.157]) by Relayhost1.neti.ee (Postfix) with ESMTP id 0BEED3841; Thu, 8 Dec 2005 09:56:10 +0200 (EET) Original-To: lorentey@elte.hu (=?utf-8?Q?K=C3=A1roly_L=C5=91rentey?=) In-Reply-To: (=?utf-8?Q?K=C3=A1roly=09L=C5=91rentey's?= message of "Wed, 07 Dec 2005 15:51:14 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:47216 Archived-At: Thanks for your patch. Generally it works correctly, with few exceptions: 1. The function `buffer-list' returns a list of buried buffers in reverse order. In the frame parameter `buried_buffer_list' the most recently buried buffer is first, so `buffer-list' misses a Fnreverse on `prevlist'. 2. Since `last-buffer' is a general function, I suggest to move it to simple.el. 3. Could you create a separate function from lambda which is now let-bound in `last-buffer'? It could be named, for example, as `get-next-valid-buffer'. Beside of the advantage of not messing with funcalls, it will be useful outside `last-buffer'. In .emacs I have a function defadviced on `next-buffer' and `prev-buffer' that displays a list of two previous, current and two next buffer names in the echo area after calling `next-buffer' or `prev-buffer'. The message looks like: -2:*Messages* -1:*Help* 0:.emacs 1:*info* 2:*scratch* It is useful to see what buffers will be visited on subsequent invocation of `next-buffer' or `prev-buffer'. This is like what some window managers display during switching of windows. If you create a new function from lambda then the code to put in .emacs to display this message could be simplified to: (defadvice previous-buffer (after my-previous-buffer activate) (my-display-prev-next-buffers)) (defadvice next-buffer (after my-next-buffer activate) (my-display-prev-next-buffers)) (defun my-display-prev-next-buffers () "Show two previous, current and two next buffer names in the echo area." (interactive) (let ((i -3) b (bl (buffer-list (selected-frame))) (message-log-max nil)) (message "%s" (mapconcat (lambda (x) (setq i (+ i 1)) (format "%d:%-12s" i (substring (buffer-name x) 0 (min (length (buffer-name x)) 11)))) (append (nreverse (list (setq b (get-next-valid-buffer (reverse bl) t)) (get-next-valid-buffer (cdr (memq b (reverse bl))) t))) (list (current-buffer)) (list (setq b (get-next-valid-buffer (cdr bl) t)) (get-next-valid-buffer (cdr (memq b bl)) t))) " ")))) -- Juri Linkov http://www.jurta.org/emacs/