From: Ergus via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org, Pankaj Jangid <pankaj@codeisgreat.org>
Subject: Re: Swap windows in a frame
Date: Wed, 12 Jan 2022 00:53:16 +0100 [thread overview]
Message-ID: <2A5C8369-763E-48DC-A32C-5D3F59AFAA06@aol.com> (raw)
In-Reply-To: <87ee5fr1eg.fsf@codeisgreat.org>
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.
next prev parent reply other threads:[~2022-01-11 23:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 3:48 Swap windows in a frame Pankaj Jangid
2022-01-10 4:29 ` Samuel Banya
2022-01-10 5:10 ` Pankaj Jangid
2022-01-10 5:05 ` Yuri Khan
2022-01-10 6:27 ` Pankaj Jangid
2022-01-10 13:51 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-10 16:39 ` Pankaj Jangid
2022-01-11 23:53 ` Ergus via Users list for the GNU Emacs text editor [this message]
2022-01-12 4:54 ` Pankaj Jangid
2022-01-12 21:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2A5C8369-763E-48DC-A32C-5D3F59AFAA06@aol.com \
--to=help-gnu-emacs@gnu.org \
--cc=pankaj@codeisgreat.org \
--cc=spacibba@aol.com \
/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.
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.