From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: Proposal: new default bindings for winner and windmove Date: Tue, 02 Jul 2024 07:08:28 +0000 Message-ID: <87wmm45l03.fsf@posteo.net> References: <875xto7lbn.fsf@dancol.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34628"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Kangas , Stefan Monnier , emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 02 09:09:03 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sOXdO-0008go-D6 for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Jul 2024 09:09:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOXcz-0007QG-DY; Tue, 02 Jul 2024 03:08:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOXcw-0007Po-QX for emacs-devel@gnu.org; Tue, 02 Jul 2024 03:08:34 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOXcu-0002JB-Oj for emacs-devel@gnu.org; Tue, 02 Jul 2024 03:08:34 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 13F6F240028 for ; Tue, 2 Jul 2024 09:08:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1719904110; bh=OOwwUZHKVV16i3szrtIXRIWh0F1n8g4SAwY3eS8mITY=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=QdpWAQTRD4OS1usmxs2KjRRkzD8U60bzfz+etzIB9Qt8NsF4FcXIjkun/56nmuVHv Sz1m2zSIva5kilNwV6Tb8aSL0tUcSFMkiupANwVTk2wIwc7iOJdugCz5JMVEbjnfg9 HSOJAyaJadJZyudVyCK4p7MbFUJxE2LHakRSoyG7HN3Lbw7JDE4qo00+AOlY3Wxgwh IPY+y7MQXENF4KrOEN98c95AyliylfOvxLMWGzau+bWuh5jTdqf9eWQuHxp7np26sh HFhpdSaIHL10/6jSj/ULVHVHW93Pqn4DHn0etCq+L81pnywBmcGt3HKzOzDLsXrfSp M5iI1PqBXBFKA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WCvC05H00z9rxK; Tue, 2 Jul 2024 09:08:28 +0200 (CEST) In-Reply-To: <875xto7lbn.fsf@dancol.org> (Daniel Colascione's message of "Mon, 01 Jul 2024 19:18:36 -0400") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321104 Archived-At: Daniel Colascione writes: > Stefan Kangas writes: >> Thus, I don't think I see any compelling reason not to go ahead with >> this change. I would propose that we now start discussing the specifics >> of how to go about doing that (patches, proposed alternative solutions). > > How's this? > > commit 0af9a3225fe0d8771772ee510abd122d2881b211 > Author: Daniel Colascione > Date: Mon Jul 1 19:17:10 2024 -0400 > > Directional bindings for windmove > > * doc/emacs/windows.texi (Other Window): Describe new > directional bindings. > > * etc/tutorials/TUTORIAL: Describe new directional bindings. > > * lisp/windmove.el: Bind C-x 4 followed by an arrow key to the > corresponding windmove commands. > > diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi > index 5ad6850fed9..581f74833d3 100644 > --- a/doc/emacs/windows.texi > +++ b/doc/emacs/windows.texi > @@ -185,6 +185,27 @@ Other Window > back and finish supplying the minibuffer argument that is requested. > @xref{Minibuffer Edit}. > > +@kindex C-x 4 LEFT > +@kindex C-x 4 RIGHT > +@kindex C-x 4 UP > +@kindex C-x 4 DOWN > + > +Using the keyboard, you can switch windows directionally by typing > +@kbd{C-x 4} followed by an arrow key. Emacs determines the direction of > +movement using the geometry of windows on the screen rather than history > +of recently-selected windows, so these commands may often by less > +surprising than @kbd{C-x o} above. > + > +@kindex C-x 4 S-LEFT > +@kindex C-x 4 S-RIGHT > +@kindex C-x 4 S-UP > +@kindex C-x 4 S-DOWN > + > +These commands are like the other directional movement commands, except > +that Emacs, instead of moving point to the window in the desired > +direction, moves the whole buffer state, as if taking the current buffer > +and moving it to the desired window. > + > @findex next-window-any-frame > The @code{other-window} command will normally only switch to the next > window in the current frame (unless otherwise configured). If you > diff --git a/etc/tutorials/TUTORIAL b/etc/tutorials/TUTORIAL > index 4718e0d9430..daba3e4615f 100644 > --- a/etc/tutorials/TUTORIAL > +++ b/etc/tutorials/TUTORIAL > @@ -907,6 +907,11 @@ cursor which blinks when you are not typing. The other windows have > their own cursor positions; if you are running Emacs in a graphical > display, those cursors are drawn as unblinking hollow boxes. > > +You can also use arrow keys prefixed by C-x 4 to move > +between windows directionally. > + > +>> Type C-x 4 to move to the window above the current one. > + > The command C-M-v is very useful when you are editing text in one > window and using the other window just for reference. Without leaving > the selected window, you can scroll the text in the other window with > diff --git a/lisp/windmove.el b/lisp/windmove.el > index b4e77102abd..db3b52393bf 100644 > --- a/lisp/windmove.el > +++ b/lisp/windmove.el > @@ -854,6 +854,23 @@ windmove-swap-states-default-keybindings > :type windmove--default-keybindings-type > :version "28.1") > > +;;;###autoload > +(define-key ctl-x-4-map [left] 'windmove-left) > +;;;###autoload > +(define-key ctl-x-4-map [right] 'windmove-right) > +;;;###autoload > +(define-key ctl-x-4-map [up] 'windmove-up) > +;;;###autoload > +(define-key ctl-x-4-map [down] 'windmove-down) You could use (setopt windmove-default-keybindings (list (kbd "C-x 4"))), which would allow for the bindings to be disabled more easily. > +;;;###autoload > +(define-key ctl-x-4-map [(shift left)] 'windmove-swap-states-left) > +;;;###autoload > +(define-key ctl-x-4-map [(shift right)] 'windmove-swap-states-right) > +;;;###autoload > +(define-key ctl-x-4-map [(shift up)] 'windmove-swap-states-up) > +;;;###autoload > +(define-key ctl-x-4-map [(shift down)] 'windmove-swap-states-down) > + > > (provide 'windmove) > > > -- Philip Kaludercic on peregrine