all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why does buffer list not stay stable?
@ 2009-03-06  5:47 Samuel Wales
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2009-03-06  5:47 UTC (permalink / raw)
  To: help-gnu-emacs

I have a vexing problem with buffer ordering.

I very frequently use next-buffer and previous-buffer[1]
to navigate to buffers.  If I am in a buffer and create a
few more, I want all of them to be next to each other in the
buffer list.

I treat the list like a ring (or want to) -- I want the two
commands to go in opposite directions on the ring.  I don't
care where the beginning and end of the buffer list are.

But I want buffers that I create or switch to to be
*nearby*.

And I want the two commands to be *opposites*.  Doing one a
few times then the other the same number of times should
return me to the same buffer.

But it doesn't always work like that.  Some buffers end up
far away from where I am, for no apparent reason.  And the
commands are not opposites.  This is disconcerting.

If I am in an org mode buffer (say), and do egg-status, this
brings up a buffer with diffs in it.  If I then call a
function that calls pop-to-buffer or switch-to-buffer, it
takes me to a new buffer.[2] so far so good.

Yet the egg-status buffer is nowhere to be seen (i.e. very
far away on the ring).

Any ideas here?


P.S.  I have also noticed that w3m buffers cluster together.
I assume it's unrelated, although it is sometimes annoying.


[1] I also tried a raise-buffer I came across many years
ago, and bury-buffer.

[2] Please disregard windows here.  99% of the time I
use a single window.  I almost never split them.  I have
pop-up-windows and same-window-* set to try to enforce this
and most of the time they work (except where commands fail
to respect pop-up-windows).

-- 
Myalgic encephalomyelitis denialism is causing death (decades early;
Jason et al. 2006) and severe suffering (worse than nearly all other
diseases studied; e.g. Schweitzer et al. 1995) and *grossly*
corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why does buffer list not stay stable?
       [not found] <mailman.2474.1236318458.31690.help-gnu-emacs@gnu.org>
@ 2009-03-06 17:00 ` Xah Lee
  2009-03-07  1:40   ` Samuel Wales
  0 siblings, 1 reply; 5+ messages in thread
From: Xah Lee @ 2009-03-06 17:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 5, 9:47 pm, Samuel Wales <samolog...@gmail.com> wrote:
> I have a vexing problem with buffer ordering.
>
> I very frequently use next-buffer and previous-buffer[1]
> to navigate to buffers.  If I am in a buffer and create a
> few more, I want all of them to be next to each other in the
> buffer list.
>
> I treat the list like a ring (or want to) -- I want the two
> commands to go in opposite directions on the ring.  I don't
> care where the beginning and end of the buffer list are.
>
> But I want buffers that I create or switch to to be
> *nearby*.
>
> And I want the two commands to be *opposites*.  Doing one a
> few times then the other the same number of times should
> return me to the same buffer.
>
> But it doesn't always work like that.  Some buffers end up
> far away from where I am, for no apparent reason.  And the
> commands are not opposites.  This is disconcerting.
>
> If I am in an org mode buffer (say), and do egg-status, this
> brings up a buffer with diffs in it.  If I then call a
> function that calls pop-to-buffer or switch-to-buffer, it
> takes me to a new buffer.[2] so far so good.
>
> Yet the egg-status buffer is nowhere to be seen (i.e. very
> far away on the ring).
>
> Any ideas here?
>
> P.S.  I have also noticed that w3m buffers cluster together.
> I assume it's unrelated, although it is sometimes annoying.
>
> [1] I also tried a raise-buffer I came across many years
> ago, and bury-buffer.
>
> [2] Please disregard windows here.  99% of the time I
> use a single window.  I almost never split them.  I have
> pop-up-windows and same-window-* set to try to enforce this
> and most of the time they work (except where commands fail
> to respect pop-up-windows).

Do you have tabbar-mode on? that mode does some reordering as far is i
know, to keep its buffers in a tab group together.

i haven't studied exactly how buffers are ordered, but i do notice it
switch about, but probably in a severity you depict.

I have been using my own code for next/previous buffer for about over
a year. However, they are wrapper to next-buffer and previous-buffer,
and i don't notice ordering problems (unless if i have tabbar-mode
on). You might find it useful.

Here's the code:

