From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Philip K." Newsgroups: gmane.emacs.bugs Subject: bug#41438: [PATCH] Allow windmove keys to be bound without prefix or modifiers Date: Thu, 21 May 2020 18:56:28 +0200 Message-ID: <87imgpw7k3.fsf@warpmail.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="32621"; mail-complaints-to="usenet@ciao.gmane.io" To: 41438@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 21 19:29:52 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jbp0x-0008NV-PS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 May 2020 19:29:52 +0200 Original-Received: from localhost ([::1]:57622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbp0w-0008WP-RV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 May 2020 13:29:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboVC-00056G-77 for bug-gnu-emacs@gnu.org; Thu, 21 May 2020 12:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboVB-0000il-Rp for bug-gnu-emacs@gnu.org; Thu, 21 May 2020 12:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jboVB-0001KN-QG for bug-gnu-emacs@gnu.org; Thu, 21 May 2020 12:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Philip K." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 May 2020 16:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15900801995068 (code B ref -1); Thu, 21 May 2020 16:57:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 May 2020 16:56:39 +0000 Original-Received: from localhost ([127.0.0.1]:57197 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jboUo-0001Jg-Qz for submit@debbugs.gnu.org; Thu, 21 May 2020 12:56:39 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jboUm-0001JW-8j for submit@debbugs.gnu.org; Thu, 21 May 2020 12:56:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboUl-0004JG-V7 for bug-gnu-emacs@gnu.org; Thu, 21 May 2020 12:56:35 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:56563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboUk-0000fp-Ge for bug-gnu-emacs@gnu.org; Thu, 21 May 2020 12:56:35 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 751DD5C00CF for ; Thu, 21 May 2020 12:56:31 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 21 May 2020 12:56:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h= from:to:subject:date:message-id:mime-version:content-type; s= fm3; bh=PVLf6bMw+JHyYWBTf+i+v1QmcSjq0lCCx42Sv/+4+AI=; b=DpjJBDV7 /IIJYC1cjJdReeMeLl7ndd2n06vZ8wTCufcHZnDTRqh+kM+zJYPyyFNxlsk1z/NB 4ckyzmGtJuqyXaEXhss8+JfKfVBQcNvwfWUU+yglaNWqazK6VDT1ahqfiJ2WwsH1 y4UTYDgzWe+YgRK29EerptjIsb+0FERiM1fTc/tij2QUkbtEhjzU3E5SZ7yzs4gO rRkKJ0Mhy3pYnl+upNfRTS9iLPi2VKFbu5PTJrsnTHD9nhSotzeuiPDXqD/4Djnt EnXuAEcEFdw8HfysWHC9XQx5iOq0/qlvevHo4bmy8i0fNjnyhHmpefFmVaqQa3tW lVkCdYlkpZoGig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=PVLf6bMw+JHyYWBTf+i+v1QmcSjq0 lCCx42Sv/+4+AI=; b=SUApJhwDsVu6VNKK3unP6dqT107M4QGKPU7JXTCeHNrLU qhZPuVLk6Z36HY9DQyllhgCDXBuLTtNI6R/yd+ArjTkCmPM3bW4I3lm04Ugl8Dp1 TFNNBoDpot/AsLzIDToYegs5+gWwM9O/b4r2BzpsBkZuobcC0hScg1J+l/zceKEz 7tXfKKoV2yWp0sTINV2q5J33A83ACe9q3/249I0WlAuy2PNxKLUBVuZj3SwBJosW 4uEg/nlIAinfwVJGrKLHbmjfy7lzZ8IUrx1PzcNN7+I+rgft5jHOhcdRooPmrdjU ZvG7yBVKLBqCMYueWk1weo9P45V7keHHNhBVmLIpQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudduuddguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesmhdtreertd dttdenucfhrhhomhepfdfrhhhilhhiphcumfdrfdcuoehphhhilhhiphesfigrrhhpmhgr ihhlrdhnvghtqeenucggtffrrghtthgvrhhnpefgtdduhfdtleetjeeihedtkeejgfejgf fftdetkeeftddvtefghfejvdeltdejfeenucfkphepjeelrddvudelrdduleelrdegjeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilh hiphesfigrrhhpmhgrihhlrdhnvght X-ME-Proxy: Original-Received: from localhost (p4fdbc72f.dip0.t-ipconnect.de [79.219.199.47]) by mail.messagingengine.com (Postfix) with ESMTPA id DC4E73066491 for ; Thu, 21 May 2020 12:56:30 -0400 (EDT) Received-SPF: pass client-ip=66.111.4.25; envelope-from=philip@warpmail.net; helo=out1-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/21 12:56:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180710 Archived-At: --=-=-= Content-Type: text/plain Hi, I'm probably not the only one who tends to use C-{f,b,n,p} over the arrow keys, but also sometimes gets annoyed by navigating windows. I recently realised that the reason I didn't use windmove as much as I would want to, was that I coudln't find a satisfying modifier-key. My idea was then to try windmove without any modifier, and I quite like it. The only "annoying" thing is that I have to bind all keys manually, instead of using a function like `windmove-default-keybindings', because `nil' is interpreted as a default binding. This patch adds a pseudo-modifier (`none') to allow bindings the windmove functions without any real modifier or prefix key, depending on the function. -- Another question I'd like to ask before trying it out: Would there be any interest in adding user options for the "default" modifiers that windmove should use? If yes, one could add a :set function that automatically calls the apropriate bindings function, when it's value is non-nil. I have a very customize-centric configuration, where something this would fit in very well. -- Philip K. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Allow-windmove-keys-to-be-bound-without-prefix-or-mo.patch >From 0fb951817fc11983498052f2a4fdb8815bc89b92 Mon Sep 17 00:00:00 2001 From: Philip K Date: Thu, 21 May 2020 18:44:10 +0200 Subject: [PATCH] Allow windmove keys to be bound without prefix or modifiers --- lisp/windmove.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lisp/windmove.el b/lisp/windmove.el index f96383197b..3d7f86b9af 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -431,9 +431,12 @@ windmove-default-keybindings "Set up keybindings for `windmove'. Keybindings are of the form MODIFIERS-{left,right,up,down}, where MODIFIERS is either a list of modifiers or a single modifier. +If MODIFIERS is `none', the keybindings will be directly bound to +the arrow keys. Default value of MODIFIERS is `shift'." (interactive) (unless modifiers (setq modifiers 'shift)) + (when (eq modifiers 'none) (setq modifiers nil)) (unless (listp modifiers) (setq modifiers (list modifiers))) (global-set-key (vector (append modifiers '(left))) 'windmove-left) (global-set-key (vector (append modifiers '(right))) 'windmove-right) @@ -568,9 +571,12 @@ windmove-display-default-keybindings Keys are bound to commands that display the next buffer in the specified direction. Keybindings are of the form MODIFIERS-{left,right,up,down}, where MODIFIERS is either a list of modifiers or a single modifier. +If MODIFIERS is `none', the keybindings will be directly bound to +the arrow keys. Default value of MODIFIERS is `shift-meta'." (interactive) (unless modifiers (setq modifiers '(shift meta))) + (when (eq modifiers 'none) (setq modifiers nil)) (unless (listp modifiers) (setq modifiers (list modifiers))) (global-set-key (vector (append modifiers '(left))) 'windmove-display-left) (global-set-key (vector (append modifiers '(right))) 'windmove-display-right) @@ -640,11 +646,16 @@ windmove-delete-default-keybindings Keys are bound to commands that delete windows in the specified direction. Keybindings are of the form PREFIX MODIFIERS-{left,right,up,down}, where PREFIX is a prefix key and MODIFIERS is either a list of modifiers or -a single modifier. Default value of PREFIX is `C-x' and MODIFIERS is `shift'." +a single modifier. +If PREFIX is `none', no prefix is used. If MODIFIERS is `none', the keybindings +are directly bound to the arrow keys. +Default value of PREFIX is `C-x' and MODIFIERS is `shift'." (interactive) (unless prefix (setq prefix '(?\C-x))) + (when (eq prefix 'none) (setq prefix nil)) (unless (listp prefix) (setq prefix (list prefix))) (unless modifiers (setq modifiers '(shift))) + (when (eq modifiers 'none) (setq modifiers nil)) (unless (listp modifiers) (setq modifiers (list modifiers))) (global-set-key (vector prefix (append modifiers '(left))) 'windmove-delete-left) (global-set-key (vector prefix (append modifiers '(right))) 'windmove-delete-right) @@ -695,9 +706,13 @@ windmove-swap-states-default-keybindings Keys are bound to commands that swap the states of the selected window with the window in the specified direction. Keybindings are of the form MODIFIERS-{left,right,up,down}, where MODIFIERS is either a list of modifiers -or a single modifier. Default value of MODIFIERS is `shift-super'." +or a single modifier. +If MODIFIERS is `none', the keybindings will be directly bound to the +arrow keys. +Default value of MODIFIERS is `shift-super'." (interactive) (unless modifiers (setq modifiers '(shift super))) + (when (eq modifiers 'none) (setq modifiers nil)) (unless (listp modifiers) (setq modifiers (list modifiers))) (global-set-key (vector (append modifiers '(left))) 'windmove-swap-states-left) (global-set-key (vector (append modifiers '(right))) 'windmove-swap-states-right) -- 2.20.1 --=-=-=--