help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to toggle to buffer previously selected ?


From: Sam Peterson
Subject: Re: How to toggle to buffer previously selected ?
Date: Fri, 15 Feb 2008 05:32:22 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

"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 via email to

[Prev in Thread] Current Thread [Next in Thread]