* how to switch to last visited buffer in other window ?
@ 2005-01-26 22:24 Ben Barrowes
2005-01-27 12:09 ` Mathias Dahl
0 siblings, 1 reply; 8+ messages in thread
From: Ben Barrowes @ 2005-01-26 22:24 UTC (permalink / raw)
When using emacs, I typically have 5 or so windows open in the same session.
Is there any way to save the current buffer name into a register? or
somewhere where I can get it back?
At times, I would like to switch to a certain buffer with a name I know,
say "*terminal*" or something, yank, and then return to the last visited
buffer in the original buffer's window.
The problem is, I don't specifically know the name of the original
buffer... it could be any of the other 4 buffers I have open.
I thought about saving the name of the buffer in the buffer-name-history
and then return to the last visited:
(lambda ()
(add-to-list 'buffer-name-history
(abbreviate-file-name (buffer-name))))
ans call it whenever I (other-window 1),
but this breaks down when I have visited a buffer more than once as
(apparently) emacs won't insert the buffer-name into a list that
contains that exact entry earlier in the list. Therefore, I can't return
to the last visited buffer because that name is not necessarily the last
in the list.
Is there some excursion-type command I could use?
My workaround at the moment is, in the original buffer to
switch-to-buffer *terminal* (so that I have 2 windows pointing to the
same buffer), yank into *terminal*, then bury-buffer.
This seems inelegant. Any other way to do it?
Thanks,
Ben Barrowes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to switch to last visited buffer in other window ?
2005-01-26 22:24 how to switch to last visited buffer in other window ? Ben Barrowes
@ 2005-01-27 12:09 ` Mathias Dahl
2005-01-27 14:13 ` Ben Barrowes
0 siblings, 1 reply; 8+ messages in thread
From: Mathias Dahl @ 2005-01-27 12:09 UTC (permalink / raw)
Ben Barrowes <barrowes@alum.mit.edu> writes:
> When using emacs, I typically have 5 or so windows open in the same
> session.
>
> Is there any way to save the current buffer name into a register? or
> somewhere where I can get it back?
I'm not sure I understand exactly what you want, but I use this:
(defun switch-prev-buffer ()
(interactive)
(switch-to-buffer (other-buffer)))
(global-set-key [f1] 'switch-prev-buffer)
Try it and see.
/Mathias
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to switch to last visited buffer in other window ?
2005-01-27 12:09 ` Mathias Dahl
@ 2005-01-27 14:13 ` Ben Barrowes
2005-01-27 16:25 ` Peter Dyballa
2005-01-27 18:22 ` Dodge, Edwardx K
0 siblings, 2 replies; 8+ messages in thread
From: Ben Barrowes @ 2005-01-27 14:13 UTC (permalink / raw)
This just switches to the next buffer window in some predetermined list.
I want to go to the last buffer visited before the current buffer
regardless of how I got there.
BTW, other-buffer didn't do anything on my emacs, other-window worked,
though...
Mathias Dahl wrote:
> Ben Barrowes <barrowes@alum.mit.edu> writes:
>
>
>>When using emacs, I typically have 5 or so windows open in the same
>>session.
>>
>>Is there any way to save the current buffer name into a register? or
>>somewhere where I can get it back?
>
>
> I'm not sure I understand exactly what you want, but I use this:
>
> (defun switch-prev-buffer ()
> (interactive)
> (switch-to-buffer (other-buffer)))
>
> (global-set-key [f1] 'switch-prev-buffer)
>
> Try it and see.
>
> /Mathias
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to switch to last visited buffer in other window ?
2005-01-27 14:13 ` Ben Barrowes
@ 2005-01-27 16:25 ` Peter Dyballa
2005-01-27 18:22 ` Dodge, Edwardx K
1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2005-01-27 16:25 UTC (permalink / raw)
Cc: help-gnu-emacs
Am 27.01.2005 um 15:13 schrieb Ben Barrowes:
> I want to go to the last buffer visited before the current buffer
> regardless of how I got there.
I usually use C-x b. The function "switch-to-buffer" takes me back to
the view I had before, i.e. It recovers buffer contents of the object
before in this buffer. For me it works having different frames and each
two or three buffers (windows) open. I have the feeling that the
history is somehow local, i.e. each buffer or frame knows what was
visiting this buffer before ...
--
Mit friedvollen Grüßen
Pete
“I hope to die before I *have* to use Microsoft Word.”
- Donald E. Knuth, 2001-10-02 in Tübingen.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to switch to last visited buffer in other window ?
2005-01-27 14:13 ` Ben Barrowes
2005-01-27 16:25 ` Peter Dyballa
@ 2005-01-27 18:22 ` Dodge, Edwardx K
2005-01-27 18:34 ` Ben Barrowes
1 sibling, 1 reply; 8+ messages in thread
From: Dodge, Edwardx K @ 2005-01-27 18:22 UTC (permalink / raw)
Ben Barrowes <barrowes@alum.mit.edu> writes:
M-x switch-to-buffer <RETURN>
> This just switches to the next buffer window in some predetermined
> list. I want to go to the last buffer visited before the current
> buffer regardless of how I got there.
>
> BTW, other-buffer didn't do anything on my emacs, other-window worked,
> though...
>
>
> Mathias Dahl wrote:
> > Ben Barrowes <barrowes@alum.mit.edu> writes:
> >
> >>When using emacs, I typically have 5 or so windows open in the same
> >>session.
> >>
> >>Is there any way to save the current buffer name into a register? or
> >>somewhere where I can get it back?
> > I'm not sure I understand exactly what you want, but I use this:
> > (defun switch-prev-buffer ()
> > (interactive)
> > (switch-to-buffer (other-buffer)))
> > (global-set-key [f1] 'switch-prev-buffer)
> > Try it and see.
> > /Mathias
--
Edward Dodge
__o | Contractor: Husdon Mask Design
_`\(,_ | Phone: (978) 553-6586
(_)/ (_) |
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to switch to last visited buffer in other window ?
2005-01-27 18:22 ` Dodge, Edwardx K
@ 2005-01-27 18:34 ` Ben Barrowes
2005-01-27 18:49 ` Dodge, Edwardx K
0 siblings, 1 reply; 8+ messages in thread
From: Ben Barrowes @ 2005-01-27 18:34 UTC (permalink / raw)
switch-to-buffer isn't sufficient. When switch-to-buffer is called, it
defaults to taking you to currently undusplayed buffer, or you can
scroll through buffer-name-history, which doesn't always list the last
buffer you visited last.
I want to visit the last buffer I visited before the present one in the
other buffer's window. Problem is I can't seem to find out a way to
switch back when I don't know the name of the buffer I came from.
Ben
Dodge, Edwardx K wrote:
> Ben Barrowes <barrowes@alum.mit.edu> writes:
>
> M-x switch-to-buffer <RETURN>
>
>>This just switches to the next buffer window in some predetermined
>>list. I want to go to the last buffer visited before the current
>>buffer regardless of how I got there.
>>
>>BTW, other-buffer didn't do anything on my emacs, other-window worked,
>>though...
>>
>>
>>Mathias Dahl wrote:
>>
>>>Ben Barrowes <barrowes@alum.mit.edu> writes:
>>>
>>>
>>>>When using emacs, I typically have 5 or so windows open in the same
>>>>session.
>>>>
>>>>Is there any way to save the current buffer name into a register? or
>>>>somewhere where I can get it back?
>>>
>>>I'm not sure I understand exactly what you want, but I use this:
>>>(defun switch-prev-buffer ()
>>> (interactive)
>>> (switch-to-buffer (other-buffer)))
>>>(global-set-key [f1] 'switch-prev-buffer)
>>>Try it and see.
>>>/Mathias
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-01-27 19:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-26 22:24 how to switch to last visited buffer in other window ? Ben Barrowes
2005-01-27 12:09 ` Mathias Dahl
2005-01-27 14:13 ` Ben Barrowes
2005-01-27 16:25 ` Peter Dyballa
2005-01-27 18:22 ` Dodge, Edwardx K
2005-01-27 18:34 ` Ben Barrowes
2005-01-27 18:49 ` Dodge, Edwardx K
2005-01-27 19:17 ` Ben Barrowes
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.