* How to bring previous-buffer to cycle through the full list of buffers
@ 2015-05-07 8:41 Jürgen Hartmann
2015-05-07 10:57 ` Andreas Röhler
0 siblings, 1 reply; 8+ messages in thread
From: Jürgen Hartmann @ 2015-05-07 8:41 UTC (permalink / raw
To: help-gnu-emacs@gnu.org
I know that in Emacs 24.5, but also earlier versions, there is is the
variable switch-to-visible-buffer whose default value t causes
switch-to-prev-buffer, and hence also previous-buffer, to cycle through all
buffers in the given window's history even if they might be visible in other
windows.
After the windows history is exhausted by repetitively applying
previous-buffer, the cycling continues with all the other buffers in the
global buffer list, but this time unconditionally skipping those of them that
are visible in other windows--regardless of the setting in
switch-to-visible-buffer.
Does anyone knows a way to bring previous-buffer to cycle through the whole
list of buffers regardless of their visibility elsewhere and regardless of
windows histories?
Any hint is greatly welcome.
Juergen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to bring previous-buffer to cycle through the full list of buffers
2015-05-07 8:41 How to bring previous-buffer to cycle through the full list of buffers Jürgen Hartmann
@ 2015-05-07 10:57 ` Andreas Röhler
2015-05-07 14:42 ` Jürgen Hartmann
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Röhler @ 2015-05-07 10:57 UTC (permalink / raw
To: help-gnu-emacs
Am 07.05.2015 um 10:41 schrieb Jürgen Hartmann:
> I know that in Emacs 24.5, but also earlier versions, there is is the
> variable switch-to-visible-buffer whose default value t causes
> switch-to-prev-buffer, and hence also previous-buffer, to cycle through all
> buffers in the given window's history even if they might be visible in other
> windows.
>
> After the windows history is exhausted by repetitively applying
> previous-buffer, the cycling continues with all the other buffers in the
> global buffer list, but this time unconditionally skipping those of them that
> are visible in other windows--regardless of the setting in
> switch-to-visible-buffer.
>
> Does anyone knows a way to bring previous-buffer to cycle through the whole
> list of buffers regardless of their visibility elsewhere and regardless of
> windows histories?
>
> Any hint is greatly welcome.
>
> Juergen
>
>
Not exactly what you are asking for:
AFAIU it's about to jump back to a certain buffer.
In use here are a kind of hard-coded registers.
Like that:
(defun gehe-zu-register-x (&optional arg)
"With C-u: Puffer merken"
(interactive "P")
(if arg
(progn
(window-configuration-to-register ?x)
(message "%s" "Fenster mit \[C-kp-1] oder \\C-x j x erreichbar"))
(jump-to-register ?x)
(delete-other-windows)
(message "%s" "Mit Arg.: Puffer merken")))
;;;;;
(global-set-key [(control kp-1)] 'gehe-zu-register-x)
I.e. C-u C-kp-1 stores it.
HTH,
Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: How to bring previous-buffer to cycle through the full list of buffers
2015-05-07 10:57 ` Andreas Röhler
@ 2015-05-07 14:42 ` Jürgen Hartmann
2015-05-08 6:01 ` Andreas Röhler
0 siblings, 1 reply; 8+ messages in thread
From: Jürgen Hartmann @ 2015-05-07 14:42 UTC (permalink / raw
To: help-gnu-emacs@gnu.org
Thank you, Andreas Roehler, for your suggestion:
> Not exactly what you are asking for:
>
> AFAIU it's about to jump back to a certain buffer.
Not exactly, I meant cycling through all available buffers.
> In use here are a kind of hard-coded registers.
>
> Like that:
>
> (defun gehe-zu-register-x (&optional arg)
> "With C-u: Puffer merken"
> (interactive "P")
> (if arg
> (progn
> (window-configuration-to-register ?x)
> (message "%s" "Fenster mit \[C-kp-1] oder \\C-x j x erreichbar"))
> (jump-to-register ?x)
> (delete-other-windows)
> (message "%s" "Mit Arg.: Puffer merken")))
>
> ;;;;;
>
> (global-set-key [(control kp-1)] 'gehe-zu-register-x)
>
> I.e. C-u C-kp-1 stores it.
This implements a nice bookmark functionality. But as said before, my focus
is on cycling trough all buffers. It is very much like previous-buffer already
does, but it should bring up all buffers.
The background is that I typically have a more or less fixed arrangement of
windows--one larger one on the right half of the screen to do the actual edit
stuff, some smaller ones in a vertical split of the left hand side--and just
want to quickly alter the buffer that any of these windows shows.
Of course one could use switch-to-buffer and enter the respective buffer's
name, but if there are not so much buffers it is faster to quickly cycle
through all of them until the right one is shown.
> HTH,
>
> Andreas
Thank you very much.
Juergen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to bring previous-buffer to cycle through the full list of buffers
2015-05-07 14:42 ` Jürgen Hartmann
@ 2015-05-08 6:01 ` Andreas Röhler
2015-05-10 8:47 ` Jürgen Hartmann
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Röhler @ 2015-05-08 6:01 UTC (permalink / raw
To: help-gnu-emacs
Am 07.05.2015 um 16:42 schrieb Jürgen Hartmann:
> Thank you, Andreas Roehler, for your suggestion:
>
>> Not exactly what you are asking for:
>>
>> AFAIU it's about to jump back to a certain buffer.
> Not exactly, I meant cycling through all available buffers.
>
>> In use here are a kind of hard-coded registers.
>>
>> Like that:
>>
>> (defun gehe-zu-register-x (&optional arg)
>> "With C-u: Puffer merken"
>> (interactive "P")
>> (if arg
>> (progn
>> (window-configuration-to-register ?x)
>> (message "%s" "Fenster mit \[C-kp-1] oder \\C-x j x erreichbar"))
>> (jump-to-register ?x)
>> (delete-other-windows)
>> (message "%s" "Mit Arg.: Puffer merken")))
>>
>> ;;;;;
>>
>> (global-set-key [(control kp-1)] 'gehe-zu-register-x)
>>
>> I.e. C-u C-kp-1 stores it.
> This implements a nice bookmark functionality. But as said before, my focus
> is on cycling trough all buffers. It is very much like previous-buffer already
> does, but it should bring up all buffers.
>
> The background is that I typically have a more or less fixed arrangement of
> windows--one larger one on the right half of the screen to do the actual edit
> stuff, some smaller ones in a vertical split of the left hand side--and just
> want to quickly alter the buffer that any of these windows shows.
>
> Of course one could use switch-to-buffer and enter the respective buffer's
> name, but if there are not so much buffers it is faster to quickly cycle
> through all of them until the right one is shown.
>
>> HTH,
>>
>> Andreas
> Thank you very much.
>
> Juergen
>
>
Hmm, when it is about to restore some older windows configuration,
previous-buffer and the like will not do it, as being volatile.
You could use result of (current-window-configuration) similar to
registered positions as shown.
Then (set-window-configuration MY-last-window-configuration), now
jumping to subsequent stores.
Cheers,
Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: How to bring previous-buffer to cycle through the full list of buffers
2015-05-08 6:01 ` Andreas Röhler
@ 2015-05-10 8:47 ` Jürgen Hartmann
2015-05-10 11:50 ` Andreas Röhler
0 siblings, 1 reply; 8+ messages in thread
From: Jürgen Hartmann @ 2015-05-10 8:47 UTC (permalink / raw
To: help-gnu-emacs@gnu.org
Thank you, Andreas Roehler, for your answer:
> Hmm, when it is about to restore some older windows configuration,
> previous-buffer and the like will not do it, as being volatile.
>
> You could use result of (current-window-configuration) similar to
> registered positions as shown.
>
> Then (set-window-configuration MY-last-window-configuration), now
> jumping to subsequent stores.
Actually, the intention is not to alter the windows configuration at all,
but to change the buffer that one of the windows shows. The latter should be
done by a keystroke that cycles through the whole list of buffers.
This can nearly be achieved by binding the command previous-buffer so some
suitable key. But this is not the complete solution, since previous-buffer
typically cycles through just some of the buffers, not all of them.
So it would be great if somebody would know of a command that does that or if
somebody could outline a way to configure, alter, or advice the command
previous-buffer to include all the buffers in its scope.
Juergen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to bring previous-buffer to cycle through the full list of buffers
2015-05-10 8:47 ` Jürgen Hartmann
@ 2015-05-10 11:50 ` Andreas Röhler
2015-05-11 7:54 ` Jürgen Hartmann
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Röhler @ 2015-05-10 11:50 UTC (permalink / raw
To: help-gnu-emacs
Am 10.05.2015 um 10:47 schrieb Jürgen Hartmann:
> Thank you, Andreas Roehler, for your answer:
>
>> Hmm, when it is about to restore some older windows configuration,
>> previous-buffer and the like will not do it, as being volatile.
>>
>> You could use result of (current-window-configuration) similar to
>> registered positions as shown.
>>
>> Then (set-window-configuration MY-last-window-configuration), now
>> jumping to subsequent stores.
> Actually, the intention is not to alter the windows configuration at all,
> but to change the buffer that one of the windows shows. The latter should be
> done by a keystroke that cycles through the whole list of buffers.
>
> This can nearly be achieved by binding the command previous-buffer so some
> suitable key. But this is not the complete solution, since previous-buffer
> typically cycles through just some of the buffers, not all of them.
>
> So it would be great if somebody would know of a command that does that or if
> somebody could outline a way to configure, alter, or advice the command
> previous-buffer to include all the buffers in its scope.
>
> Juergen
>
>
In use here is the following:
(defun letztpuffer ()
" "
(interactive)
(switch-to-buffer (other-buffer)))
(global-set-key [(meta +)] 'letztpuffer)
Just replace other-buffer...
Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to bring previous-buffer to cycle through the full list of buffers
@ 2015-05-10 12:29 martin rudalics
0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2015-05-10 12:29 UTC (permalink / raw
To: juergen_hartmann_; +Cc: help-gnu-emacs
> After the windows history is exhausted by repetitively applying
> previous-buffer, the cycling continues with all the other buffers in the
> global buffer list, but this time unconditionally skipping those of them that
> are visible in other windows--regardless of the setting in
> switch-to-visible-buffer.
Try to replace the line
(if (get-buffer-window buffer frame)
with
(if (and (not switch-to-visible-buffer)
(get-buffer-window new-buffer frame))
in both `switch-to-prev-buffer' and `switch-to-next-buffer' (move these
functions to your .emacs if you cannot rebuild Emacs).
I didn't test this and don't know whether it has any adversary effect,
so you may have to play around with it ;-)
martin
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: How to bring previous-buffer to cycle through the full list of buffers
2015-05-10 11:50 ` Andreas Röhler
@ 2015-05-11 7:54 ` Jürgen Hartmann
0 siblings, 0 replies; 8+ messages in thread
From: Jürgen Hartmann @ 2015-05-11 7:54 UTC (permalink / raw
To: help-gnu-emacs@gnu.org
@ Andreas Roehler: Thank you for your continuous effort in this topic:
>> Actually, the intention is not to alter the windows configuration at all,
>> but to change the buffer that one of the windows shows. The latter should be
>> done by a keystroke that cycles through the whole list of buffers.
>>
>> [...]
>>
>> So it would be great if somebody would know of a command that does that or if
>> somebody could outline a way to configure, alter, or advice the command
>> previous-buffer to include all the buffers in its scope.
>
> In use here is the following:
>
> (defun letztpuffer ()
> " "
> (interactive)
> (switch-to-buffer (other-buffer)))
>
> (global-set-key [(meta +)] 'letztpuffer)
>
> Just replace other-buffer...
>
> Andreas
This function toggles between the current and the other buffer, so it can not
be used to reach all the buffers in the global list unless there are just two
of them.
Unfortunately I don't have a clue by what other-buffer should be replaced to
get the desired cycling behavior that includes all buffers.
Juergen
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-05-11 7:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-07 8:41 How to bring previous-buffer to cycle through the full list of buffers Jürgen Hartmann
2015-05-07 10:57 ` Andreas Röhler
2015-05-07 14:42 ` Jürgen Hartmann
2015-05-08 6:01 ` Andreas Röhler
2015-05-10 8:47 ` Jürgen Hartmann
2015-05-10 11:50 ` Andreas Röhler
2015-05-11 7:54 ` Jürgen Hartmann
-- strict thread matches above, loose matches on Subject: below --
2015-05-10 12:29 martin rudalics
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.