unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sam Peterson <peabodyenatory@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to toggle to buffer previously selected ?
Date: Fri, 15 Feb 2008 05:32:22 -0800	[thread overview]
Message-ID: <877ih62vmh.fsf@gmail.com> (raw)
In-Reply-To: mailman.7093.1202381161.18990.help-gnu-emacs@gnu.org

"Francis Moreau" <francis.moro@gmail.com> on Thu, 7 Feb 2008 11:45:49
+0100 didst step forth and proclaim thus:

> Hello all,
>
> I know 'C-x o' to select the next selected buffer but I'd like
> to toggle between 2 buffers even if more than 2 buffers are
> displayed.
>
> Thanks for your hints.
> -- 
> Francis

I think this *almost* does what you want.  I think you may have
trouble getting it to always swap between the last window you want,
but experimenting with the code will likely prove fruitful.

(defun go-back-window ()
  (interactive)
  (if (boundp 'last-window)
      (progn
	(let ((mywindow last-window))
	  (setq last-window (selected-window))
	  (select-window mywindow)))
    (setq last-window (selected-window))
    (select-window (next-window))))
(global-set-key "\C-cb" 'go-back-window)

-- 
Sam Peterson
peabodyenator@gmail.com
"if programmers were paid to remove code instead of adding it,
software would be much better" -- unknown


       reply	other threads:[~2008-02-15 13:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.7093.1202381161.18990.help-gnu-emacs@gnu.org>
2008-02-15 13:32 ` Sam Peterson [this message]
2008-02-07 10:45 How to toggle to buffer previously selected ? Francis Moreau
2008-02-07 10:52 ` Bastien Guerry
2008-02-07 10:53 ` Tassilo Horn
2008-02-07 15:46   ` Francis Moreau
2008-02-07 15:58     ` Lennart Borgman (gmail)
2008-02-07 16:18     ` Thierry Volpiatto
2008-02-07 18:57     ` Tassilo Horn
2008-02-08 11:11       ` Francis Moreau
     [not found]       ` <mailman.7148.1202469108.18990.help-gnu-emacs@gnu.org>
2008-02-08 14:27         ` Joel J. Adamson
2008-02-08 19:08           ` Martin Marcher

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=877ih62vmh.fsf@gmail.com \
    --to=peabodyenatory@gmail.com \
    --cc=help-gnu-emacs@gnu.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.
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).