From: lorentey@elte.hu (Károly Lőrentey)
Cc: juri@jurta.org, emacs-devel@gnu.org
Subject: Re: Buffer listing in multiple frames/ttys
Date: Tue, 06 Dec 2005 13:44:53 +0100 [thread overview]
Message-ID: <lorentey.m.other.87vey2wg1m.elte@walrus.fnord.hu> (raw)
In-Reply-To: <E1EjRrd-0000Gn-V1@fencepost.gnu.org> (Richard M. Stallman's message of "Mon, 05 Dec 2005 20:43:29 -0500")
[-- Attachment #1.1: Type: text/plain, Size: 3178 bytes --]
Richard Stallman <rms@gnu.org> writes:
> bury-buffer is the only way to put a buffer at the end of the buffer
> list. next-buffer must call bury-buffer in order to do that.
OK.
I note that `bury-buffer' removes the buffer from the frame-local
buffer lists of all frames, not just the selected one. This is an
unwanted side-effect in this case, as we want the effects of
`next-buffer' to remain frame-local. I propose to add an optional
parameter to `bury-buffer' to support this.
> Now, I like these definitions as it makes more sense for me to keep
> the buffer cycle frame-local, but they do have one disadvantage: the
> `next-buffer'/`prev-buffer' cycle will not usually contain all
> buffers---just those that were displayed in the current frame.
>
> As far as I can see, buffers that have never been displayed in this
> frame WILL be included. other-buffer will find them, and prev-buffer
> will find them via the call to buffer-list.
In my quoted message, the definition of next buffer appends the old
buffer to the end of the frame-local buffer list. Therefore, the
frame-local list will be recycled continously, and subsequent
`next-buffer' calls are prevented from reaching any buffers in the
global buffer list.
I appended to the end of this message enhanced versions of
`next-buffer' and `prev-buffer' that eliminate this problem by
maintaining a new auxiliary frame-local buffer list, called
`previous-buffer-list'. `next-buffer' prepends the old buffer to this
list, and `prev-buffer' searches this list first; otherwise the two
functions behave as in CVS.
> However, I see that these functions do not find buffers that are
> currently displayed in some window. I think that these commands
> should disregard whether the buffer is visible elsewhere. That means
> passing t for the 2nd arg to other-buffer, and removing some code in
> prev-buffer.
I applied that change to these new versions. I also agree with Juri's
suggestion to rename `prev-buffer' to `previous-buffer', for
consistency with the rest of Emacs.
(defun next-buffer ()
"Switch to the next buffer in cyclic order."
(interactive)
(let ((buffer (current-buffer))
(pbl (frame-parameter nil 'previous-buffer-list)))
(switch-to-buffer (other-buffer buffer t))
(bury-buffer buffer)
(set-frame-parameter nil 'previous-buffer-list
(cons buffer (delq buffer pbl)))))
(defun prev-buffer ()
"Switch to the previous buffer in cyclic order."
(interactive)
(let ((search-list
#'(lambda (list)
"Search LIST for a valid buffer to display."
(let (found buffer)
(while (and (not found) (list))
(setq buffer (car list))
(if (and (buffer-live-p buffer)
(not (string-match "\\` " (buffer-name buffer))))
(setq found buffer)
(setq list (cdr list))))
list))))
(let ((prev (funcall search-list (frame-parameter nil 'previous-buffer-list))))
(set-frame-parameter nil 'previous-buffer-list (cdr prev))
(switch-to-buffer
(or (car prev)
(car (funcall search-list (nreverse (buffer-list)))))))))
--
Károly
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2005-12-06 12:44 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-24 20:25 Buffer listing in multiple frames/ttys Len Trigg
2005-11-24 21:44 ` Károly Lőrentey
2005-11-28 14:37 ` Lőrentey Károly
2005-11-28 17:16 ` Drew Adams
2005-11-28 18:24 ` Lőrentey Károly
2005-11-28 19:23 ` Drew Adams
2005-11-28 20:48 ` Lőrentey Károly
2005-11-28 23:12 ` Drew Adams
2005-11-29 0:15 ` Luc Teirlinck
2005-11-29 0:29 ` Drew Adams
2005-11-29 10:45 ` Lőrentey Károly
2005-11-29 15:36 ` Drew Adams
2005-11-29 18:43 ` Luc Teirlinck
2005-11-29 19:24 ` Drew Adams
2005-11-30 13:21 ` Lőrentey Károly
2005-11-29 18:12 ` Luc Teirlinck
2005-11-29 23:35 ` Luc Teirlinck
2005-11-29 23:55 ` Chong Yidong
2005-11-29 23:57 ` Chong Yidong
2005-11-30 0:20 ` Drew Adams
2005-12-02 21:09 ` Juri Linkov
2005-12-03 15:58 ` Richard M. Stallman
2005-12-03 17:03 ` Lőrentey Károly
2005-12-03 17:46 ` Juri Linkov
2005-12-04 21:18 ` Richard M. Stallman
2005-12-04 21:56 ` Juri Linkov
2005-12-05 4:33 ` Eli Zaretskii
2005-12-05 6:03 ` Juri Linkov
2005-12-05 16:38 ` Richard M. Stallman
2005-12-05 14:44 ` Károly Lőrentey
2005-12-05 21:32 ` Juri Linkov
2005-12-06 16:42 ` Richard M. Stallman
2005-12-06 1:43 ` Richard M. Stallman
2005-12-06 12:44 ` Károly Lőrentey [this message]
2005-12-07 0:52 ` Juri Linkov
2005-12-07 14:51 ` Károly Lőrentey
2005-12-07 21:29 ` Juri Linkov
2005-12-08 7:48 ` Juri Linkov
2005-12-08 14:26 ` Lőrentey Károly
2005-12-08 19:29 ` Richard M. Stallman
2005-12-08 21:56 ` Juri Linkov
2005-12-09 15:04 ` Richard M. Stallman
2005-12-09 20:04 ` Lőrentey Károly
2005-12-09 23:54 ` Juri Linkov
2005-12-10 16:18 ` Richard M. Stallman
2005-12-11 0:54 ` Juri Linkov
2005-12-11 16:49 ` Richard M. Stallman
2005-12-11 16:57 ` Károly Lőrentey
2005-12-11 16:53 ` Károly Lőrentey
2005-12-11 22:57 ` Richard M. Stallman
2005-12-12 12:56 ` Károly Lőrentey
2005-12-12 7:43 ` Juri Linkov
2005-12-07 17:07 ` Richard M. Stallman
2005-12-07 17:15 ` Károly Lőrentey
2005-12-08 4:53 ` Richard M. Stallman
2005-12-06 16:20 ` Drew Adams
2005-12-06 18:09 ` Lőrentey Károly
2005-12-07 16:54 ` Drew Adams
2005-12-07 21:29 ` Juri Linkov
2005-12-08 0:03 ` Drew Adams
[not found] <lorentey.g.e.devel.87hd9uff0k.elte@walrus.fnord.hu>
2005-11-30 16:33 ` Drew Adams
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=lorentey.m.other.87vey2wg1m.elte@walrus.fnord.hu \
--to=lorentey@elte.hu \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.org \
/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).