(defun next-user-buffer ()
  "Switch to the next user buffer in cyclic order.\n
User buffers are those not starting with *."
  (interactive)
  (next-buffer)
  (let ((i 0))
    (while (and (string-match "^*" (buffer-name)) (< i 50))
      (setq i (1+ i)) (next-buffer) )))

(defun previous-user-buffer ()
  "Switch to the previous user buffer in cyclic order.\n
User buffers are those not starting with *."
  (interactive)
  (previous-buffer)
  (let ((i 0))
    (while (and (string-match "^*" (buffer-name)) (< i 50))
      (setq i (1+ i)) (previous-buffer) )))

(defun next-emacs-buffer ()
  "Switch to the next emacs buffer in cyclic order.\n
Emacs buffers are those starting with *."
  (interactive)
  (next-buffer)
  (let ((i 0))
    (while (and (not (string-match "^*" (buffer-name))) (< i 50))
      (setq i (1+ i)) (next-buffer) )))

(defun previous-emacs-buffer ()
  "Switch to the previous emacs buffer in cyclic order.\n
Emacs buffers are those starting with *."
  (interactive)
  (previous-buffer)
  (let ((i 0))
    (while (and (not (string-match "^*" (buffer-name))) (< i 50))
      (setq i (1+ i)) (previous-buffer) )))

The code is used in my ergoemacs project here:
http://code.google.com/p/ergoemacs/

by default, next-user-buffer has the shortcut key Ctrl+PageDown, and
next-emacs-buffer is Ctrl+Shift+PageDown.

(it was Ctrl + left/right arrows, but i decided those keys should stay
the standard editor behavior across platforms, of moving cursor by
word.)

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why does buffer list not stay stable?
  2009-03-06 17:00 ` Xah Lee
@ 2009-03-07  1:40   ` Samuel Wales
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2009-03-07  1:40 UTC (permalink / raw)
  To: Xah Lee; +Cc: help-gnu-emacs

No, I do not use tabbar-mode or anything like that.

Thanks though.  Anybody know how buffer ordering works?

-- 
Myalgic encephalomyelitis denialism is causing death (decades early;
Jason et al. 2006) and severe suffering (worse than nearly all other
diseases studied; e.g. Schweitzer et al. 1995) and *grossly*
corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why does buffer list not stay stable?
@ 2009-03-07 18:56 martin rudalics
  2009-03-16 23:03 ` Samuel Wales
  0 siblings, 1 reply; 5+ messages in thread
From: martin rudalics @ 2009-03-07 18:56 UTC (permalink / raw)
  To: samologist; +Cc: help-gnu-emacs

 > Anybody know how buffer ordering works?

Heuristically ;-)

Please read section 27.8 entitled "The Buffer List" of the Elisp manual
first.  That section also tells you how you can manually change the
order of buffers in the buffer list.  Thereafter you can grep the Elisp
sources to find out who calls the function `bury-buffer' and
`unbury-buffer' and whether and how these calls mess up the order you
wanted in the first place.

martin





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why does buffer list not stay stable?
  2009-03-07 18:56 martin rudalics
@ 2009-03-16 23:03 ` Samuel Wales
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2009-03-16 23:03 UTC (permalink / raw)
  To: martin rudalics; +Cc: help-gnu-emacs

Good suggestions, yielded zero fruit (in this case).

Strangely, it seems that there is something special about the egg
status buffer.  I seem to have worked around that one problem by doing
(switch-to-buffer (current-buffer)) in that buffer.

Now I need to figure out w3m's handling of buffers, which will have to
await another day.

Thanks.

-- 
Myalgic encephalomyelitis denialism is causing death (decades early;
Jason et al. 2006) and severe suffering (worse than nearly all other
diseases studied; e.g. Schweitzer et al. 1995) and *grossly*
corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-16 23:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-06  5:47 Why does buffer list not stay stable? Samuel Wales
     [not found] <mailman.2474.1236318458.31690.help-gnu-emacs@gnu.org>
2009-03-06 17:00 ` Xah Lee
2009-03-07  1:40   ` Samuel Wales
  -- strict thread matches above, loose matches on Subject: below --
2009-03-07 18:56 martin rudalics
2009-03-16 23:03 ` Samuel Wales

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.