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

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

Re: Swap windows in a frame


From: Ergus
Subject: Re: Swap windows in a frame
Date: Wed, 12 Jan 2022 00:53:16 +0100

Hi

I see here many complicated answers and recommendation for external packages 
and nobody mentions winmove. 

winmove.el (that comes with emacs) already have the all the swap functions  
 ​windmove-swap-states-<left,right,up,down>. You only need to bind them or use 
the binding functions it also provide.



On January 10, 2022 5:39:03 PM GMT+01:00, Pankaj Jangid 
<pankaj@codeisgreat.org> wrote:
>Emanuel Berg via Users list for the GNU Emacs text editor
><help-gnu-emacs@gnu.org> writes:
>
>>>>> I have two windows in a frame. Is there a command to swap
>>>>> their location?
>
>> (defun swap-windows ()
>>   (interactive)
>>   (let ((buffer (current-buffer)))
>>     (other-window 1)
>>     (switch-to-buffer-other-window (current-buffer))
>>     (other-window 1)
>>     (switch-to-buffer buffer) ))
>>
>
>Yes. Thanks for sharing this. Pasting it to my init :-) 
>
>

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

reply via email to

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