all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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.