GNU bug report logs - #41438
[PATCH] Allow windmove keys to be bound without prefix or modifiers

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "Philip K." <philip@HIDDEN>; Keywords: fixed; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 28.0.50, send any further explanations to 41438 <at> debbugs.gnu.org and "Philip K." <philip@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) fixed. Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 3 Jun 2021 20:37:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 03 16:37:42 2021
Received: from localhost ([127.0.0.1]:44775 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lou62-0002hY-FU
	for submit <at> debbugs.gnu.org; Thu, 03 Jun 2021 16:37:42 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:33307)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>)
 id 1lou60-0002hF-AE; Thu, 03 Jun 2021 16:37:40 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 64E2240003;
 Thu,  3 Jun 2021 20:37:31 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN> <87r1hucws6.fsf@icterid>
 <87k0nl420l.fsf@HIDDEN> <87zgwg302t.fsf@icterid>
 <87im2zzy82.fsf@HIDDEN> <871r9ncmmm.fsf@HIDDEN>
 <87mtsalluu.fsf@HIDDEN> <8735u2h9w9.fsf@icterid>
Date: Thu, 03 Jun 2021 23:36:54 +0300
In-Reply-To: <8735u2h9w9.fsf@icterid> (Philip Kaludercic's message of "Mon, 31
 May 2021 21:27:02 +0000")
Message-ID: <87sg1yznvd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

tags 41438 fixed
close 41438 28.0.50
thanks

>> Did you intend to send a new patch?  (the patches attached were the same as previous)
>
> Oops, I must have forgotten to regenerate patches. The important
> difference was
>
> +        (let ((old-fn (lookup-key windmove-mode-map key)))
> +          (when (functionp old-fn)
> +            (warn "Overriding %S with %S" old-fn (car bind))))

Thanks, I've tested your patches, and everything work nicely.
So pushed now.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 31 May 2021 21:27:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 31 17:27:16 2021
Received: from localhost ([127.0.0.1]:35056 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lnpRL-000277-Sj
	for submit <at> debbugs.gnu.org; Mon, 31 May 2021 17:27:16 -0400
Received: from mout02.posteo.de ([185.67.36.66]:50781)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lnpRI-00026q-PF
 for 41438 <at> debbugs.gnu.org; Mon, 31 May 2021 17:27:14 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id A02942400FF
 for <41438 <at> debbugs.gnu.org>; Mon, 31 May 2021 23:27:04 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1622496424; bh=LfmaRg/8s7jBP8Zd6mkdlkMCmuoGAbNiK66sGZLisfM=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=JPrHyTxMk8JWhsZGMavNNSJwkfN0lY79cJvISRxl6Mlap8/NfvcoAxNH2mIgroWDm
 Zn3bd3lY6XIND8fYtq9t17btwRNH+/3P2hmwIPWWxb+iARPEpUEUoun6oUel0AIAcC
 I7X9Zivipt99OeRkEMAzn4l5XTJeMm4SSE+5zqjJupNeKcAWjOulLrbU0sUIXlwJpl
 /KbmsEW68gd1Z7XYfGN+6oasw4PaceamGBAfLV6Zh9HmAj1+P3+GcXaqnp12/3kCEy
 YnFIN7Ip2R3knJUH1tYKUYquYC3BgeZUSk5ZWmzQTPOFMrVWX5QjUREfcZK+SI2LTN
 OYYpGydGm7oog==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Fv7fH262Kz9rxF;
 Mon, 31 May 2021 23:27:03 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN> <87r1hucws6.fsf@icterid>
 <87k0nl420l.fsf@HIDDEN> <87zgwg302t.fsf@icterid>
 <87im2zzy82.fsf@HIDDEN> <871r9ncmmm.fsf@HIDDEN>
 <87mtsalluu.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Mon, 31 May 2021 21:27:02 +0000
In-Reply-To: <87mtsalluu.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 31 May 2021 23:15:05 +0300")
Message-ID: <8735u2h9w9.fsf@icterid>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Juri Linkov <juri@HIDDEN> writes:

>> I was under the impression that this was fixed, but it turns out I did
>> not read the lookup-key doc string carefully enough:
>>
>>         A number as value means KEY is "too long";
>>         that is, characters or symbols in it except for the last one
>>         fail to be a valid sequence of prefix characters in KEYMAP.
>>         The number is how many characters at the front of KEY
>>         it takes to reach a non-prefix key.
>>
>> But this case can be safely ignored, as define-key will take care of the
>> prefix. To solve this, the warning is only trigged when a function is
>> over-riden.
>
> Did you intend to send a new patch?  (the patches attached were the same as previous)

Oops, I must have forgotten to regenerate patches. The important
difference was

+        (let ((old-fn (lookup-key windmove-mode-map key)))
+          (when (functionp old-fn)
+            (warn "Overriding %S with %S" old-fn (car bind))))


-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Improve-windmove-default-keybindings-fuctions.patch

From 7e31b789da74655e931adc937b5a22a48d4f676e Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 25 May 2021 11:47:51 +0200
Subject: [PATCH 1/2] Improve windmove-*-default-keybindings fuctions

* windmove.el (windmove-mode-map): Add special map for windmove
commands
(windmove-mode): Add minor mode for activating windmove-mode-map
(windmove-install-defaults): Add general function for manipulating
windmove-mode-map
(windmove-default-keybindings): Use windmove-install-defaults
(windmove-display-default-keybindings): Use windmove-install-defaults
(windmove-delete-default-keybindings): Use windmove-install-defaults
(windmove-swap-states-default-keybindings): Use
windmove-install-defaults
---
 lisp/windmove.el | 92 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 71 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..ba59e95624 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,53 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-mode-map (make-sparse-keymap)
+  "Map used by `windmove-install-defaults'.")
+
+(define-minor-mode windmove-mode
+  "Global minor mode for default windmove commands."
+  :keymap windmove-mode-map
+  :init-value t
+  :global t)
+
+(defun windmove-install-defaults (prefix modifiers alist &optional uninstall)
+  "Install keys as specified by ALIST.
+Every element of ALIST has the form (FN KEY), where KEY is
+appended to MODIFIERS, adding PREFIX to the beginning, before
+installing the key.  Previous bindings of FN are unbound.
+If UNINSTALL is non-nil, just remove the keys from ALIST."
+  (dolist (bind alist)
+    (dolist (old (where-is-internal (car bind) windmove-mode-map))
+      (define-key windmove-mode-map old nil))
+    (unless uninstall
+      (let ((key (vconcat (if (or (equal prefix [ignore])
+                                  (eq prefix 'none))
+                              nil prefix)
+                          (list (append modifiers (cdr bind))))))
+        (when (eq (key-binding key) #'self-insert-command)
+          (warn "Command %S is shadowing self-insert-key" (car bind)))
+        (let ((old-fn (lookup-key windmove-mode-map key)))
+          (when (functionp old-fn)
+            (warn "Overriding %S with %S" old-fn (car bind))))
+        (define-key windmove-mode-map key (car bind))))))
+
 ;;;###autoload
 (defun windmove-default-keybindings (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-left left)
+                               (windmove-right right)
+                               (windmove-up up)
+                               (windmove-down down))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +581,21 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-display-left left)
+                               (windmove-display-right right)
+                               (windmove-display-up up)
+                               (windmove-display-down down)
+                               (windmove-display-same-window ?0)
+                               (windmove-display-new-frame ?f)
+                               (windmove-display-new-tab ?t))))
 
 
 ;;; Directional window deletion
@@ -618,16 +657,22 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (windmove-install-defaults prefix modifiers
+                             '((windmove-delete-left left)
+                               (windmove-delete-right right)
+                               (windmove-delete-up up)
+                               (windmove-delete-down down))))
 
 
 ;;; Directional window swap states
@@ -673,14 +718,19 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-swap-states-left left)
+                               (windmove-swap-states-right right)
+                               (windmove-swap-states-up up)
+                               (windmove-swap-states-down down))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 31 May 2021 20:31:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 31 16:31:05 2021
Received: from localhost ([127.0.0.1]:34970 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lnoYz-0006wa-Kk
	for submit <at> debbugs.gnu.org; Mon, 31 May 2021 16:31:05 -0400
Received: from relay10.mail.gandi.net ([217.70.178.230]:58213)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1lnoYw-0006vi-Fp
 for 41438 <at> debbugs.gnu.org; Mon, 31 May 2021 16:31:03 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by relay10.mail.gandi.net (Postfix) with ESMTPSA id EF2A9240002;
 Mon, 31 May 2021 20:30:54 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN> <87r1hucws6.fsf@icterid>
 <87k0nl420l.fsf@HIDDEN> <87zgwg302t.fsf@icterid>
 <87im2zzy82.fsf@HIDDEN> <871r9ncmmm.fsf@HIDDEN>
Date: Mon, 31 May 2021 23:15:05 +0300
In-Reply-To: <871r9ncmmm.fsf@HIDDEN> (Philip Kaludercic's message of "Mon, 
 31 May 2021 08:50:57 +0000")
Message-ID: <87mtsalluu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I was under the impression that this was fixed, but it turns out I did
> not read the lookup-key doc string carefully enough:
>
>         A number as value means KEY is "too long";
>         that is, characters or symbols in it except for the last one
>         fail to be a valid sequence of prefix characters in KEYMAP.
>         The number is how many characters at the front of KEY
>         it takes to reach a non-prefix key.
>
> But this case can be safely ignored, as define-key will take care of the
> prefix. To solve this, the warning is only trigged when a function is
> over-riden.

Did you intend to send a new patch?  (the patches attached were the same as previous)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 31 May 2021 08:51:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 31 04:51:14 2021
Received: from localhost ([127.0.0.1]:32827 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lnddh-0005dO-L4
	for submit <at> debbugs.gnu.org; Mon, 31 May 2021 04:51:14 -0400
Received: from mout02.posteo.de ([185.67.36.66]:36467)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lnddc-0005d1-TA
 for 41438 <at> debbugs.gnu.org; Mon, 31 May 2021 04:51:12 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 9DAE02400FD
 for <41438 <at> debbugs.gnu.org>; Mon, 31 May 2021 10:51:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1622451061; bh=XZ0W7LNbpJyxkTQxUWRsrLY9dzncTldRSxd3wDXJs9o=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=ZH4a/j6d41k7tiSjqTbaGCZioRBQzCDtwAIWbOApchzN46tutvt/g9eW7gYL4WF1x
 cwY9tZKujVW6wYPoN70tq5KIkNhkeCBxoRoP5hEcZ+/dwalGeZIQXoiq1Q3vTXrxmp
 /Dl1ByWfJU9fWW/d54sf1xTgH5XGCN1UL0h2aIqFHHsud5nfna6xAn3cdCUdm8XcwP
 SMcxnEX/RO+jnUrg+SYnoXUQ5M0ulKOi0W/qc87dmOT5/p7QPGl9SgbKN50LQ1RxIG
 lViqnH2MFXZwzftWVhUHi8oAS36AUBxlWs5q4NkhPZu8aW3VAdIJPnRxHIydPmBtVf
 9kOC5Cz+0Uabw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Ftpst48r0z9rxg;
 Mon, 31 May 2021 10:50:58 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN> <87r1hucws6.fsf@icterid>
 <87k0nl420l.fsf@HIDDEN> <87zgwg302t.fsf@icterid>
 <87im2zzy82.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Mon, 31 May 2021 08:50:57 +0000
In-Reply-To: <87im2zzy82.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 31 May 2021 01:11:57 +0300")
Message-ID: <871r9ncmmm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Juri Linkov <juri@HIDDEN> writes:

>>> Maybe it's possible to add new user options without deprecating the
>>> existing functions?  Then for users an alternative way would be to
>>> customize these options, and enable windmove-mode in the init file.
>>
>> Of course, why not? The patches below should implement that.
>
> Thanks, I tried out your patches.  The customization saved them
> in such format:
>
>   '(windmove-default-keybindings '([ignore] hyper))
>   '(windmove-delete-default-keybindings '("\30" hyper))
>   '(windmove-display-default-keybindings '([ignore] meta hyper))
>   '(windmove-swap-states-default-keybindings '([ignore] shift hyper))
>
> But I guess it's not a problem that it saves nil as [ignore].
>
> The real problem is that after replacing this with a manual configuration:
>
>   (use-package windmove
>     :custom
>     (windmove-default-keybindings '(nil hyper))
>     (windmove-delete-default-keybindings `(,(kbd "C-x") hyper))
>     (windmove-display-default-keybindings '(nil meta hyper))
>     (windmove-swap-states-default-keybindings '(nil shift hyper)))
>
> Then every startup pops up the *Warnings* buffer with:
>
>   Warning (emacs): Overriding 1 with windmove-delete-left [Disable showing] [Disable logging]
>
> But still all keybindings work correctly.

I was under the impression that this was fixed, but it turns out I did
not read the lookup-key doc string carefully enough:

        A number as value means KEY is "too long";
        that is, characters or symbols in it except for the last one
        fail to be a valid sequence of prefix characters in KEYMAP.
        The number is how many characters at the front of KEY
        it takes to reach a non-prefix key.

But this case can be safely ignored, as define-key will take care of the
prefix. To solve this, the warning is only trigged when a function is
over-riden.

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Improve-windmove-default-keybindings-fuctions.patch

From 42a66e87af83817b9e989624fdbf9c7ee7c347c7 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 25 May 2021 11:47:51 +0200
Subject: [PATCH 1/2] Improve windmove-*-default-keybindings fuctions

* windmove.el (windmove-mode-map): Add special map for windmove
commands
(windmove-mode): Add minor mode for activating windmove-mode-map
(windmove-install-defaults): Add general function for manipulating
windmove-mode-map
(windmove-default-keybindings): Use windmove-install-defaults
(windmove-display-default-keybindings): Use windmove-install-defaults
(windmove-delete-default-keybindings): Use windmove-install-defaults
(windmove-swap-states-default-keybindings): Use
windmove-install-defaults
---
 lisp/windmove.el | 91 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 70 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..cd8592f341 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,53 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-mode-map (make-sparse-keymap)
+  "Map used by `windmove-install-defaults'.")
+
+(define-minor-mode windmove-mode
+  "Global minor mode for default windmove commands."
+  :keymap windmove-mode-map
+  :init-value t
+  :global t)
+
+(defun windmove-install-defaults (prefix modifiers alist &optional uninstall)
+  "Install keys as specified by ALIST.
+Every element of ALIST has the form (FN KEY), where KEY is
+appended to MODIFIERS, adding PREFIX to the beginning, before
+installing the key.  Previous bindings of FN are unbound.
+If UNINSTALL is non-nil, just remove the keys from ALIST."
+  (dolist (bind alist)
+    (dolist (old (where-is-internal (car bind) windmove-mode-map))
+      (define-key windmove-mode-map old nil))
+    (unless uninstall
+      (let ((key (vconcat (if (or (equal prefix [ignore])
+                                  (eq prefix 'none))
+                              nil prefix)
+                          (list (append modifiers (cdr bind))))))
+        (when (eq (key-binding key) #'self-insert-command)
+          (warn "Command %S is shadowing self-insert-key" (car bind)))
+        (let ((old-fn (lookup-key windmove-mode-map key)))
+          (when old-fn
+            (warn "Overriding %S with %S" old-fn (car bind))))
+        (define-key windmove-mode-map key (car bind))))))
+
 ;;;###autoload
 (defun windmove-default-keybindings (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-left left)
+                               (windmove-right right)
+                               (windmove-up up)
+                               (windmove-down down))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +580,21 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-display-left left)
+                               (windmove-display-right right)
+                               (windmove-display-up up)
+                               (windmove-display-down down)
+                               (windmove-display-same-window ?0)
+                               (windmove-display-new-frame ?f)
+                               (windmove-display-new-tab ?t))))
 
 
 ;;; Directional window deletion
@@ -618,16 +656,22 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (windmove-install-defaults prefix modifiers
+                             '((windmove-delete-left left)
+                               (windmove-delete-right right)
+                               (windmove-delete-up up)
+                               (windmove-delete-down down))))
 
 
 ;;; Directional window swap states
@@ -673,14 +717,19 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-swap-states-left left)
+                               (windmove-swap-states-right right)
+                               (windmove-swap-states-up up)
+                               (windmove-swap-states-down down))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0002-Add-user-options-for-default-windmove-commands.patch

From 21a8a8854249d24d62d4dd8e17c1f1d20de04fd6 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Thu, 27 May 2021 12:24:42 +0200
Subject: [PATCH 2/2] Add user options for default windmove commands

* windmove.el (windmove--default-keybindings-type): Add type
(windmove-default-keybindings): Add user option
(windmove-display-default-keybindings): Add user option
(windmove-delete-default-keybindings): Add user option
(windmove-swap-states-default-keybindings): Add user option
---
 lisp/windmove.el | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index cd8592f341..488962c063 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -731,6 +731,86 @@ windmove-swap-states-default-keybindings
                                (windmove-swap-states-up up)
                                (windmove-swap-states-down down))))
 
+
+
+(defconst windmove--default-keybindings-type
+  `(choice (const :tag "Don't bind" nil)
+           (cons :tag "Bind using"
+                 (key-sequence :tag "Prefix")
+                 (set :tag "Modifier"
+                      :greedy t
+                      ;; See `(elisp) Keyboard Events'
+                      (const :tag "Meta" meta)
+                      (const :tag "Control" control)
+                      (const :tag "Shift" shift)
+                      (const :tag "Hyper" hyper)
+                      (const :tag "Super" super)
+                      (const :tag "Alt" alt))))
+  "Customisation type for windmove modifiers.")
+
+(defcustom windmove-default-keybindings nil
+  "Default bindings for regular windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-left left)
+            (windmove-right right)
+            (windmove-up up)
+            (windmove-down down))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
+(defcustom windmove-display-default-keybindings nil
+  "Default bindings for display windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-display-left left)
+            (windmove-display-right right)
+            (windmove-display-up up)
+            (windmove-display-down down)
+            (windmove-display-same-window ?0)
+            (windmove-display-new-frame ?f)
+            (windmove-display-new-tab ?t))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
+(defcustom windmove-delete-default-keybindings nil
+  "Default bindings for delete windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-delete-left left)
+            (windmove-delete-right right)
+            (windmove-delete-up up)
+            (windmove-delete-down down))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
+(defcustom windmove-swap-states-default-keybindings nil
+  "Default bindings for swap-state windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-swap-states-left left)
+            (windmove-swap-states-right right)
+            (windmove-swap-states-up up)
+            (windmove-swap-states-down down))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
 
 (provide 'windmove)
 
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 30 May 2021 22:38:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 30 18:38:25 2021
Received: from localhost ([127.0.0.1]:60554 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lnU4e-0007op-U7
	for submit <at> debbugs.gnu.org; Sun, 30 May 2021 18:38:25 -0400
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:4741)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1lnU4b-0007oX-1u
 for 41438 <at> debbugs.gnu.org; Sun, 30 May 2021 18:38:24 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 42E45240002;
 Sun, 30 May 2021 22:38:12 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN> <87r1hucws6.fsf@icterid>
 <87k0nl420l.fsf@HIDDEN> <87zgwg302t.fsf@icterid>
Date: Mon, 31 May 2021 01:11:57 +0300
In-Reply-To: <87zgwg302t.fsf@icterid> (Philip Kaludercic's message of "Thu, 27
 May 2021 11:09:14 +0000")
Message-ID: <87im2zzy82.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> Maybe it's possible to add new user options without deprecating the
>> existing functions?  Then for users an alternative way would be to
>> customize these options, and enable windmove-mode in the init file.
>
> Of course, why not? The patches below should implement that.

Thanks, I tried out your patches.  The customization saved them
in such format:

  '(windmove-default-keybindings '([ignore] hyper))
  '(windmove-delete-default-keybindings '("\30" hyper))
  '(windmove-display-default-keybindings '([ignore] meta hyper))
  '(windmove-swap-states-default-keybindings '([ignore] shift hyper))

But I guess it's not a problem that it saves nil as [ignore].

The real problem is that after replacing this with a manual configuration:

  (use-package windmove
    :custom
    (windmove-default-keybindings '(nil hyper))
    (windmove-delete-default-keybindings `(,(kbd "C-x") hyper))
    (windmove-display-default-keybindings '(nil meta hyper))
    (windmove-swap-states-default-keybindings '(nil shift hyper)))

Then every startup pops up the *Warnings* buffer with:

  Warning (emacs): Overriding 1 with windmove-delete-left [Disable showing] [Disable logging]

But still all keybindings work correctly.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 27 May 2021 11:09:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 27 07:09:27 2021
Received: from localhost ([127.0.0.1]:50728 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lmDtG-0001of-Sy
	for submit <at> debbugs.gnu.org; Thu, 27 May 2021 07:09:27 -0400
Received: from mout02.posteo.de ([185.67.36.66]:60311)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lmDtD-0001oP-KV
 for 41438 <at> debbugs.gnu.org; Thu, 27 May 2021 07:09:25 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 1F85B2400FE
 for <41438 <at> debbugs.gnu.org>; Thu, 27 May 2021 13:09:16 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1622113757; bh=CrGL/Evz5DBNzJMtA2+wMqI560LNcZQFQl5SPblUVDo=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=JWuCh4/d8QUYKCWZSeNcgCcCbO6wo7Ktfnbz87JqwCCY6j6Paz25fsr4R2ES+1tko
 jR3p3eqS61UUlhVs227lXuDKuet4iyhQgNaou7reP2kakPT9Oe7hMACTKSiUj3bn4n
 8tzoxKbvO5TcRJt9JSiwH/3dk9xXy3XPWQu1CN0uMw4kyK10lDSvYS7UcDrMvNfjqU
 ajZGahOouUhxRTnO7Q39I8/BT4B+2Ov49HlZSSME7UbJqLCcisi9nV+9dQfIl9Caa6
 8kkyqzAyBOE341CZOenCC3WmxTZXR5JgfuoBEvflTqYdfza9ZQRGXG4/+SGiF8d725
 XA1MApvRKiHEg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FrQ7H14drz9rxH;
 Thu, 27 May 2021 13:09:14 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN> <87r1hucws6.fsf@icterid>
 <87k0nl420l.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Thu, 27 May 2021 11:09:14 +0000
In-Reply-To: <87k0nl420l.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 27 May 2021 00:35:46 +0300")
Message-ID: <87zgwg302t.fsf@icterid>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Juri Linkov <juri@HIDDEN> writes:

>> What I don't really like is that only
>> windmove-delete-default-keybindings can make use of prefixes, while all
>> commands only use modifiers. Could it make sense to deprecate these
>> functions in favour of either new functions or user-options?
>
> Maybe it's possible to add new user options without deprecating the
> existing functions?  Then for users an alternative way would be to
> customize these options, and enable windmove-mode in the init file.

Of course, why not? The patches below should implement that.

> Or maybe there will be a need to create separate modes for every
> keymap, e.g. windmove-display-mode, windmove-delete-mode?

I don't see why that should be necessary, as the proposed windmove-mode
doesn't even have the interest the user.

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Improve-windmove-default-keybindings-fuctions.patch

From 42a66e87af83817b9e989624fdbf9c7ee7c347c7 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 25 May 2021 11:47:51 +0200
Subject: [PATCH 1/2] Improve windmove-*-default-keybindings fuctions

* windmove.el (windmove-mode-map): Add special map for windmove
commands
(windmove-mode): Add minor mode for activating windmove-mode-map
(windmove-install-defaults): Add general function for manipulating
windmove-mode-map
(windmove-default-keybindings): Use windmove-install-defaults
(windmove-display-default-keybindings): Use windmove-install-defaults
(windmove-delete-default-keybindings): Use windmove-install-defaults
(windmove-swap-states-default-keybindings): Use
windmove-install-defaults
---
 lisp/windmove.el | 91 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 70 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..cd8592f341 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,53 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-mode-map (make-sparse-keymap)
+  "Map used by `windmove-install-defaults'.")
+
+(define-minor-mode windmove-mode
+  "Global minor mode for default windmove commands."
+  :keymap windmove-mode-map
+  :init-value t
+  :global t)
+
+(defun windmove-install-defaults (prefix modifiers alist &optional uninstall)
+  "Install keys as specified by ALIST.
+Every element of ALIST has the form (FN KEY), where KEY is
+appended to MODIFIERS, adding PREFIX to the beginning, before
+installing the key.  Previous bindings of FN are unbound.
+If UNINSTALL is non-nil, just remove the keys from ALIST."
+  (dolist (bind alist)
+    (dolist (old (where-is-internal (car bind) windmove-mode-map))
+      (define-key windmove-mode-map old nil))
+    (unless uninstall
+      (let ((key (vconcat (if (or (equal prefix [ignore])
+                                  (eq prefix 'none))
+                              nil prefix)
+                          (list (append modifiers (cdr bind))))))
+        (when (eq (key-binding key) #'self-insert-command)
+          (warn "Command %S is shadowing self-insert-key" (car bind)))
+        (let ((old-fn (lookup-key windmove-mode-map key)))
+          (when old-fn
+            (warn "Overriding %S with %S" old-fn (car bind))))
+        (define-key windmove-mode-map key (car bind))))))
+
 ;;;###autoload
 (defun windmove-default-keybindings (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-left left)
+                               (windmove-right right)
+                               (windmove-up up)
+                               (windmove-down down))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +580,21 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-display-left left)
+                               (windmove-display-right right)
+                               (windmove-display-up up)
+                               (windmove-display-down down)
+                               (windmove-display-same-window ?0)
+                               (windmove-display-new-frame ?f)
+                               (windmove-display-new-tab ?t))))
 
 
 ;;; Directional window deletion
@@ -618,16 +656,22 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (windmove-install-defaults prefix modifiers
+                             '((windmove-delete-left left)
+                               (windmove-delete-right right)
+                               (windmove-delete-up up)
+                               (windmove-delete-down down))))
 
 
 ;;; Directional window swap states
@@ -673,14 +717,19 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-swap-states-left left)
+                               (windmove-swap-states-right right)
+                               (windmove-swap-states-up up)
+                               (windmove-swap-states-down down))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0002-Add-user-options-for-default-windmove-commands.patch

From 21a8a8854249d24d62d4dd8e17c1f1d20de04fd6 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Thu, 27 May 2021 12:24:42 +0200
Subject: [PATCH 2/2] Add user options for default windmove commands

* windmove.el (windmove--default-keybindings-type): Add type
(windmove-default-keybindings): Add user option
(windmove-display-default-keybindings): Add user option
(windmove-delete-default-keybindings): Add user option
(windmove-swap-states-default-keybindings): Add user option
---
 lisp/windmove.el | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index cd8592f341..488962c063 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -731,6 +731,86 @@ windmove-swap-states-default-keybindings
                                (windmove-swap-states-up up)
                                (windmove-swap-states-down down))))
 
+
+
+(defconst windmove--default-keybindings-type
+  `(choice (const :tag "Don't bind" nil)
+           (cons :tag "Bind using"
+                 (key-sequence :tag "Prefix")
+                 (set :tag "Modifier"
+                      :greedy t
+                      ;; See `(elisp) Keyboard Events'
+                      (const :tag "Meta" meta)
+                      (const :tag "Control" control)
+                      (const :tag "Shift" shift)
+                      (const :tag "Hyper" hyper)
+                      (const :tag "Super" super)
+                      (const :tag "Alt" alt))))
+  "Customisation type for windmove modifiers.")
+
+(defcustom windmove-default-keybindings nil
+  "Default bindings for regular windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-left left)
+            (windmove-right right)
+            (windmove-up up)
+            (windmove-down down))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
+(defcustom windmove-display-default-keybindings nil
+  "Default bindings for display windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-display-left left)
+            (windmove-display-right right)
+            (windmove-display-up up)
+            (windmove-display-down down)
+            (windmove-display-same-window ?0)
+            (windmove-display-new-frame ?f)
+            (windmove-display-new-tab ?t))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
+(defcustom windmove-delete-default-keybindings nil
+  "Default bindings for delete windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-delete-left left)
+            (windmove-delete-right right)
+            (windmove-delete-up up)
+            (windmove-delete-down down))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
+(defcustom windmove-swap-states-default-keybindings nil
+  "Default bindings for swap-state windmove commands."
+  :set (lambda (sym val)
+         (windmove-install-defaults
+          (car val) (cdr val)
+          '((windmove-swap-states-left left)
+            (windmove-swap-states-right right)
+            (windmove-swap-states-up up)
+            (windmove-swap-states-down down))
+          (null val))
+         (set-default sym val))
+  :type windmove--default-keybindings-type
+  :version "28.1"
+  :group 'windmove)
+
 
 (provide 'windmove)
 
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 26 May 2021 21:40:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 26 17:40:34 2021
Received: from localhost ([127.0.0.1]:50062 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lm1GU-0004Ut-MK
	for submit <at> debbugs.gnu.org; Wed, 26 May 2021 17:40:34 -0400
Received: from relay9-d.mail.gandi.net ([217.70.183.199]:44145)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1lm1GS-0004UU-F1
 for 41438 <at> debbugs.gnu.org; Wed, 26 May 2021 17:40:32 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 129F4FF805;
 Wed, 26 May 2021 21:40:24 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN> <87r1hucws6.fsf@icterid>
Date: Thu, 27 May 2021 00:35:46 +0300
In-Reply-To: <87r1hucws6.fsf@icterid> (Philip Kaludercic's message of "Tue, 25
 May 2021 21:45:45 +0000")
Message-ID: <87k0nl420l.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> What I don't really like is that only
> windmove-delete-default-keybindings can make use of prefixes, while all
> commands only use modifiers. Could it make sense to deprecate these
> functions in favour of either new functions or user-options?

Maybe it's possible to add new user options without deprecating the
existing functions?  Then for users an alternative way would be to
customize these options, and enable windmove-mode in the init file.
Or maybe there will be a need to create separate modes for every
keymap, e.g. windmove-display-mode, windmove-delete-mode?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 21:45:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 17:45:56 2021
Received: from localhost ([127.0.0.1]:47205 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lles7-0003dw-HQ
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 17:45:56 -0400
Received: from mout02.posteo.de ([185.67.36.66]:50553)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lles5-0003dj-Gn
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 17:45:55 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 0C6032400FD
 for <41438 <at> debbugs.gnu.org>; Tue, 25 May 2021 23:45:46 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621979147; bh=E3nP/K+bncvSvBcUS8Zi0bpkOyRU4CmirhvSWpS1BMI=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=ZX+2TXIEEDwtqP/U3sfsDUl1GFhW2GuJ8sZT1znG1imCYDeA0A+J5wsWEFe/4FmHg
 SlIPimrneD4/dNK0mJROmxu/9am9oz+XYyj39lBZ6N4Ai3KwXe+DdrZK9RqJ6T7XZo
 Ds7yvtLA/6B9YkF600ZdQAAZGbwVbFRUlsKzwue71wyNGl7u2DvT+UDosLs6axjOGl
 m1sAQmdKq2IUfO7EViJQGA3m+gs5GG3BpGx4n8RaRE9PL665eF0TxHIo6g+zyiUfvv
 ApCyZNCOtXqxy49NNTCOgFtQGU7PpBtc332YH6sYNQrxZTrG6bhxrMIVdbn/Sn0K7V
 NUkwm0jN3Nogg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FqSLd5v0Zz6tmL;
 Tue, 25 May 2021 23:45:45 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <875yz68yoq.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 25 May 2021 21:45:45 +0000
In-Reply-To: <875yz68yoq.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 25 May 2021 23:18:13 +0300")
Message-ID: <87r1hucws6.fsf@icterid>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Juri Linkov <juri@HIDDEN> writes:

>> -  (global-set-key (vector prefix (append modifiers '(left)))  'windmove-delete-left)
>> -  (global-set-key (vector prefix (append modifiers '(right))) 'windmove-delete-right)
>> -  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
>> -  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
>> +  (windmove-install-defaults modifiers
>> +                             '((windmove-delete-left left)
>> +                               (windmove-delete-right right)
>> +                               (windmove-delete-up up)
>> +                               (windmove-delete-down down))))
>
> I haven't yet tested your patch, but after reading it seems 'prefix' is unused now?

You are right, I didn't test that specific function
properly. windmove-install-defaults had to be extended by another
argument to fix this.

What I don't really like is that only
windmove-delete-default-keybindings can make use of prefixes, while all
commands only use modifiers. Could it make sense to deprecate these
functions in favour of either new functions or user-options?

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Improve-windmove-default-keybindings-fuctions.patch

From ecbed85db9622ef5b1680472273163cb7789ae3f Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 25 May 2021 11:47:51 +0200
Subject: [PATCH] Improve windmove-*-default-keybindings fuctions

* windmove.el (windmove-mode-map): Add special map for windmove
commands
(windmove-mode): Add minor mode for activating windmove-mode-map
(windmove-install-defaults): Add general function for manipulating
windmove-mode-map
(windmove-default-keybindings): Use windmove-install-defaults
(windmove-display-default-keybindings): Use windmove-install-defaults
(windmove-delete-default-keybindings): Use windmove-install-defaults
(windmove-swap-states-default-keybindings): Use
windmove-install-defaults
---
 lisp/windmove.el | 87 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 66 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..d7c1d25d82 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,49 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-mode-map (make-sparse-keymap)
+  "Map used by `windmove-install-defaults'.")
+
+(define-minor-mode windmove-mode
+  "Global minor mode for default windmove commands."
+  :keymap windmove-mode-map
+  :init-value t
+  :global t)
+
+(defun windmove-install-defaults (prefix modifiers alist)
+  "Install keys as specified by ALIST.
+Every element of ALIST has the form (FN KEY), where KEY is
+appended to MODIFIERS, adding PREFIX to the beginning, before
+installing the key.  Previous bindings of FN are unbound."
+  (dolist (bind alist)
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-mode-map))
+        (define-key windmove-mode-map old nil))
+      (let ((key (vconcat (if (eq prefix 'none) nil prefix)
+                          (list (append modifiers (cdr bind))))))
+        (let ((old-fn (lookup-key windmove-mode-map key)))
+          (when old-fn
+            (warn "Overriding %S with %S" old-fn (car bind))))
+        (define-key windmove-mode-map key (car bind))))))
+
 ;;;###autoload
 (defun windmove-default-keybindings (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-left left)
+                               (windmove-right right)
+                               (windmove-up up)
+                               (windmove-down down))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +576,21 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-display-left left)
+                               (windmove-display-right right)
+                               (windmove-display-up up)
+                               (windmove-display-down down)
+                               (windmove-display-same-window ?0)
+                               (windmove-display-new-frame ?f)
+                               (windmove-display-new-tab ?t))))
 
 
 ;;; Directional window deletion
@@ -618,16 +652,22 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (windmove-install-defaults prefix modifiers
+                             '((windmove-delete-left left)
+                               (windmove-delete-right right)
+                               (windmove-delete-up up)
+                               (windmove-delete-down down))))
 
 
 ;;; Directional window swap states
@@ -673,14 +713,19 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (windmove-install-defaults nil modifiers
+                             '((windmove-swap-states-left left)
+                               (windmove-swap-states-right right)
+                               (windmove-swap-states-up up)
+                               (windmove-swap-states-down down))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 20:38:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 16:38:41 2021
Received: from localhost ([127.0.0.1]:47123 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lldp3-0008F6-F0
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 16:38:41 -0400
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:58157)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1lldoz-0008Ej-OM
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 16:38:39 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 18BC3240002;
 Tue, 25 May 2021 20:38:29 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
Date: Tue, 25 May 2021 23:18:13 +0300
In-Reply-To: <87im37p2b4.fsf@icterid> (Philip Kaludercic's message of "Tue, 25
 May 2021 09:53:19 +0000")
Message-ID: <875yz68yoq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> -  (global-set-key (vector prefix (append modifiers '(left)))  'windmove-delete-left)
> -  (global-set-key (vector prefix (append modifiers '(right))) 'windmove-delete-right)
> -  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
> -  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-delete-left left)
> +                               (windmove-delete-right right)
> +                               (windmove-delete-up up)
> +                               (windmove-delete-down down))))

I haven't yet tested your patch, but after reading it seems 'prefix' is unused now?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 19:25:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 15:25:28 2021
Received: from localhost ([127.0.0.1]:46867 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llcgC-0003dT-BL
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 15:25:28 -0400
Received: from mout02.posteo.de ([185.67.36.66]:42197)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1llcg9-0003dD-6B
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 15:25:26 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 7C3492400FE
 for <41438 <at> debbugs.gnu.org>; Tue, 25 May 2021 21:25:18 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621970718; bh=oBW8IgbWSEMiA624yWyBlezJlRHTNz2ckXkgRqlTtVo=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=aB+Zxzt1vEA8cJ9ALVzxVbHqmhgcClk6R32RfSURxinjO8VuoUW641hA0mRIBCPGT
 IN3u2B1v0jgE+bJOoodHhZSY22Yxe5U6mO+a5908lS+dEQggu8pLKJ1jdrm+nKa7xg
 DU3q42Unjp+inOz2Df6aVg2hNjRYSd5QmArkh3/N2eNWBsmPXOsBlfbH/RnaabhETh
 6gCNCKczawHfLrtJkahnyFCT8ry6IuCpZ1bmMyJSmo5Z1Eq1rZwymXktyAkVptAkKG
 LoiPO8AeEiTJnwOQFzchaXiNtknaaSEB+Aacx898G9EqRLN87ieGSMWxI/8Y0Cvtxa
 6eih1FDofOgWw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FqPDY00nLz6tmP;
 Tue, 25 May 2021 21:25:16 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <87eedupqt4.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 25 May 2021 19:25:16 +0000
In-Reply-To: <87eedupqt4.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 25 May 2021 21:16:23 +0200")
Message-ID: <87wnrmfwf7.fsf@icterid>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> I have tried this out, and it seems somewhat elegant.  From my testing,
>> it seems to behave the same way as the previous approach.
>
> Looks good to me.  One minor thing:
>
>> +(defvar windmove-default-map (make-sparse-keymap)
>> +  "Map used by `windmove-install-defaults'.")
>
> This should be called -mode-map.

Ok, the patch is below. I also added warning this time to net people
know if automatically bound keys would conflict.

> I don't actually use windmove -- could somebody else who's using this
> try this patch out and see whether it works well for them?

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Improve-windmove-default-keybindings-fuctions.patch

From d572168a4fce653dcded2c4ca54f324dca78e280 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 25 May 2021 11:47:51 +0200
Subject: [PATCH] Improve windmove-*-default-keybindings fuctions

* windmove.el (windmove-mode-map): Add special map for windmove
commands
(windmove-mode): Add minor mode for activating windmove-mode-map
(windmove-install-defaults): Add general function for manipulating
windmove-mode-map
(windmove-default-keybindings): Use windmove-install-defaults
(windmove-display-default-keybindings): Use windmove-install-defaults
(windmove-delete-default-keybindings): Use windmove-install-defaults
(windmove-swap-states-default-keybindings): Use
windmove-install-defaults
---
 lisp/windmove.el | 80 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 59 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..479fdef512 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,42 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-mode-map (make-sparse-keymap)
+  "Map used by `windmove-install-defaults'.")
+
+(defun windmove-install-defaults (modifiers alist)
+  "Install keys as specified by ALIST.
+Every element of ALIST has the form (FN KEY), where KEY is
+appended to MODIFIERS, before installing the key.  Previous
+bindings of FN are unbound."
+  (dolist (bind alist)
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-mode-map))
+        (define-key windmove-mode-map old nil))
+      (let ((key (vector (append modifiers (cdr bind)))))
+        (let ((old-fn (lookup-key windmove-mode-map key)))
+          (when old-fn
+            (warn "Overriding %S with %S" old-fn (car bind))))
+        (define-key windmove-mode-map key (car bind))))))
+
 ;;;###autoload
 (defun windmove-default-keybindings (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-left left)
+                               (windmove-right right)
+                               (windmove-up up)
+                               (windmove-down down))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +569,21 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (windmove-install-defaults modifiers
+                             '((windmove-display-left left)
+                               (windmove-display-right right)
+                               (windmove-display-up up)
+                               (windmove-display-down down)
+                               (windmove-display-same-window ?0)
+                               (windmove-display-new-frame ?f)
+                               (windmove-display-new-tab ?t))))
 
 
 ;;; Directional window deletion
@@ -618,16 +645,22 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-delete-left left)
+                               (windmove-delete-right right)
+                               (windmove-delete-up up)
+                               (windmove-delete-down down))))
 
 
 ;;; Directional window swap states
@@ -673,14 +706,19 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-swap-states-left left)
+                               (windmove-swap-states-right right)
+                               (windmove-swap-states-up up)
+                               (windmove-swap-states-down down))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 19:16:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 15:16:34 2021
Received: from localhost ([127.0.0.1]:46831 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llcXa-0002Wc-HS
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 15:16:34 -0400
Received: from quimby.gnus.org ([95.216.78.240]:48610)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1llcXY-0002R0-Qs
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 15:16:33 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=wBazHBmMzhJzLeEJorHfdw4AhcEswZhnwGVKzF0TSos=; b=rxNWi/6yU/DI71JBhhfUCudgzq
 3v7GSfV23dWs0RmfiNblyUPMnNk1JEJ3mTbVMAUdCxKb0JRs4H7K08G89EjVaR++m5H89AeabIuiw
 j5yrn7Qjgz2k/ludkRpi6JB9EZd/mIDT3nwGlEHHscmy+mhZ0oQyk21S3hR5G2qXQB5Y=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1llcXQ-00046F-6n; Tue, 25 May 2021 21:16:26 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
X-Now-Playing: Satomimagae's _awa_: "Inu"
Date: Tue, 25 May 2021 21:16:23 +0200
In-Reply-To: <87im37p2b4.fsf@icterid> (Philip Kaludercic's message of "Tue, 25
 May 2021 09:53:19 +0000")
Message-ID: <87eedupqt4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Philip Kaludercic <philipk@HIDDEN> writes: > I have tried
 this out, and it seems somewhat elegant. From my testing, > it seems to behave
 the same way as the previous approach. Looks good to me. One minor thing:
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> I have tried this out, and it seems somewhat elegant.  From my testing,
> it seems to behave the same way as the previous approach.

Looks good to me.  One minor thing:

> +(defvar windmove-default-map (make-sparse-keymap)
> +  "Map used by `windmove-install-defaults'.")

This should be called -mode-map.

I don't actually use windmove -- could somebody else who's using this
try this patch out and see whether it works well for them?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 19:13:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 15:13:25 2021
Received: from localhost ([127.0.0.1]:46812 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llcUX-00016S-0B
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 15:13:25 -0400
Received: from quimby.gnus.org ([95.216.78.240]:48586)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1llcUV-00016F-Kq
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 15:13:24 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=URAh9YWWKFp6ItAXp2sWHi5+zwKKPCGCpdvV5U+Yuas=; b=BMbpIsrbncRqShAvrfeHyrS5OU
 mw8Row3obB4umpVZwxLIJ4k58Q9iRX5WFF9TjfnDQGfXNsUG2JO0t72Ca8wJds5l1XGcU0pWdDgEJ
 DpR2Y77zC8JRMyb6U9jy5Hk3bwuQaFLRxOaGhso4WzkrlR2b3/60IYUdJ3tfu/iPiQy4=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1llcUN-00044d-6P; Tue, 25 May 2021 21:13:17 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Arthur Miller <arthur.miller@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <AM9PR09MB4977C5430B63ABDFDB54131F96259@HIDDEN>
X-Now-Playing: Satomimagae's _awa_: "Midori-irono Yoru"
Date: Tue, 25 May 2021 21:13:14 +0200
In-Reply-To: <AM9PR09MB4977C5430B63ABDFDB54131F96259@HIDDEN>
 (Arthur Miller's message of "Tue, 25 May 2021 13:36:22 +0200")
Message-ID: <87im36pqyd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Arthur Miller <arthur.miller@HIDDEN> writes: > If you are
 already patching windmove.el, can you consider adding > bindings for these
 funcitions too (defined in window.el): This seems unrelated to this current
 bug report, but you could open a new wishlist bug report for this. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Arthur Miller <arthur.miller@HIDDEN> writes:

> If you are already patching windmove.el, can you consider adding
> bindings for these funcitions too (defined in window.el):

This seems unrelated to this current bug report, but you could open a
new wishlist bug report for this.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 14:39:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 10:39:18 2021
Received: from localhost ([127.0.0.1]:46528 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llYDF-0000Jf-PD
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 10:39:18 -0400
Received: from mout01.posteo.de ([185.67.36.65]:45657)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1llYDB-0000JN-TM
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 10:39:16 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 8F5AF240026
 for <41438 <at> debbugs.gnu.org>; Tue, 25 May 2021 16:39:07 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621953547; bh=D6hjP1rJTSDglMrQTHL9RUiLorEV6+pTI16Ev0rE9So=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=dhzTgrcGsYgGwPmJ60pNbNv/vB0Gyfdhv6IgY0CqirRBRpxhWvY+jBhHj5Ib4kNIp
 UEI3aISf2InhnQ9MrhBKM/h7BRtGIbGNwIQp3At/ON7x+pACHKCtoT1uKtj9x3qVpQ
 Teo7Tatk8uM8+EEIZvflvDIEdglGhrk1b+lm28a77Om8/fPdeSsAcLS6Qjq1NttrdN
 112csq+w+pD6C5DN3ZVy1IfjUJOq3OYTt7ENJ/cI9U78CnjmRxmFH9lIZ7BN8N0n9Z
 8j9hJs4KTU7G0ad+CUMxTj05ObaStSqxRftYMzAgNPa5/cF/WhJVreNCxkOp3sDFRw
 9waPJKomPsuAw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FqGtL0X1xz6tmB;
 Tue, 25 May 2021 16:39:06 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Arthur Miller <arthur.miller@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <AM9PR09MB49778A8AC2A43FAA0AC6130A96259@HIDDEN>
 <87v977ghtr.fsf@icterid>
 <AM9PR09MB4977EC9FF1898339BCD25CCE96259@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 25 May 2021 14:39:05 +0000
In-Reply-To: <AM9PR09MB4977EC9FF1898339BCD25CCE96259@HIDDEN>
 (Arthur Miller's message of "Tue, 25 May 2021 15:31:43 +0200")
Message-ID: <87bl8ysws6.fsf@icterid>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Arthur Miller <arthur.miller@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> Arthur Miller <arthur.miller@HIDDEN> writes:
>>
>>> Philip Kaludercic <philipk@HIDDEN> writes:
>>>> +(defvar windmove-default-map (make-sparse-keymap)
>>>> +  "Map used by `windmove-install-defaults'.")
>>>
>>> Sorry if I ask, but wouldn't ordinary windmove-mode-map do here?
>>
>> You are probably right -- my thought was that the minor mode exists for
>> the sake of the map.
>
> Yeah, exactly in this case. I am not sure if I understand correctly, you
> mean people will set new map for the mode to change bindings?

No, that is why the minor mode is active by default. The only reason the
minor mode is defined is to modify minor-mode-map-alist.

>> That's the question: should windmove-default-map be accessed by default
>> or only via the -default-keybindings functions? Either way something
>
> I think you are thinking about default keybindings reather than default
> map. If I assume correctly. If I understand corectly you would like to
> preserve some default bindings, the map is just a mean to accomplish it.

I am not sure what you are referring to, the map is manipulated by
windmove-install-defaults, which in turn is used by

* windmove-default-keybindings
* windmove-display-default-keybindings
* windmove-delete-default-keybindings
* windmove-swap-states-default-keybindings

So it is not just about preserving some default bindings, but ensuring
that the explicitly requested bindings are installed correctly.

>> should be changed, if windmove-default-map it should be renamed to
>> windmove--default-map to explicitly mark it as an internal
>> map. Otherwise it shsould be renamed to windmove-mode-map as you suggest.
>
> Either use default map stored some "default var", and add a function
> that restores mode map, or just add a function that resets keybindings
> into mode map directly, which might be sufficient. I don't know matter
> of taste? A default mode map in a variable is cleaner but more costly?
>
> Emacs provides windows, so I think there should also be a default way of
> moving cursor between them, manipulate them and so on. Thus I think
> windmove operations should be on by default, I don't think C-x 1/2/3/o
> are satisfying when we have more then 2 widows.
>
> A minor mode is probably a good balance between altering Emacs defaults,
> so not break someones config, and to give people an option to easily
> turn on some useful feature/configuration.

I'm sorry, either I am missing something or we are talking besides one
another.

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 13:58:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 09:58:16 2021
Received: from localhost ([127.0.0.1]:46465 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llXZX-0007ZH-SU
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 09:58:16 -0400
Received: from mail-oln040092075054.outbound.protection.outlook.com
 ([40.92.75.54]:41415 helo=EUR04-VI1-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arthur.miller@HIDDEN>) id 1llXZU-0007Yz-QF
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 09:58:14 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=oUrRIwOwZIhfAdrmgq/sGdCr3hT62/RkkNnhN5a6ld5BVL4Z3kLH9mpgb/ISxGPTivvhQvC1IkFDJkGq040HGYxR99u21HV8hMfzqqO4zAxzms3Sd+gQZluBjKNHLWHTjaSLjO3BEEwmK/A+0FhhZlysZkM6RyyyngxK7X+g24UaaqE8Ei5QwdC9A0QSHIEwBVm3AKW4OranXSE5ErsmwL2ECZmDaS8QXrTOgGXEFxm0Fb1zLJni+zie9goGUhbGSZWroQlWH60Utsrzv2FbR07g1JLbeha9TYPaB6Fqnia9fLX2O/vJODD6hfrGOShHqDBdn1Ee8Ymjx+vwQd357g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=iCW0sDqsUBsTzPbRTC+hAl2Rlh6eAUffHopXygr2Ots=;
 b=nAMTS4B9C8arMIFtiIsJ54zUDRhT+qyf7+g0T/nQH18edq/8Ae2M6CsUBEZBU83b4aQBMiqe+P76W4Z0/GZA2NvNP741aigT2nmv5mqOrViImX06QTvZr4M1j6LvPwnIDV1y1xfYGSxT0LO9poMtzy7xY2ygbmqtinaTzpD2iqRBW1pMaa5/mUA+SC08UeZq30NelL3PuQFP1ZdmtTqRR69wsXy5s/EC2fT7fsUOjfNPM0Uj3t+28YDQ+Ou6OioCYKW5ZkcLLEeYUUdweM9z+Nc7H/KareeLFSQ9+GgIqqjVIBjmNLGv2tADssfZc7HCHNWjadoMeOULrygbwDx7og==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=iCW0sDqsUBsTzPbRTC+hAl2Rlh6eAUffHopXygr2Ots=;
 b=f/UKud9CaGFLNldObRw89ssbIi7HXsCiwNh/6brxxVM4E80uz/7fZg3lpp7XjHsR8lqvcJvI1yWE/w7hwS7ppYQOCV+yGoCIjPlZ+sGMtXp9ZyIPaEi7V7Fmj6f7DVrjLi9YtX4u1eySf9/NjnSndMzFGe1oPxevxsqwoJK3dzRNJpUY2PWbQ1w89WVTWVe35Th1fvc3+FOR8gZ8HLKrTKtkDC9m1303gGgacMXjetLZ5RxASilxTyai8tl/FvajzFHF/8CZ+/rEiuqGcGLQv88EksVF0S8tjlMIYtSCoswB7KkyFnmvXVBJ6eN/1jz+QbmpFDNiDFQ4Bv5dK7nIXQ==
Received: from HE1EUR04FT012.eop-eur04.prod.protection.outlook.com
 (2a01:111:e400:7e0d::43) by
 HE1EUR04HT179.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::391)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Tue, 25 May
 2021 13:58:05 +0000
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 (2a01:111:e400:7e0d::41) by HE1EUR04FT012.mail.protection.outlook.com
 (2a01:111:e400:7e0d::92) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend
 Transport; Tue, 25 May 2021 13:58:05 +0000
X-IncomingTopHeaderMarker: OriginalChecksum:FD79D44DAACC2A94DDAB3E1371897997994C54829AC061ADDC6D84BE775D97F6;
 UpperCasedChecksum:9A7F8E2A58C7CE98FA716DEE782AC27D0125F1C16E624251BA9729D22F122DDD;
 SizeAsReceived:7741; Count:46
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591]) by AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021
 13:58:05 +0000
From: Arthur Miller <arthur.miller@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <AM9PR09MB4977C5430B63ABDFDB54131F96259@HIDDEN>
 <87mtsjghns.fsf@icterid>
Date: Tue, 25 May 2021 15:58:03 +0200
In-Reply-To: <87mtsjghns.fsf@icterid> (Philip Kaludercic's message of "Tue, 25
 May 2021 11:46:31 +0000")
Message-ID: <AM9PR09MB49776A9E4BC4312C742C2EA096259@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)
Content-Type: text/plain
X-TMN: [P6MsaS/0bVg8KyS0s+YfaHoVbsofxSt4]
X-ClientProxiedBy: BE0P281CA0028.DEUP281.PROD.OUTLOOK.COM
 (2603:10a6:b10:14::15) To AM9PR09MB4977.eurprd09.prod.outlook.com
 (2603:10a6:20b:304::20)
X-Microsoft-Original-Message-ID: <82eeduoqz8.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from HP-Laptop.homepc (81.232.177.30) by
 BE0P281CA0028.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:14::15) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.4173.12 via Frontend Transport; Tue, 25 May 2021 13:58:04 +0000
X-MS-PublicTrafficType: Email
X-IncomingHeaderCount: 46
X-EOPAttributedMessage: 0
X-MS-Office365-Filtering-Correlation-Id: 758f494e-951b-4455-ca6a-08d91f851e36
X-MS-TrafficTypeDiagnostic: HE1EUR04HT179:
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: qEfRYD55zvUlOrNE9qOdXGZ9/si8FunAjAKKadafK/m1dTX+TK6NfZ6N8Xt7zmHP+qdAxOaEk7K40YD8+pBnGmPzEhbC3KFTla5y+PNvsE57EqFAub//zCu87KFVkhywHeet88uxVpi5VINjdgQUc0iWvatyrQ9mI6aXRRn6bIXHPAnkAVExQKUFLZZszBnDSaVHMB4H6AfzTG3YCSz2fJ5LBlGtGZepXkOiBPriAi1zd9J3tE1FzRpVnyB3bJRhrdFpWyTVm2WH2nyANvM9QD75Z0c/CnID/uW3W9M/Ym8EBXflu/rPrkr3OR6xKrOsl7fwJrz5bCrbX8Sg/wQ3AfyOTPbdZtILB1auFUD8X8nESetcq2QAcA12x65oyL8tvJ8WHA4ZnkHDlKedpc3Svw==
X-MS-Exchange-AntiSpam-MessageData: 68UjO17wyybzm+BrGPF6+5fQJtiHvTgPHpJAfgB5RgcVb5sSgPw/sxDctlL/3xvvLXoKkB/CT8MOk9VZTa2syhksyJQzi5vYxDJN9gy8J4TAaWEm9voaurXLhM7blwk7tbxeDw6N1zfnSBdfiid8Ug==
X-OriginatorOrg: live.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 758f494e-951b-4455-ca6a-08d91f851e36
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 13:58:05.1238 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT012.eop-eur04.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR04HT179
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> Arthur Miller <arthur.miller@HIDDEN> writes:
>
>> If you are already patching windmove.el, can you consider adding
>> bindings for these funcitions too (defined in window.el):
>>
>> enlarge-window-horizontally
>> shrink-window-horizontally
>>
>> As well as add these two wrappers for vertical operations:
>>
>> #+begin_src emacs-lisp
>>
>> ;;;###autoload
>> (defun enlarge-window-vertically (delta)
>>   "Make selected window DELTA columns wider.
>> Interactively, if no argument is given, make selected window one
>> column wider."
>>   (interactive "p")
>>   (enlarge-window delta nil))
>>
>> ;;;###autoload
>> (defun shrink-window-vertically (delta)
>>   "Make selected window DELTA columns narrower.
>> Interactively, if no argument is given, make selected window one
>> column narrower."
>>   (interactive "p")
>>   (shrink-window delta nil))
>>
>> #+end_src
>>
>> I have been using those for long time myself since I prefer to do
>> everything from the keyboard. Maybe someone else finds them useful too;
>> they have been in my config on GH for long time.
>
> I am not sure if these commands should be added as part of the same
> changeset.
Those two wrappers itself are not necessary to add, they are just they
for the sake of naming. It looks better and more clear what a binding
does in "whick-key" window, in help buffers, and provides better
symmetry to shrink/enlarge-window-horizontally.

original functions are all in window.el:

shrink-window
enlarge-window
shrink-window-horizontally
enlarge-window-horizontally

> The point of this commit is to make configuring windmove keys
> using windmove-default-keybindings & co. more consistent.

I completeley understand you are concentrated just on windmove keys.

This is just a suggestion. I think windmove should have probably be
named from the beginning as "windoperations", since it does more than
just move corsor between windows.

Shrinking and enlarging windows is definitely a useful window operation
to beind on a key, in my opinion should have been in windmove.el since
beginning.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 13:31:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 09:31:57 2021
Received: from localhost ([127.0.0.1]:45028 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llXA4-0006Yn-TY
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 09:31:57 -0400
Received: from mail-vi1eur05olkn2094.outbound.protection.outlook.com
 ([40.92.90.94]:9441 helo=EUR05-VI1-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arthur.miller@HIDDEN>) id 1llX9z-0006YV-MI
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 09:31:55 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=PLgjq/UMlUVNuGCcdiSli32Od5UgcQp2fhtw/2prGm3ROfFZyzi3HBUkrulTzUV2ZHrtPoGTVsE67oOfcGQPIPfVx6ToJhqQcBMzEm575O1xjXBRZu9hYnUChYkkJF7hHgRpvECVFQpFDrwFbaTWzojWwnncds0+iVP6SMondFT1tB+D1GR8kSBZzYI5xyCcYpZqu1Hag+1/JbOOL+QSz8hQpsX4OU1e0/PXmR9LEQzNlJvD6J0hQe+8BuycOKYcIUL/4EKrJN4/bG2ytQmnA7mJMzeycufpCAVCILQ/P1jjlqjj8V4CH/vdn875RifHLCsK1osjpOGN9e7Or/9+VQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=ICWV4hX+wlacKyvhXJgu8ptQa99OZ7Q8IZKYPvErtG4=;
 b=C6KM9DBJZryiw84Zpp0FUvgy6kjx6S45xrhlRwYl3PpY/yfNoZmMcV+lTgmexhvtR1JYK17D4MYjnurUo/AO4n3m4meqjsvOplj8/YaaLQYGsPIwRcqitiDRfz5KErgs7sccKoCWmMGc7InaU8az0hAchfApaARitMwqvQE+ONrGocKsv2cCigYcxeWGVzAfZFsnj35lORbBsFUgcOsutCFVV5ttt6ogn5y7BmHcupeEXk3KfcIFS5WFQg4ShKpITyWrjNeprppk4JLYmMdLeuA1doGxea9g/ig1rbzgkHC4yR+3Td6lg7Zh7vaAM9zuHeMBxGYDEWfxWjZ8x9exEg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=ICWV4hX+wlacKyvhXJgu8ptQa99OZ7Q8IZKYPvErtG4=;
 b=JH9lLmFP/kfss2wXgqOC/dtfw2IZE1b4Qh5impX89wNpe1ZI0rCZTczOFZxrHhax9E41r09heIpdbxzzwq5PUnW/1VyEbqERSmv7jCD4BVGZuvAv4fQI2gjO0/hdgRHlmZ1gR+4OjH/FXDtSHITjnDwSR3vDQ/vAwxYgiG24ea3IzD2nw+7uOqnfpPlAhnMdKOAprBYbiCuOeZ0YB3Le4PlErtDTAuXgmxW9Zv5UpJ/sPsYrnOi9aWr5sOK6jWShUMYAdF+Q0KY/7278WaGMRGOnDOruh/zGl0csjKJmLQXU3VbqXtRClMXbi8ZPv1XHne2raxN9UqeAX/fe24DojA==
Received: from AM6EUR05FT057.eop-eur05.prod.protection.outlook.com
 (2a01:111:e400:fc11::49) by
 AM6EUR05HT208.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::153)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Tue, 25 May
 2021 13:31:44 +0000
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 (2a01:111:e400:fc11::41) by AM6EUR05FT057.mail.protection.outlook.com
 (2a01:111:e400:fc11::78) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend
 Transport; Tue, 25 May 2021 13:31:44 +0000
X-IncomingTopHeaderMarker: OriginalChecksum:0F6BFF8DF6123C048F2AEAA8F5D1013B65B39DAE225C38FA3359AFDB9EE80290;
 UpperCasedChecksum:9F70C3F10DED9F288D7D775E88282189D954978598575E9EDF66B3902CF14A0B;
 SizeAsReceived:7756; Count:46
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591]) by AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021
 13:31:44 +0000
From: Arthur Miller <arthur.miller@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <AM9PR09MB49778A8AC2A43FAA0AC6130A96259@HIDDEN>
 <87v977ghtr.fsf@icterid>
Date: Tue, 25 May 2021 15:31:43 +0200
In-Reply-To: <87v977ghtr.fsf@icterid> (Philip Kaludercic's message of "Tue, 25
 May 2021 11:42:56 +0000")
Message-ID: <AM9PR09MB4977EC9FF1898339BCD25CCE96259@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)
Content-Type: text/plain
X-TMN: [5BOSIlKlPNnGFQ7UXfpu7Aa5Q91AnpRk]
X-ClientProxiedBy: AS8PR04CA0138.eurprd04.prod.outlook.com
 (2603:10a6:20b:127::23) To AM9PR09MB4977.eurprd09.prod.outlook.com
 (2603:10a6:20b:304::20)
X-Microsoft-Original-Message-ID: <82lf83ndmo.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from HP-Laptop.homepc (81.232.177.30) by
 AS8PR04CA0138.eurprd04.prod.outlook.com (2603:10a6:20b:127::23) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.24 via Frontend
 Transport; Tue, 25 May 2021 13:31:43 +0000
X-MS-PublicTrafficType: Email
X-IncomingHeaderCount: 46
X-EOPAttributedMessage: 0
X-MS-Office365-Filtering-Correlation-Id: c2e78fc3-28bd-459c-a835-08d91f81700d
X-MS-TrafficTypeDiagnostic: AM6EUR05HT208:
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: XIzSMZwXBUTqI0AXZC3faQhyT0Vcs6K34HA84ZzBzW9o1dxEFu+TIoNT22CzBPgxtvMKyoiEnpRbqhNfugpAb3CEgZbm+x9TSiFN6AKLAJoGwsltpo0rhrRd1InbGfw+tlNfsIMqVealeGfvdPHQ24//PwXRnx+moxFI/a1XEaaUcfdiMrynfw/SrWWMZH+3PWzp4uvCSoxSvRa2f5VAr27rO04HuNmnAohdSgBwx6A/dQckSVrgu0PCwsPEvEuH3FWn62ajvzFP2l94M4XcLJHkhYxiVJUiaLXaN7uhTOiAdqS8LoY1UsG6Ch302LbzQ5f5XQEl+EgQ57JhgVCqUQ2lJkR4Ma/ZDHreNqbzWtHHRbZnF8b8iJ+g8k37gWnG
X-MS-Exchange-AntiSpam-MessageData: 8VyF22cyVQ/ayvOo8NBbLpBk7iAIEUfS9lkyWoSj/ydyDzkwc55Np1c9xX5YsGO1Qu8AECfha5kLzGam0wYvOndVEFZiR+AGUnf5NEnd5LYbKZ9GvLrnPM2caduahXLVmyfoASBMOFhu5v6qj7JS8A==
X-OriginatorOrg: live.com
X-MS-Exchange-CrossTenant-Network-Message-Id: c2e78fc3-28bd-459c-a835-08d91f81700d
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 13:31:44.4913 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-AuthSource: AM6EUR05FT057.eop-eur05.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6EUR05HT208
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> Arthur Miller <arthur.miller@HIDDEN> writes:
>
>> Philip Kaludercic <philipk@HIDDEN> writes:
>>> +(defvar windmove-default-map (make-sparse-keymap)
>>> +  "Map used by `windmove-install-defaults'.")
>>
>> Sorry if I ask, but wouldn't ordinary windmove-mode-map do here?
>
> You are probably right -- my thought was that the minor mode exists for
> the sake of the map.

Yeah, exactly in this case. I am not sure if I understand correctly, you
mean people will set new map for the mode to change bindings?

I just remarked on the name you choose for the mode map, most peeps like
me probably expect it to be names after the convention 'modename-mode-map'.

>> Since it is a convention to have mode maps called modename-mode-maps,
>> if people would like to change, or add a binding in the windmove mode
>> they would probably automatically try to alter windmove-mode-map instead
>> of windmove-default-map.
>
> That's the question: should windmove-default-map be accessed by default
> or only via the -default-keybindings functions? Either way something

I think you are thinking about default keybindings reather than default
map. If I assume correctly. If I understand corectly you would like to
preserve some default bindings, the map is just a mean to accomplish it.

> should be changed, if windmove-default-map it should be renamed to
> windmove--default-map to explicitly mark it as an internal
> map. Otherwise it shsould be renamed to windmove-mode-map as you suggest.

Either use default map stored some "default var", and add a function
that restores mode map, or just add a function that resets keybindings
into mode map directly, which might be sufficient. I don't know matter
of taste? A default mode map in a variable is cleaner but more costly?

Emacs provides windows, so I think there should also be a default way of
moving cursor between them, manipulate them and so on. Thus I think
windmove operations should be on by default, I don't think C-x 1/2/3/o
are satisfying when we have more then 2 widows.

A minor mode is probably a good balance between altering Emacs defaults,
so not break someones config, and to give people an option to easily
turn on some useful feature/configuration.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 11:46:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 07:46:42 2021
Received: from localhost ([127.0.0.1]:44868 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llVWE-0001dO-Nx
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 07:46:42 -0400
Received: from mout02.posteo.de ([185.67.36.66]:58373)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1llVWB-0001d4-G2
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 07:46:41 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 2F14E2400FE
 for <41438 <at> debbugs.gnu.org>; Tue, 25 May 2021 13:46:32 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621943193; bh=57uF1vKPW9czuqotkSgpcuUEK60/K/IbGFFqzeHy20M=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=TR80/y/oZupaa+5UrBaLtE/1YDzJpiPokiX/IhtnzIP64Q1LjE42B/tC9J2Q4nX8A
 5hWWs1+x0BDEImQt0dZd3bd6b22BRrpYuAQp9gPe3zVrftazOeeRnClVE0feE0Zfnh
 mdDakQWP3a6ys8ij5VKwvr3yYiiOIfrpNocd1F9l9c0Y+I6iEuVOIMhtfZIprKXGjD
 iF9zE45hfrdVo15y/UOsyCmEmhukzvY4lSeV8lVbe2LzVIMQ2PGyg1BVVolaHM2c9L
 tzxFWYeL8ytW3UXwaTwvNkHpFarRofzE4tEvjoyp5yhVaWsduNAbb7NKBD9SM35xbB
 bpQg/lfCwhRNg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FqC3C6qtGz9rxf;
 Tue, 25 May 2021 13:46:31 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Arthur Miller <arthur.miller@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <AM9PR09MB4977C5430B63ABDFDB54131F96259@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 25 May 2021 11:46:31 +0000
In-Reply-To: <AM9PR09MB4977C5430B63ABDFDB54131F96259@HIDDEN>
 (Arthur Miller's message of "Tue, 25 May 2021 13:36:22 +0200")
Message-ID: <87mtsjghns.fsf@icterid>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Arthur Miller <arthur.miller@HIDDEN> writes:

> If you are already patching windmove.el, can you consider adding
> bindings for these funcitions too (defined in window.el):
>
> enlarge-window-horizontally
> shrink-window-horizontally
>
> As well as add these two wrappers for vertical operations:
>
> #+begin_src emacs-lisp
>
> ;;;###autoload
> (defun enlarge-window-vertically (delta)
>   "Make selected window DELTA columns wider.
> Interactively, if no argument is given, make selected window one
> column wider."
>   (interactive "p")
>   (enlarge-window delta nil))
>
> ;;;###autoload
> (defun shrink-window-vertically (delta)
>   "Make selected window DELTA columns narrower.
> Interactively, if no argument is given, make selected window one
> column narrower."
>   (interactive "p")
>   (shrink-window delta nil))
>
> #+end_src
>
> I have been using those for long time myself since I prefer to do
> everything from the keyboard. Maybe someone else finds them useful too;
> they have been in my config on GH for long time.

I am not sure if these commands should be added as part of the same
changeset. The point of this commit is to make configuring windmove keys
using windmove-default-keybindings & co. more consistent.

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 11:43:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 07:43:13 2021
Received: from localhost ([127.0.0.1]:44862 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llVSr-0001XR-4E
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 07:43:13 -0400
Received: from mout01.posteo.de ([185.67.36.65]:48843)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1llVSj-0001Ws-0C
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 07:43:12 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id AF50424002A
 for <41438 <at> debbugs.gnu.org>; Tue, 25 May 2021 13:42:58 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621942978; bh=xHYuraZUuITAKxINTlA2UMGUQzxhB99L90Vo6JQAfyA=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=N/yFrKBnt4s8EJlcQZTAt4GMq21a7NU85wdvRxopLB4nsBDoIdptw4pvBVzdyCCj0
 DcD5iXf0bmX0x9aclt2n/Lbgw1ppIwIbeYtrELWyUryEF/YWMEfxjWpV3ixcnzLkGG
 XPedNuygWxJijNwimKAo3r1R9mJAXTM/+E9Mezj+tFI0eqMxHvH0colJ0X9xjSr+fP
 /rbJY4qC4wbKR/ExR4dDUyStWkUz4Ty6lhJ975lemvijhH6E0xWswt06jwYgwd2/3n
 ySNKGHWy+LXZb0RkpIFlF45IWr0PQytkUQUaSQxA7HSixbXUz1ksLseHXXIlazug/p
 x4U2f96yRRnoA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FqBz51v7Nz6tmR;
 Tue, 25 May 2021 13:42:57 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Arthur Miller <arthur.miller@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
 <AM9PR09MB49778A8AC2A43FAA0AC6130A96259@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 25 May 2021 11:42:56 +0000
In-Reply-To: <AM9PR09MB49778A8AC2A43FAA0AC6130A96259@HIDDEN>
 (Arthur Miller's message of "Tue, 25 May 2021 13:16:24 +0200")
Message-ID: <87v977ghtr.fsf@icterid>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Arthur Miller <arthur.miller@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>> +(defvar windmove-default-map (make-sparse-keymap)
>> +  "Map used by `windmove-install-defaults'.")
>
> Sorry if I ask, but wouldn't ordinary windmove-mode-map do here?

You are probably right -- my thought was that the minor mode exists for
the sake of the map.

> Since it is a convention to have mode maps called modename-mode-maps,
> if people would like to change, or add a binding in the windmove mode
> they would probably automatically try to alter windmove-mode-map instead
> of windmove-default-map.

That's the question: should windmove-default-map be accessed by default
or only via the -default-keybindings functions? Either way something
should be changed, if windmove-default-map it should be renamed to
windmove--default-map to explicitly mark it as an internal
map. Otherwise it should be renamed to windmove-mode-map as you suggest.

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 11:36:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 07:36:35 2021
Received: from localhost ([127.0.0.1]:44854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llVMQ-0001NV-PF
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 07:36:35 -0400
Received: from mail-db8eur06olkn2043.outbound.protection.outlook.com
 ([40.92.51.43]:51296 helo=EUR06-DB8-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arthur.miller@HIDDEN>) id 1llVMN-0001NF-4v
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 07:36:33 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=bWFOIFbQWkpbq/IXTEWYO6fq7EXyy4xGXcHbGmPX0m1AA2+NS9fGqs76PQXxosVtJljiqWH64qoafwJqqBs3J3Vk8/aPVwHkFZy78C4iqqL4l5g8988l3UYX7SFPRs0N3uM9Of3wjvpsHg+xivR4Vzp1VUVF+In2yHKdSmRQv1orPJet8+tL5Oxwh8FAf1OuncUmOOO0g9CBcFB94e2Otd4vkWvPARclNNAGybgvg0ECc7BqIPxeYSVCucOONNwnCaOD4eQXfV65DuR9iU4W+GTqqAg1jj9L6YkIbqkmZR7ClO1UGeIxcUxPwLLY33nHCj8gX2bOojQPrWjmfVvPlw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=6hengJvTDhmbbE2Fj9rPFnw1lB0MURClMkU2m36Thiw=;
 b=lNJpDHwHcia63KT49XH7dgwQDvWhWf31YCrMQnCF5r/dt1ExsOjrc8181I3Mmf+J2F8kgXMS27dpkKLCIGKqHMfWBEgRSH3uKY5vNLyJyWm1bbxAsxST8zDxrrPt/+Q4pYE9joNLOzodCKYRRPnB6k7Ymeg63zRb2t0Km1Vep+0oyf4i+szMruWgyIxQ5+E+YqoV6grN0jWR5KKRIo5XQC50My9dSkepPqaIaseC9TIJedDIa/zZ+QbngL5IX94yFtgN53dBsZIcZEizVRkTgdxGh4aP9hvNWIp/mbN6d27Iu7TsfT22LWw0tDfODhMJsNDkSYvoCTkhvWcMUBUhZg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=6hengJvTDhmbbE2Fj9rPFnw1lB0MURClMkU2m36Thiw=;
 b=gJAR/2EkRiAjAeIP8DG/j3eeKvSgv8z55SZoud3YQsaA1R5PQvPlwukR4Lgcck8THzHXw3/XPMZaHn3CN6s/Zr+KSI2gp93bGVHuJgCwOkAPUFLCRWpT2NxQBr8XOfYc7jg4MszMKgAInIJ4QNJOTkOC1nwvABSeyVfGqOV0M96A9kMKngycNIX5iPhEcliZaBWLp/+OFcP1t9Ml0YNag76POQpN/gsgnWZi6Ac2H/P7JmPWcMDCzoI3J21plRdMW2FIRIybt6VCGfc9QDtfGFhxtEHZsf8J61ddiAB68fjgUOwAs0HtMy5vwAqshuLJULP/QybgmGTcaR/Ewm1oBw==
Received: from AM7EUR06FT061.eop-eur06.prod.protection.outlook.com
 (2a01:111:e400:fc36::44) by
 AM7EUR06HT146.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc36::272)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Tue, 25 May
 2021 11:36:24 +0000
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 (2a01:111:e400:fc36::44) by AM7EUR06FT061.mail.protection.outlook.com
 (2a01:111:e400:fc36::95) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend
 Transport; Tue, 25 May 2021 11:36:24 +0000
X-IncomingTopHeaderMarker: OriginalChecksum:CB37B0564746345B64F3AE74241FDD9743D14843020C892A17B157A1C05F0A30;
 UpperCasedChecksum:973D12E0E1AA1793FFFB7A8762F4F2C5FF48E00F1CB708F11E91F4DB804C0C1F;
 SizeAsReceived:7634; Count:46
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591]) by AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021
 11:36:23 +0000
From: Arthur Miller <arthur.miller@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
Date: Tue, 25 May 2021 13:36:22 +0200
In-Reply-To: <87im37p2b4.fsf@icterid> (Philip Kaludercic's message of "Tue, 25
 May 2021 09:53:19 +0000")
Message-ID: <AM9PR09MB4977C5430B63ABDFDB54131F96259@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)
Content-Type: text/plain
X-TMN: [g4dgrWknOIC8uCvOpvlAv+KbKxVu86du]
X-ClientProxiedBy: AM6PR08CA0016.eurprd08.prod.outlook.com
 (2603:10a6:20b:b2::28) To AM9PR09MB4977.eurprd09.prod.outlook.com
 (2603:10a6:20b:304::20)
X-Microsoft-Original-Message-ID: <82pmxfniyx.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from HP-Laptop.homepc (81.232.177.30) by
 AM6PR08CA0016.eurprd08.prod.outlook.com (2603:10a6:20b:b2::28) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.4150.23 via Frontend Transport; Tue, 25 May 2021 11:36:23 +0000
X-MS-PublicTrafficType: Email
X-IncomingHeaderCount: 46
X-EOPAttributedMessage: 0
X-MS-Office365-Filtering-Correlation-Id: 6f292078-fbbc-4ecc-0fb1-08d91f715318
X-MS-TrafficTypeDiagnostic: AM7EUR06HT146:
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: h8fKnjLJE0aLEUX4AzHc0wbkUdSM1t/GTGD35bBgmyHijEEswu9vqNFJzIxVNst/lKaVwnw4SDVxYQ5/jVGE6PS0VrRjOVfBUeICBcTrGccBxl6czxtgB/NwzhUF86OgFyz80p+ou1KXXhl2YxLZrVjg7eZWbmNtpp6952AHlPbkApPe+nhh0JMAjBVmkiIumEO+SWcve6fsfQAOiONk1dBs0YOiwtLrtst4FYSYrj08UEUOTKJHtl/mvJxyTxr3tfRxd0TR+nW7MKFSomNpMMUieVDujy1crKIsZ2G2W7xiK0ou+W16/DmLtlvgZakPkKNfjffUGpUodFDQGN30fYW26w4iYK3JgwP+qmAUee6VvpdbfVmd8ZnH/rnxVSwj7jTEOjgWMrrXA+Z/GBPtKg==
X-MS-Exchange-AntiSpam-MessageData: 9yKzkfjoPrDjsSVd1CJjz+ztHvocDH2XcDqKjy+XAKxjCq+zKtin0n/q9zRBTfkjXhCj+tpTY3gZfz23+Mm9nuGSPZq54xT5v4cj/PaDfXBywFRwdcHLgpRe3JXP6Ds3MZBXagWDFE0o1N08+2e9SA==
X-OriginatorOrg: live.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 6f292078-fbbc-4ecc-0fb1-08d91f715318
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 11:36:23.9429 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-AuthSource: AM7EUR06FT061.eop-eur06.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7EUR06HT146
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

If you are already patching windmove.el, can you consider adding
bindings for these funcitions too (defined in window.el):

enlarge-window-horizontally
shrink-window-horizontally

As well as add these two wrappers for vertical operations:

#+begin_src emacs-lisp

;;;###autoload
(defun enlarge-window-vertically (delta)
  "Make selected window DELTA columns wider.
Interactively, if no argument is given, make selected window one
column wider."
  (interactive "p")
  (enlarge-window delta nil))

;;;###autoload
(defun shrink-window-vertically (delta)
  "Make selected window DELTA columns narrower.
Interactively, if no argument is given, make selected window one
column narrower."
  (interactive "p")
  (shrink-window delta nil))

#+end_src

I have been using those for long time myself since I prefer to do
everything from the keyboard. Maybe someone else finds them useful too;
they have been in my config on GH for long time.

> Lars Ingebrigtsen <larsi@HIDDEN> writes:
>
>> Philip Kaludercic <philipk@HIDDEN> writes:
>>
>>> The code should probably be refactored, moving more of the common
>>> functionality into it's own function, but I am primarily wondering if
>>> using emulation-mode-map-alists the way I am proposing it here is ok. Or
>>> should I prefer minor-mode-map-alist?
>>
>> Making windmove into a regular (global) minor mode would be less
>> surprising, I think, but I'm not really familiar with windmove, and
>> whether that would be an easy rewrite?
>
> I have tried this out, and it seems somewhat elegant.  From my testing,
> it seems to behave the same way as the previous approach.
>
> -- 
> 	Philip K.
>
> From 2f7a8d89cdb5835cf875bc1f2bcfcb6755a0e0c0 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk@HIDDEN>
> Date: Tue, 25 May 2021 11:47:51 +0200
> Subject: [PATCH] Improve windmove-*-default-keybindings fuctions
>
> * windmove.el (windmove-default-map): Add special map for windmove
> commands
> (windmove-mode): Add minor mode for activating windmove-default-map
> (windmove-install-defaults): Add general function for manipulating
> windmove-default-map
> (windmove-default-keybindings): Use windmove-install-defaults
> (windmove-display-default-keybindings): Use windmove-install-defaults
> (windmove-delete-default-keybindings): Use windmove-install-defaults
> (windmove-swap-states-default-keybindings): Use
> windmove-install-defaults
> ---
>  lisp/windmove.el | 84 ++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 63 insertions(+), 21 deletions(-)
>
> diff --git a/lisp/windmove.el b/lisp/windmove.el
> index e4ea8e0f69..5a81893bf9 100644
> --- a/lisp/windmove.el
> +++ b/lisp/windmove.el
> @@ -426,19 +426,46 @@ windmove-down
>  ;; I don't think these bindings will work on non-X terminals; you
>  ;; probably want to use different bindings in that case.
>  
> +(defvar windmove-default-map (make-sparse-keymap)
> +  "Map used by `windmove-install-defaults'.")
> +
> +(define-minor-mode windmove-mode
> +  "Global minor mode for default windmove commands."
> +  :keymap windmove-default-map
> +  :init-value t
> +  :global t)
> +
> +(defun windmove-install-defaults (modifiers alist)
> +  "Install keys as specified by ALIST.
> +Every element of ALIST has the form (FN KEY), where KEY is
> +appended to MODIFIERS, before installing the key.  Previous
> +bindings of FN are unbound."
> +  (dolist (bind alist)
> +    (when (or (memq (cadr bind) '(left right up down))
> +              (not (null modifiers)))
> +      (dolist (old (where-is-internal (car bind) windmove-default-map))
> +        (define-key windmove-default-map old nil))
> +      (define-key windmove-default-map
> +        (vector (append modifiers (cdr bind)))
> +        (car bind)))))
> +
>  ;;;###autoload
>  (defun windmove-default-keybindingsq (&optional modifiers)
>    "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)
> -  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
> -  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-left left)
> +                               (windmove-right right)
> +                               (windmove-up up)
> +                               (windmove-down down))))
>  
>  
>  ;;; Directional window display and selection
> @@ -546,17 +573,21 @@ 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)
> -  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
> -  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
> -  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
> -  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
> -  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-display-left left)
> +                               (windmove-display-right right)
> +                               (windmove-display-up up)
> +                               (windmove-display-down down)
> +                               (windmove-display-same-window ?0)
> +                               (windmove-display-new-frame ?f)
> +                               (windmove-display-new-tab ?t))))
>  
>  
>  ;;; Directional window deletion
> @@ -618,16 +649,22 @@ 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)
> -  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
> -  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-delete-left left)
> +                               (windmove-delete-right right)
> +                               (windmove-delete-up up)
> +                               (windmove-delete-down down))))
>  
>  
>  ;;; Directional window swap states
> @@ -673,14 +710,19 @@ 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)
> -  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
> -  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-swap-states-left left)
> +                               (windmove-swap-states-right right)
> +                               (windmove-swap-states-up up)
> +                               (windmove-swap-states-down down))))
>  
>  
>  (provide 'windmove)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 11:16:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 07:16:38 2021
Received: from localhost ([127.0.0.1]:44832 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llV37-000783-RX
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 07:16:38 -0400
Received: from mail-am7eur06olkn2024.outbound.protection.outlook.com
 ([40.92.16.24]:50483 helo=EUR06-AM7-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arthur.miller@HIDDEN>) id 1llV32-00077l-Mx
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 07:16:36 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Wfb+gKw8dHBixP3VOYjq5149iF17WZuWwczX3dKxbWM1Dibx+s0zpbQ+DJYqRytb5RMlc/SsoIkssDSt30vzl1PcBqflgc22v59FJOsP97G/Rj4cqWfQXMgMXcYaK6UK22yQRYk5lxlDTOUyT/jXs4XFcK8iuf/VBI4c5z/VyYSC42zZKd1l8sUqHnYdMJ4D0yfyv6g3BVLvjIP/e1sHIOW5Mx6K5j4qEpdGU1xAG/sjMl+TH0lsaMkRCDKfJYgWC0UCe8ZMf+XCRY3OiwmZRaU7DIUDInd3dwEwMLUviIop5fFCWK5RO0dcBQUCIJF51O9gHhx0c5jYdt/bvslBXw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=0j+q66QyRhwWCVv8+IoTSJgZbfN25htBLxDpR71A4kw=;
 b=i3ghvAYQWvDJaQCAtWiw9wRYxtCb940zxKekFkq/jjfoe6PekpWBgbyPfNLWMBsVLvv2NN4WMdFWI7Pn0lZ3GdKQWyRhO9vC2hGdDdN71mpmhJgBT6kYuKHENG4PeN9tI52XK3Sk0FY9t48QW+ZmqglwgOnSxW5kqjVocV3I/YoN1S0/S5naFsdhVOIFCD/36yPhzaxTlo9XfAXmjNSv15cYeleIJq3Kc9wzBSDDZNIOF1qguQB7qcSDrKsOyLAJALUfs1dfYUYQoWtzsdUcCIRQ15HHcw9a2GXdPTf1lyrV9wAIjNOAEM2cABDMNbsS4/2daY7px2BlY6GEoD8NEw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=0j+q66QyRhwWCVv8+IoTSJgZbfN25htBLxDpR71A4kw=;
 b=noi12zrxno+tAN9cy315BegGJFH69bhTP+CM3gN82Ke6xUxVCsSt2zUDe0GzZ+32+chem+bmNuNUJkn4m2hwgtYPHfrvQDxyH+EhP2LTUbTcmOH6S7pPppQHeaAQIRc7b4F5MyF108LXfhoNxvYSWwBp4vBOZL9GUKjy0Srz5WC+RgzkatAxHJ7LpnZ51P3GZr0F1XmM+tAmmUJkSdU9dc54P3PcqcJiqmv9De99d4PzbOEGisxnCtXmcpubZGTI9PY37aIj2oaXoAhXlodDniFIE5Z11A9ixVbxq93UkYSHsGlXFZmFoiNE6vNnxMsLaWkgf19gfjg5Z+c3/B+kQQ==
Received: from DB8EUR06FT046.eop-eur06.prod.protection.outlook.com
 (2a01:111:e400:fc35::4a) by
 DB8EUR06HT191.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::276)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Tue, 25 May
 2021 11:16:25 +0000
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 (2a01:111:e400:fc35::40) by DB8EUR06FT046.mail.protection.outlook.com
 (2a01:111:e400:fc35::122) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend
 Transport; Tue, 25 May 2021 11:16:25 +0000
X-IncomingTopHeaderMarker: OriginalChecksum:F1C573E1F81094F6B3745700D42220FC752662275D0B606CEE8282180FE33D4D;
 UpperCasedChecksum:F4A1EAF488D3641F07CF29B63880487FE308B0C23D2A2C1E42D56D769E6D9887;
 SizeAsReceived:7646; Count:46
Received: from AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591]) by AM9PR09MB4977.eurprd09.prod.outlook.com
 ([fe80::d1c1:2a0d:3b2b:4591%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021
 11:16:25 +0000
From: Arthur Miller <arthur.miller@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN> <87im37p2b4.fsf@icterid>
Date: Tue, 25 May 2021 13:16:24 +0200
In-Reply-To: <87im37p2b4.fsf@icterid> (Philip Kaludercic's message of "Tue, 25
 May 2021 09:53:19 +0000")
Message-ID: <AM9PR09MB49778A8AC2A43FAA0AC6130A96259@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)
Content-Type: text/plain
X-TMN: [XwJF/sVTRxa5Ph01hXAaNPqBQydUqMRM]
X-ClientProxiedBy: AS8PR04CA0107.eurprd04.prod.outlook.com
 (2603:10a6:20b:31e::22) To AM9PR09MB4977.eurprd09.prod.outlook.com
 (2603:10a6:20b:304::20)
X-Microsoft-Original-Message-ID: <82tumrnjw7.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from HP-Laptop.homepc (81.232.177.30) by
 AS8PR04CA0107.eurprd04.prod.outlook.com (2603:10a6:20b:31e::22) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend
 Transport; Tue, 25 May 2021 11:16:25 +0000
X-MS-PublicTrafficType: Email
X-IncomingHeaderCount: 46
X-EOPAttributedMessage: 0
X-MS-Office365-Filtering-Correlation-Id: 8ec10266-e156-49be-6e11-08d91f6e88c8
X-MS-TrafficTypeDiagnostic: DB8EUR06HT191:
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: 3T6GXinqHYPrlYU5DcxYnd2aDStaguWNTAzy6G/wt3CFGMVKE2TlkuprdOdvF4ac72u5415Qs4CbWgtJSrw9z/x52nePnkZO5v0FAl/HHg3uGb3CCwiTbpr4Sz2BG7qJq1BdZtt55szhVzz6rrRzqX9YuiHV89LyeiOLfySpQ8tEEowiETtO+VzMKYGBOYyh2NsZ3ZN+2YQhcYtIZFq9SYujVTYZip+veNg3vrS4ttJJpNnwo9k9uOwrSV8sODmjX6HjNrA4MR1MAM2GcKVdlpDiz10DmMjLwSpCv+YrIkcjXrxvRr6OIGiltFE9R/h/SVJHeMVlI+4qgJ2T0tsrUGTO4RoOqtYikwAAuzG9l5LncWcKVvLLN8oN4yqWZO/7rVuQ/ac67/Kz8VK8Yk3dqA==
X-MS-Exchange-AntiSpam-MessageData: isvcmW9LEFpr9bbG3gN+Z4YdZheRj+fSB9fxJYnNeSKlxK1rKDEcFq3yAAIbZ8j84EKMJrAvyQSeSK0nUIvgUcbDrPKLwq+nP6LF9YdZICTEeRJgQhA45SuWqi+YIGdDGZKCnXmxwLAcfuE1lIZvaw==
X-OriginatorOrg: live.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 8ec10266-e156-49be-6e11-08d91f6e88c8
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 11:16:25.5975 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-AuthSource: DB8EUR06FT046.eop-eur06.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR06HT191
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> Lars Ingebrigtsen <larsi@HIDDEN> writes:
>
>> Philip Kaludercic <philipk@HIDDEN> writes:
>>
>>> The code should probably be refactored, moving more of the common
>>> functionality into it's own function, but I am primarily wondering if
>>> using emulation-mode-map-alists the way I am proposing it here is ok. Or
>>> should I prefer minor-mode-map-alist?
>>
>> Making windmove into a regular (global) minor mode would be less
>> surprising, I think, but I'm not really familiar with windmove, and
>> whether that would be an easy rewrite?
>
> I have tried this out, and it seems somewhat elegant.  From my testing,
> it seems to behave the same way as the previous approach.
>
> -- 
> 	Philip K.
>
> From 2f7a8d89cdb5835cf875bc1f2bcfcb6755a0e0c0 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk@HIDDEN>
> Date: Tue, 25 May 2021 11:47:51 +0200
> Subject: [PATCH] Improve windmove-*-default-keybindings fuctions
>
> * windmove.el (windmove-default-map): Add special map for windmove
> commands
> (windmove-mode): Add minor mode for activating windmove-default-map
> (windmove-install-defaults): Add general function for manipulating
> windmove-default-map
> (windmove-default-keybindings): Use windmove-install-defaults
> (windmove-display-default-keybindings): Use windmove-install-defaults
> (windmove-delete-default-keybindings): Use windmove-install-defaults
> (windmove-swap-states-default-keybindings): Use
> windmove-install-defaults
> ---
>  lisp/windmove.el | 84 ++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 63 insertions(+), 21 deletions(-)
>
> diff --git a/lisp/windmove.el b/lisp/windmove.el
> index e4ea8e0f69..5a81893bf9 100644
> --- a/lisp/windmove.el
> +++ b/lisp/windmove.el
> @@ -426,19 +426,46 @@ windmove-down
>  ;; I don't think these bindings will work on non-X terminals; you
>  ;; probably want to use different bindings in that case.
>  
> +(defvar windmove-default-map (make-sparse-keymap)
> +  "Map used by `windmove-install-defaults'.")
Sorry if I ask, but wouldn't ordinary windmove-mode-map do here?

Since it is a convention to have mode maps called modename-mode-maps,
if people would like to change, or add a binding in the windmove mode
they would probably automatically try to alter windmove-mode-map instead
of windmove-default-map.


> +(define-minor-mode windmove-mode
> +  "Global minor mode for default windmove commands."
> +  :keymap windmove-default-map
> +  :init-value t
> +  :global t)
> +
> +(defun windmove-install-defaults (modifiers alist)
> +  "Install keys as specified by ALIST.
> +Every element of ALIST has the form (FN KEY), where KEY is
> +appended to MODIFIERS, before installing the key.  Previous
> +bindings of FN are unbound."
> +  (dolist (bind alist)
> +    (when (or (memq (cadr bind) '(left right up down))
> +              (not (null modifiers)))
> +      (dolist (old (where-is-internal (car bind) windmove-default-map))
> +        (define-key windmove-default-map old nil))
> +      (define-key windmove-default-map
> +        (vector (append modifiers (cdr bind)))
> +        (car bind)))))
> +
>  ;;;###autoload
>  (defun windmove-default-keybindingsq (&optional modifiers)
>    "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)
> -  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
> -  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-left left)
> +                               (windmove-right right)
> +                               (windmove-up up)
> +                               (windmove-down down))))
>  
>  
>  ;;; Directional window display and selection
> @@ -546,17 +573,21 @@ 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)
> -  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
> -  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
> -  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
> -  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
> -  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-display-left left)
> +                               (windmove-display-right right)
> +                               (windmove-display-up up)
> +                               (windmove-display-down down)
> +                               (windmove-display-same-window ?0)
> +                               (windmove-display-new-frame ?f)
> +                               (windmove-display-new-tab ?t))))
>  
>  
>  ;;; Directional window deletion
> @@ -618,16 +649,22 @@ 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)
> -  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
> -  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-delete-left left)
> +                               (windmove-delete-right right)
> +                               (windmove-delete-up up)
> +                               (windmove-delete-down down))))
>  
>  
>  ;;; Directional window swap states
> @@ -673,14 +710,19 @@ 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)
> -  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
> -  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
> +  (windmove-install-defaults modifiers
> +                             '((windmove-swap-states-left left)
> +                               (windmove-swap-states-right right)
> +                               (windmove-swap-states-up up)
> +                               (windmove-swap-states-down down))))
>  
>  
>  (provide 'windmove)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 09:53:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 05:53:33 2021
Received: from localhost ([127.0.0.1]:44750 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llTki-0004cB-J3
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 05:53:33 -0400
Received: from mout01.posteo.de ([185.67.36.65]:35663)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1llTkd-0004bt-Be
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 05:53:31 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 1816B240027
 for <41438 <at> debbugs.gnu.org>; Tue, 25 May 2021 11:53:20 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621936401; bh=1Yca4NVHBbL6cyhhWEK7syiugGhnk3xHMmaQSKjTYEA=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=k2Tl4/5xScOCYCvPHnQme6q7f97Ub12mFM8/WKKx2dsrmETAxWwzIRLV31KXelBFg
 lbu6L0ybrwgHu+vnBILDdidVRMxm7Y9CfAUWam1xXu15AVP4+WPEB2Z3lsxxwD6w1k
 J2FupvF1L4vudcVHCGdJBBN+bVFuznUWmNSNIERSnC1CdYNTH7FdqDDnBEuP/yo5ZK
 SO65mTiwswA3vJBbO9MPtzJRymHJx1syy+0eaFjycg/Ma03DZDey0DIckUSuqDCnvX
 mI4tru+ibJJu+qoM1rAPLtUchYi+j9SVRBSfvUFRl9ksC4kqoOi691M4fMZZTz1uhw
 e6DgK4XJnTQkQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Fq8Xc0wN3z9rxQ;
 Tue, 25 May 2021 11:53:20 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 25 May 2021 09:53:19 +0000
In-Reply-To: <87h7irqtvf.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 25 May 2021 07:12:36 +0200")
Message-ID: <87im37p2b4.fsf@icterid>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> The code should probably be refactored, moving more of the common
>> functionality into it's own function, but I am primarily wondering if
>> using emulation-mode-map-alists the way I am proposing it here is ok. Or
>> should I prefer minor-mode-map-alist?
>
> Making windmove into a regular (global) minor mode would be less
> surprising, I think, but I'm not really familiar with windmove, and
> whether that would be an easy rewrite?

I have tried this out, and it seems somewhat elegant.  From my testing,
it seems to behave the same way as the previous approach.

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Improve-windmove-default-keybindings-fuctions.patch

From 2f7a8d89cdb5835cf875bc1f2bcfcb6755a0e0c0 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Tue, 25 May 2021 11:47:51 +0200
Subject: [PATCH] Improve windmove-*-default-keybindings fuctions

* windmove.el (windmove-default-map): Add special map for windmove
commands
(windmove-mode): Add minor mode for activating windmove-default-map
(windmove-install-defaults): Add general function for manipulating
windmove-default-map
(windmove-default-keybindings): Use windmove-install-defaults
(windmove-display-default-keybindings): Use windmove-install-defaults
(windmove-delete-default-keybindings): Use windmove-install-defaults
(windmove-swap-states-default-keybindings): Use
windmove-install-defaults
---
 lisp/windmove.el | 84 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 63 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..5a81893bf9 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,46 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-default-map (make-sparse-keymap)
+  "Map used by `windmove-install-defaults'.")
+
+(define-minor-mode windmove-mode
+  "Global minor mode for default windmove commands."
+  :keymap windmove-default-map
+  :init-value t
+  :global t)
+
+(defun windmove-install-defaults (modifiers alist)
+  "Install keys as specified by ALIST.
+Every element of ALIST has the form (FN KEY), where KEY is
+appended to MODIFIERS, before installing the key.  Previous
+bindings of FN are unbound."
+  (dolist (bind alist)
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-default-map))
+        (define-key windmove-default-map old nil))
+      (define-key windmove-default-map
+        (vector (append modifiers (cdr bind)))
+        (car bind)))))
+
 ;;;###autoload
 (defun windmove-default-keybindingsq (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-left left)
+                               (windmove-right right)
+                               (windmove-up up)
+                               (windmove-down down))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +573,21 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (windmove-install-defaults modifiers
+                             '((windmove-display-left left)
+                               (windmove-display-right right)
+                               (windmove-display-up up)
+                               (windmove-display-down down)
+                               (windmove-display-same-window ?0)
+                               (windmove-display-new-frame ?f)
+                               (windmove-display-new-tab ?t))))
 
 
 ;;; Directional window deletion
@@ -618,16 +649,22 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-delete-left left)
+                               (windmove-delete-right right)
+                               (windmove-delete-up up)
+                               (windmove-delete-down down))))
 
 
 ;;; Directional window swap states
@@ -673,14 +710,19 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-swap-states-left left)
+                               (windmove-swap-states-right right)
+                               (windmove-swap-states-up up)
+                               (windmove-swap-states-down down))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 07:25:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 03:25:23 2021
Received: from localhost ([127.0.0.1]:44550 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llRRK-00013A-Jy
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 03:25:23 -0400
Received: from mout02.posteo.de ([185.67.36.66]:46321)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1llRRI-00012t-GC
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 03:25:21 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 026772400E5
 for <41438 <at> debbugs.gnu.org>; Tue, 25 May 2021 09:25:13 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621927514; bh=68dTJRDeJqr3cU8g/H72gI+Y5JYcxmbhbOgvgKvTGvU=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=Hpew7Kt5ZkVnIAGVFoTYUUzUDp41h0hyletEah+WVXYoyGmsob5m2tD1PmyecnTqp
 44UBVaUX00H4NLtCvOgC3w2D7gSDJuzsz3vJ6q13sB497/0QH2ZpD4HpzryhyrRi9X
 N4wIiYaDCryOkqjvfgUVuXSyDcJIqNr8fdKwLOsubyeTaBa6azq6I44jIJBHFVfkqN
 /Lm4ngdetYT87fkxXbDQFjxHuqDJNZtwb+MQpUkantUPsDmIEm3z/t/6tDBtKEFTiu
 UhknVuS32lZ3Hnj2sUgSwyAjSK5OvYWel/1c+Mwis72ovyNyJTllgOOkwj/FLvFqvj
 bUT53nMmLLgcQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Fq5Fg6Sngz6tmL;
 Tue, 25 May 2021 09:25:11 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87h7irqtvf.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 25 May 2021 07:25:10 +0000
In-Reply-To: <87h7irqtvf.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 25 May 2021 07:12:36 +0200")
Message-ID: <87v977p961.fsf@icterid>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> The code should probably be refactored, moving more of the common
>> functionality into it's own function, but I am primarily wondering if
>> using emulation-mode-map-alists the way I am proposing it here is ok. Or
>> should I prefer minor-mode-map-alist?
>
> Making windmove into a regular (global) minor mode would be less
> surprising, I think, but I'm not really familiar with windmove, and
> whether that would be an easy rewrite?

From my experience, it should be possible, I'll try preparing a
patch. The only issue is that most people won't realize there is a minor
mode at first, but that should be OK as long as the actual windmove
commands do not depend on said minor mode.

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 25 May 2021 05:12:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 01:12:47 2021
Received: from localhost ([127.0.0.1]:44416 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llPN1-0006FF-5U
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 01:12:47 -0400
Received: from quimby.gnus.org ([95.216.78.240]:40596)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1llPMz-0006F1-Is
 for 41438 <at> debbugs.gnu.org; Tue, 25 May 2021 01:12:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=1oUQOPOCUo2176o/iFDJ5KWCQnIZTUCl5Gn4CaQerC4=; b=n3Vmw3v21siwLaVWbuWWcOiRrf
 DSZtYkCuEUxwMg1DxI4bsta8MVItAtgIceCtPLi1W5yjrpdYmq3QFG/Q88iJZvyyLjARWyyXCSRq0
 PN40lI6F2EiYRwgHYZy94yXn4XMomK0hJZLFlFMFEzq1zMgVDtMjHKv8k8dXwPjeT6n4=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1llPMq-0003tG-H2; Tue, 25 May 2021 07:12:38 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIVBMVEUGCAkbIyFcYl8r
 MS6QmZU6SkOrr6t1gXzN3dtukYz///8EiMvvAAAAAWJLR0QKaND0VgAAAAlwSFlzAAAOdAAADnQB
 aySz1gAAAAd0SU1FB+UFGQUFJsYdBKcAAAGdSURBVDjLzZM7c8IwDMelGOgqE2BOgeaOzeE1cwHa
 jiE8ukIIuX4A+g06ZO7Qu37byrk8DAdTl2pwYv3kv2XJBvhPJu/40VJ3gJiZ03a/iusafuENk14x
 qRlaluMIN6JczNCqz5oAmzgAoEut+kyw00rm11piD2st4sZ0qYV7qGc7bBKHx7ACB8RAf5WVLAEe
 Si1xHMkJSrA9Qvdkah0YchhmhyVD6wgoV0heNiGoBQU4cVVRyiyB1trQWgISIyACEVkOjArgayAI
 bAKXLKc6elYF1D2qzcAEffYSL2IhZhcgN5eTbhhgp1cITwsxCCowzSsQ6bFjdKqTK9JtkO9qgoYO
 Fac8igyg+KL16SZQrSLLadkmXU5RP8E1GAHVHDqXAuPihyTZalwIUQUAPZLlReT6lsD2qjQAsSwc
 NPlEU1/lichzCYYK7PZrGgUZkb72ZfehrWAi7bf3NFpx7xngZOHniybhdtsdPKdxD+lJuPFjoRYu
 Bkkc/3yn6WdP7ooXoVd8hIvui5uyzdF8n6j4Wkl7FC6+4Lbde81/sV84Yjaa7jwOHAAAACV0RVh0
 ZGF0ZTpjcmVhdGUAMjAyMS0wNS0yNVQwNTowNTozNyswMDowMDt1g2MAAAAldEVYdGRhdGU6bW9k
 aWZ5ADIwMjEtMDUtMjVUMDU6MDU6MzcrMDA6MDBKKDvfAAAAAElFTkSuQmCC
X-Now-Playing: Seefeel's _(Ch-Vox) Redux_: "Net"
Date: Tue, 25 May 2021 07:12:36 +0200
In-Reply-To: <871r9yjyv5.fsf@HIDDEN> (Philip Kaludercic's message of "Sat, 
 22 May 2021 20:29:50 +0000")
Message-ID: <87h7irqtvf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Philip Kaludercic <philipk@HIDDEN> writes: > The code
 should probably be refactored, moving more of the common > functionality into
 it's own function,
 but I am primarily wondering if > using emulation-mode-map-alists
 the way I am proposing it [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> The code should probably be refactored, moving more of the common
> functionality into it's own function, but I am primarily wondering if
> using emulation-mode-map-alists the way I am proposing it here is ok. Or
> should I prefer minor-mode-map-alist?

Making windmove into a regular (global) minor mode would be less
surprising, I think, but I'm not really familiar with windmove, and
whether that would be an easy rewrite?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 23 May 2021 12:36:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 23 08:36:54 2021
Received: from localhost ([127.0.0.1]:40799 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lknLh-0005fR-Sn
	for submit <at> debbugs.gnu.org; Sun, 23 May 2021 08:36:54 -0400
Received: from mout02.posteo.de ([185.67.36.66]:52441)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lknLf-0005fC-6F
 for 41438 <at> debbugs.gnu.org; Sun, 23 May 2021 08:36:52 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id DD58F2400FD
 for <41438 <at> debbugs.gnu.org>; Sun, 23 May 2021 14:36:44 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621773404; bh=VcnGaiIqicbJ8TQQwTvf7iv9jA8OoSx2js/xFA7oe/4=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=JBu7K6hgzcG8icKakBCpuPxGbynbAegcSOkbRaeupj78MRohlk02O4Q12ieCwjOD7
 Ia6fJyDN6Ce5LBZlAUq9hdhlJsQhQDZX9qndlXqTTT8fLmkO6h9oCnx1SuQMQAq+It
 CaExdEGbLUcYJoQwhgChVikUHUzBq7xbkQ90iHEHT25Y71cP07dxMq1Fh0AekJ8WSS
 Nd6aWV39ugXmzLQ2+LZU8HXRVkjsAzaUf9L+Y+0tho+3+vXYqMFgzy5YslIO5M4uM4
 L5qdV6c4qmUljzQCxKgl5J19H27id3+SeNdEgLqyU7HDfrKEmtv1W0tyrV/jzm7Agk
 Px45wzLNfV4MQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Fp0G36k6Hz6tm9;
 Sun, 23 May 2021 14:36:43 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87cztizdar.fsf@HIDDEN> <83eedyj66h.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 23 May 2021 12:36:43 +0000
In-Reply-To: <83eedyj66h.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 23 May
 2021 09:49:26 +0300")
Message-ID: <87im39y6ck.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, larsi@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Philip Kaludercic <philipk@HIDDEN>
>> Date: Sat, 22 May 2021 21:09:00 +0000
>> Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
>> 
>> Philip Kaludercic <philipk@HIDDEN> writes:
>> 
>> > The code should probably be refactored, moving more of the common
>> > functionality into it's own function, but I am primarily wondering if
>> > using emulation-mode-map-alists the way I am proposing it here is ok. Or
>> > should I prefer minor-mode-map-alist?
>> 
>> Here is a slightly cleaner version.
>
> Thanks.  Should this be in NEWS?

I think so. IIRC the plan was to add a few additional user options to
make it easier to configure.

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 23 May 2021 06:49:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 23 02:49:32 2021
Received: from localhost ([127.0.0.1]:40510 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lkhvY-0000zy-6f
	for submit <at> debbugs.gnu.org; Sun, 23 May 2021 02:49:32 -0400
Received: from eggs.gnu.org ([209.51.188.92]:44826)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1lkhvW-0000zm-NO
 for 41438 <at> debbugs.gnu.org; Sun, 23 May 2021 02:49:31 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:54304)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1lkhvP-00086h-Fw; Sun, 23 May 2021 02:49:23 -0400
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2127
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1lkhvO-0002g2-1c; Sun, 23 May 2021 02:49:23 -0400
Date: Sun, 23 May 2021 09:49:26 +0300
Message-Id: <83eedyj66h.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
In-Reply-To: <87cztizdar.fsf@HIDDEN> (message from Philip Kaludercic on
 Sat, 22 May 2021 21:09:00 +0000)
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without prefix
 or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
 <87cztizdar.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, larsi@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Philip Kaludercic <philipk@HIDDEN>
> Date: Sat, 22 May 2021 21:09:00 +0000
> Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
> 
> Philip Kaludercic <philipk@HIDDEN> writes:
> 
> > The code should probably be refactored, moving more of the common
> > functionality into it's own function, but I am primarily wondering if
> > using emulation-mode-map-alists the way I am proposing it here is ok. Or
> > should I prefer minor-mode-map-alist?
> 
> Here is a slightly cleaner version.

Thanks.  Should this be in NEWS?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 22 May 2021 21:09:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 22 17:09:10 2021
Received: from localhost ([127.0.0.1]:40163 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lkYru-0003Rw-9Z
	for submit <at> debbugs.gnu.org; Sat, 22 May 2021 17:09:10 -0400
Received: from mout02.posteo.de ([185.67.36.66]:59119)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lkYrs-0003Ri-76
 for 41438 <at> debbugs.gnu.org; Sat, 22 May 2021 17:09:09 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id F182E2400E5
 for <41438 <at> debbugs.gnu.org>; Sat, 22 May 2021 23:09:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621717742; bh=90yjB0xaAuFrKZVti1RLPzW3sjbPdj0PQNeC2IbZ7vE=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=D5B8J/GaWRDJW26+PfEZShFBklMIv2Ir0WYCOeIBdhWjjo/AjRRWT5lO1RlvRMK6Z
 on6zoF4UjFQmr1feyUcZjC9h61y8PO256weEYLafUEeYsYq35vSm3sJkeXq+DpPJMK
 rrUPYnlgWkzjeaL1rcthLQzsDjVjFpYJFkPdLoiD36qmIRjHZADv2ag8TCHjQB968M
 QdsD01vvun0mNL2tb0s61NGlnqpPfMqXKX3MhGOFeuxn1UHMsLQsF/BPLUYRK9CbNP
 G/kDnKTuaRriJXjVp4S9D6lO0S8N8ctWS0uzaNuiW+hGNmR0v8z/bw2mlQsz4XXFGW
 64DdFYgV4NroQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Fnbgc5YkYz9rxG;
 Sat, 22 May 2021 23:09:00 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN> <871r9yjyv5.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sat, 22 May 2021 21:09:00 +0000
In-Reply-To: <871r9yjyv5.fsf@HIDDEN> (Philip Kaludercic's message of "Sat, 
 22 May 2021 22:29:50 +0200")
Message-ID: <87cztizdar.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain


Philip Kaludercic <philipk@HIDDEN> writes:

> The code should probably be refactored, moving more of the common
> functionality into it's own function, but I am primarily wondering if
> using emulation-mode-map-alists the way I am proposing it here is ok. Or
> should I prefer minor-mode-map-alist?

Here is a slightly cleaner version.

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Allow-windmove-keys-to-be-bound-without-prefix-or-mo.patch

From 03248e79527f9603aa944e7e147fc67a8886eb3a Mon Sep 17 00:00:00 2001
From: Philip K <philipk@HIDDEN>
Date: Sat, 22 May 2021 22:03:22 +0200
Subject: [PATCH] Allow windmove keys to be bound without prefix or modifiers

---
 lisp/windmove.el | 79 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 58 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..bb9478eab4 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,41 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-default-map (make-sparse-keymap)
+  "Map used by `windmove-install-defaults'.")
+
+(defun windmove-install-defaults (modifiers alist)
+  "Install keys as specified by ALIST.
+Every element of ALIST has the form (FN KEY), where KEY is
+appended to MODIFIERS, before installing the key.  Previous
+bindings of FN are unbound."
+  (add-to-list 'emulation-mode-map-alists `((t . ,windmove-default-map)))
+  (dolist (bind alist)
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-default-map))
+        (define-key windmove-default-map old nil))
+      (define-key windmove-default-map
+        (vector (append modifiers (cdr bind)))
+        (car bind)))))
+
 ;;;###autoload
 (defun windmove-default-keybindings (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-left left)
+                               (windmove-right right)
+                               (windmove-up up)
+                               (windmove-down down))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +568,21 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (windmove-install-defaults modifiers
+                             '((windmove-display-left left)
+                               (windmove-display-right right)
+                               (windmove-display-up up)
+                               (windmove-display-down down)
+                               (windmove-display-same-window ?0)
+                               (windmove-display-new-frame ?f)
+                               (windmove-display-new-tab ?t))))
 
 
 ;;; Directional window deletion
@@ -618,16 +644,22 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-delete-left left)
+                               (windmove-delete-right right)
+                               (windmove-delete-up up)
+                               (windmove-delete-down down))))
 
 
 ;;; Directional window swap states
@@ -673,14 +705,19 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (windmove-install-defaults modifiers
+                             '((windmove-swap-states-left left)
+                               (windmove-swap-states-right right)
+                               (windmove-swap-states-up up)
+                               (windmove-swap-states-down down))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 22 May 2021 20:30:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 22 16:30:04 2021
Received: from localhost ([127.0.0.1]:40118 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lkYG3-0002Ui-Rf
	for submit <at> debbugs.gnu.org; Sat, 22 May 2021 16:30:04 -0400
Received: from mout01.posteo.de ([185.67.36.65]:50811)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lkYG0-0002Tj-Er
 for 41438 <at> debbugs.gnu.org; Sat, 22 May 2021 16:30:02 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id DC474240028
 for <41438 <at> debbugs.gnu.org>; Sat, 22 May 2021 22:29:52 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1621715392; bh=YewDmnnCOriKNPUAUY77pU2WvA3Fq1SRJsVC0tXj7tw=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=BUVjFp6U2fsziifFKYFqbvl+EcbqFOXK3GumWjP4wErM7xF0rmgQimovTOcMW+OKG
 hFsLTQD+2edAUUEsR4Ns6XoDKH38Zpm2kVyLdGztl5R5pDx+iBBSQBKRPZQpB5kCrQ
 OjllYv06XyYfzC+l1x9IZOdKGJsbzzoV9Ft1XcaAJ7QQPBcqzgytvW0hRKL+eCHcWr
 nSt/mcmeuqnssiYFEIF2Gj+PBSuKggQT5E7ZNSZtEHhdHd0oq6nQiMD4elVE8IEENX
 UGKe3W7f7VtQu6VEqHMYj0yHgycy1ncsTLosSGutQ6qEeOpQeI0wPvxl2dwbPzuPlB
 0109kEryj6FgQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FnZpR5FyTz6tm5;
 Sat, 22 May 2021 22:29:51 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sat, 22 May 2021 20:29:50 +0000
In-Reply-To: <8735uru1py.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Wed,
 12 May 2021 22:38:33 +0200")
Message-ID: <871r9yjyv5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> "Philip K." <philipk@HIDDEN> writes:
>
>> These are the only edge-cases I found, but I didn't fix them yet, as I'm
>> not sure what would be preferred. So the patches should not be applies yet.
>
> Have you done any further work on this?

I have been thinking about this a bit more, and tried a different
approach. The implementation is not prefect, but basically I am playing
with emulation-mode-map-alists to bind the keys, instead of using the
global map.

The should solve the two issues I brought up, because I do not have to
worry about restoring the previous keys, and some edge-cases are
avoided, where e.g. doc-view would override up and down breaking the
expected behaviour when setting the prefix to 'none.

The code should probably be refactored, moving more of the common
functionality into it's own function, but I am primarily wondering if
using emulation-mode-map-alists the way I am proposing it here is ok. Or
should I prefer minor-mode-map-alist?

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Allow-windmove-keys-to-be-bound-without-prefix-or-mo.patch

From eba161853d50c2a6ce27af5907efdae4f6ab81eb Mon Sep 17 00:00:00 2001
From: Philip K <philipk@HIDDEN>
Date: Sat, 22 May 2021 22:03:22 +0200
Subject: [PATCH] Allow windmove keys to be bound without prefix or modifiers

---
 lisp/windmove.el | 91 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 70 insertions(+), 21 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index e4ea8e0f69..acd9cb41fc 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -426,19 +426,35 @@ windmove-down
 ;; I don't think these bindings will work on non-X terminals; you
 ;; probably want to use different bindings in that case.
 
+(defvar windmove-map (make-sparse-keymap)
+  "Keymap to bind windmove keys to.")
+
+(add-to-list 'emulation-mode-map-alists
+             (list (cons t windmove-map)))
+
 ;;;###autoload
 (defun windmove-default-keybindings (&optional modifiers)
   "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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-down))
+  (dolist (bind '((windmove-left left)
+                  (windmove-right right)
+                  (windmove-up up)
+                  (windmove-down down)))
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-map))
+        (define-key windmove-map old nil))
+      (define-key windmove-map
+        (vector (append modifiers (cdr bind)))
+        (car bind)))))
 
 
 ;;; Directional window display and selection
@@ -546,17 +562,27 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
-  (global-set-key (vector (append modifiers '(?0)))    'windmove-display-same-window)
-  (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
-  (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
+  (dolist (bind '((windmove-display-left left)
+                  (windmove-display-right right)
+                  (windmove-display-up up)
+                  (windmove-display-down down)
+                  (windmove-display-same-window ?0)
+                  (windmove-display-new-frame ?f)
+                  (windmove-display-new-tab ?t)))
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-map))
+        (define-key windmove-map old nil))
+      (define-key windmove-map
+        (vector (append modifiers (cdr bind)))
+        (car bind)))))
 
 
 ;;; Directional window deletion
@@ -618,16 +644,28 @@ 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)
-  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
-  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
+  (dolist (bind '((windmove-delete-left left)
+                  (windmove-delete-right right)
+                  (windmove-delete-up up)
+                  (windmove-delete-down down)))
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-map))
+        (define-key windmove-map old nil))
+      (define-key windmove-map
+        (vector (append modifiers (cdr bind)))
+        (car bind)))))
 
 
 ;;; Directional window swap states
@@ -673,14 +711,25 @@ 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)
-  (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
-  (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
+  (dolist (bind '((windmove-swap-states-left left)
+                  (windmove-swap-states-right right)
+                  (windmove-swap-states-up up)
+                  (windmove-swap-states-down down)))
+    (when (or (memq (cadr bind) '(left right up down))
+              (not (null modifiers)))
+      (dolist (old (where-is-internal (car bind) windmove-map))
+        (define-key windmove-map old nil))
+      (define-key windmove-map
+        (vector (append modifiers (cdr bind)))
+        (car bind)))))
 
 
 (provide 'windmove)
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 12 May 2021 21:27:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 12 17:27:55 2021
Received: from localhost ([127.0.0.1]:40761 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lgwOZ-00036a-Pe
	for submit <at> debbugs.gnu.org; Wed, 12 May 2021 17:27:55 -0400
Received: from mout01.posteo.de ([185.67.36.65]:48619)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1lgwOW-00036J-U5
 for 41438 <at> debbugs.gnu.org; Wed, 12 May 2021 17:27:54 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id A0038240027
 for <41438 <at> debbugs.gnu.org>; Wed, 12 May 2021 23:27:46 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1620854866; bh=PHlLThL5SpjuJnGcGt6VSJbU8jGGB+otojA1Lj1q/QI=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=OttvVE469VqvbspC1ml87PTUmKneUQwws+zKxP2AH0EZaqtfmFLENAncOi5ULJak+
 KNrDLNn3tdbZ1L9Udt2BJ/eCQ24WtjfRlN4p2Yud7gIale6t4EqxnyRFUhY2IYYSXg
 +ZHBBS4BiufbRDVdT+ULBOJNFlphAopNlsf281co4zuKTfijmdUIPpl08IVnQJ47lc
 DreckxehKuIJhVZeS/0Wx0U5osgOpDXnApsaVb3ZvYZ3P1MpwW0C0yy6vcsR7wZhn1
 R99xF+MJKbYVD7onlHw8K8VXGq0uRubpSbC2sBVIHE1O+AzK4aue7Vxdo0HXNR0Kyc
 9WbA6zAeJrhlg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4FgSYs3qdhz9rxP;
 Wed, 12 May 2021 23:27:45 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
 <8735uru1py.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=mutual; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Wed, 12 May 2021 21:27:45 +0000
In-Reply-To: <8735uru1py.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Wed,
 12 May 2021 22:38:33 +0200")
Message-ID: <87cztvd4mm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> "Philip K." <philipk@HIDDEN> writes:
>
>> These are the only edge-cases I found, but I didn't fix them yet, as I'm
>> not sure what would be preferred. So the patches should not be applies yet.
>
> Have you done any further work on this?

No, not since whenever that message was sent.

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.
Removed tag(s) patch. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 12 May 2021 20:38:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 12 16:38:45 2021
Received: from localhost ([127.0.0.1]:40710 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lgvcz-0008B2-9r
	for submit <at> debbugs.gnu.org; Wed, 12 May 2021 16:38:45 -0400
Received: from quimby.gnus.org ([95.216.78.240]:34754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1lgvcx-0008Ao-N0
 for 41438 <at> debbugs.gnu.org; Wed, 12 May 2021 16:38:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=G1bvh9jbuNrG/AL24un2XLKwRtYeeZqP1Tnfz/RsSmg=; b=UURrTl/CHSlTx5FQOdQMEiAS5N
 wdYi1sBBB4Aw7g7cbiQAI/ZM+va61p9iCzW94yWfqO244CjRFH37qlh1laVOLyMuMf1qOh2E70TM+
 x8HEPOGuPUDewyXtjVotKn2HKxuo7+JWxTbW03TNHMDsIUwLYv5q2OpXAFv4Kr7Q2kwE=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1lgvco-0001P7-Rp; Wed, 12 May 2021 22:38:37 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: "Philip K." <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87mu36enhl.fsf@HIDDEN>
X-Now-Playing: Lost Girls's _Menneskekollektivet_: "Real Life"
Date: Wed, 12 May 2021 22:38:33 +0200
In-Reply-To: <87mu36enhl.fsf@HIDDEN> (Philip K.'s message of "Fri, 07 Aug
 2020 12:53:10 +0200")
Message-ID: <8735uru1py.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: "Philip K." <philipk@HIDDEN> writes: > These are the only
 edge-cases I found, but I didn't fix them yet, as I'm > not sure what would
 be preferred. So the patches should not be applies yet. Have you done any
 further work on this? 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

"Philip K." <philipk@HIDDEN> writes:

> These are the only edge-cases I found, but I didn't fix them yet, as I'm
> not sure what would be preferred. So the patches should not be applies yet.

Have you done any further work on this?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 9 Aug 2020 00:15:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 08 20:15:32 2020
Received: from localhost ([127.0.0.1]:59754 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4Yzs-0002w4-2O
	for submit <at> debbugs.gnu.org; Sat, 08 Aug 2020 20:15:32 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:33941)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1k4Yzo-0002vp-PS
 for 41438 <at> debbugs.gnu.org; Sat, 08 Aug 2020 20:15:30 -0400
X-Originating-IP: 91.129.102.47
Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47])
 (Authenticated sender: juri@HIDDEN)
 by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 50EFA40002;
 Sun,  9 Aug 2020 00:15:20 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Philip K." <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87mu36enhl.fsf@HIDDEN>
Date: Sun, 09 Aug 2020 02:54:17 +0300
In-Reply-To: <87mu36enhl.fsf@HIDDEN> (Philip K.'s message of "Fri, 07 Aug
 2020 12:53:10 +0200")
Message-ID: <87k0y8vfom.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, larsi@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> But there are a few general issues I noticed:
>
> 1. windmove-display-{same-window,new-{frame,tab}} can disturb regular
>    input when the modifier is set to shift or none. Possible solutions
>    could be to prohibit using these modifiers or to add a prefix key and
>    generate a warning when eg. "S-t" or "t" would be rebound.

Perhaps displaying a warning should be sufficient.

> 2. The new function windmove--unbind works with the global-map, so when
>    someone sets a prefix to none, and then changes it to something else,
>    the arrow keys are left undefined. I could either see this being
>    fixed by using a separate map or by somehow memorising what the
>    previous key was (eg. by using the property list of the windmove
>    command's symbol).

I'm not sure whether such complication is necessary.  Usually
users will try to customize the option and then restart Emacs.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 7 Aug 2020 10:53:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 07 06:53:25 2020
Received: from localhost ([127.0.0.1]:55882 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k4004-0008KU-HD
	for submit <at> debbugs.gnu.org; Fri, 07 Aug 2020 06:53:25 -0400
Received: from mout02.posteo.de ([185.67.36.66]:50443)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1k3zzy-0008K4-LM
 for 41438 <at> debbugs.gnu.org; Fri, 07 Aug 2020 06:53:22 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 105782400FB
 for <41438 <at> debbugs.gnu.org>; Fri,  7 Aug 2020 12:53:11 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1596797592; bh=ce/HR1cXx8WrxL93uN11xXEMWNrJSe2fHh6O9YiCHfg=;
 h=From:To:Cc:Subject:Date:From;
 b=W7nFdzTlM80XPA9GgeGNeVkw+c6Pl/NyGKAd4McBskk0gljn8J4Ffbrqj+6Wvn2jz
 2Nwocfs5e+PbMp/UG3qGUEgDXsV9FtBC1R1e01vo3mOy0cBMT7yjGeQ1R7CSRRBdJB
 ZxoU8MxAnzixm8MeN6PikpUsGZ4DbSAq2eEGEtxtZPKkK2oarPMjm42GrFRo1dXTAx
 5+h3raRRGNjDThA5jMOgszcUhgfkeLpRq+1K7shT2Lpi23gJtidoYRpOpk0rWae3O1
 sme+A1I9Do2M7IAEPy3lh44I5SF7rKOiYQKwPN3q8IQ4Sui35fbdDZqTflUKkzpXdU
 tvIy9snvet9xw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4BNMdz1c4Sz9rxX;
 Fri,  7 Aug 2020 12:53:11 +0200 (CEST)
From: "Philip K." <philipk@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
In-Reply-To: <87a6z78gqw.fsf@HIDDEN> (message from Juri Linkov on
 Fri, 07 Aug 2020 02:43:03 +0300)
Date: Fri, 07 Aug 2020 12:53:10 +0200
Message-ID: <87mu36enhl.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, larsi@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Juri Linkov <juri@HIDDEN> writes:

>>> (I see there were some unfinished parts in your previous patch).
>>
>> It's been a while since I submitted it, so I had to re-read the thread,
>> but I'm not quite sure what the "unfinished" parts were, aside from the
>> missing autoload cookies. Sorry if I missed something :/
>
> I don't know, my impression seems to suggest the first version was not
> completely tested, for example, windmove-modifiers defcustom called
> windmove-swap-states-default-keybindings, not windmove-default-keybindings.
> But maybe you already fixed this.

You're right, I still had a few local changes. A noteworthy addition is
that the user options unbind their previous bindings, before binding the
new ones. This should lead to more consistent behaviour when updating
the option a few times in the same session.

>> Also, the second patch (the one with the user options) depended on the
>> previous one in this thread[0], that introduced the "none" prefix. Is
>> that fine, or should I just merge both patches into one.
>
> This is perfectly fine - better to commit two separate patches.

Ok. I added both below.

But there are a few general issues I noticed:

1. windmove-display-{same-window,new-{frame,tab}} can disturb regular
   input when the modifier is set to shift or none. Possible solutions
   could be to prohibit using these modifiers or to add a prefix key and
   generate a warning when eg. "S-t" or "t" would be rebound.
2. The new function windmove--unbind works with the global-map, so when
   someone sets a prefix to none, and then changes it to something else,
   the arrow keys are left undefined. I could either see this being
   fixed by using a separate map or by somehow memorising what the
   previous key was (eg. by using the property list of the windmove
   command's symbol).

These are the only edge-cases I found, but I didn't fix them yet, as I'm
not sure what would be preferred. So the patches should not be applies yet.

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Allow-windmove-keys-to-be-bound-without-prefix-or-mo.patch

From f87d057b72f0cc374c132100664c5b8553bd58e2 Mon Sep 17 00:00:00 2001
From: Philip K <philip@HIDDEN>
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 6557960064..613727f8ed 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)
@@ -546,9 +549,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)
@@ -618,11 +624,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)
@@ -673,9 +684,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


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Add-user-options-to-bind-windmove-commands.patch

From c009311887372e1e822739edc050a802bfa4d1d8 Mon Sep 17 00:00:00 2001
From: Philip K <philipk@HIDDEN>
Date: Fri, 7 Aug 2020 12:35:49 +0200
Subject: [PATCH] Add user options to bind windmove commands

* windmove.el (windmove-modifier-type): Create
(windmove--unbind): New constant
(windmove-modifiers): New user option
(windmove-default-keybindings): Use windmove-modifiers
(windmove-display-modifiers): New user option
(windmove-display-default-keybindings): Use windmove-display-modifiers
(windmove-delete-prefix): New user option
(windmove-delete-modifiers): New user option
(windmove-delete-default-keybindings): Use windmove-delete-prefix and
windmove-delete-modifiers
(windmove-swap-states-modifiers): New user option
(windmove-swap-states-default-keybindings): Use windmove-swap-states-modifiers
---
 lisp/windmove.el | 154 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 145 insertions(+), 9 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index 613727f8ed..9b68f9a5b9 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -162,6 +162,40 @@ windmove-window-distance-delta
 (make-obsolete-variable 'windmove-window-distance-delta
                         "no longer used." "27.1")
 
+(defconst windmove-modifier-type
+  '(choice (set :tag "Modifier Symbols"
+                :greedy t
+                ;; See `(elisp) Keyboard Events'
+                (const :tag "Meta" meta)
+                (const :tag "Control" control)
+                (const :tag "Shift" shift)
+                (const :tag "Hyper" hyper)
+                (const :tag "Super" super)
+                (const :tag "Alt" alt))
+           (const :tag "No modifier" none)
+           (const :tag "Not bound" nil))
+  "Customisation type for windmove modifiers")
+
+(defun windmove--unbind (prefix modifiers fns &optional extra)
+  "Unbind windmove commands, bound by PREFIX and MODIFIER.
+To ensure that only windmove functions are unbound, the command
+must be member of the list FNS.
+By default only the left, right, up and down keys are unbound,
+but further keys can be added via EXTRA."
+  (setq prefix
+        (cond ((eq prefix 'none) nil)
+              ((not (listp prefix)) (list prefix))
+              (t prefix)))
+  (setq modifiers
+        (cond ((eq modifiers 'none) nil)
+              ((not (listp modifiers)) (list modifiers))
+              (t modifiers)))
+  (dolist (dir (append '(left right up down) extra))
+    (let* ((key (append modifiers (list dir)))
+           (key (vconcat prefix (list key))))
+      (when (memq (lookup-key global-map key) fns)
+        (global-set-key key nil)))))
+
 
 ;; Note:
 ;;
@@ -419,6 +453,7 @@ windmove-down
   (interactive "P")
   (windmove-do-window-select 'down (and arg (prefix-numeric-value arg))))
 
+(defvar windmove-modifiers)
 
 ;;; set up keybindings
 ;; Idea for this function is from iswitchb.el, by Stephen Eglen
@@ -433,16 +468,41 @@ windmove-default-keybindings
 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'."
+Default value of MODIFIERS is stored in `windmove-modifiers'."
   (interactive)
-  (unless modifiers (setq modifiers 'shift))
   (when (eq modifiers 'none) (setq modifiers nil))
+  (unless modifiers
+    (setq modifiers windmove-modifiers))
   (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)
   (global-set-key (vector (append modifiers '(up)))    'windmove-up)
   (global-set-key (vector (append modifiers '(down)))  'windmove-down))
 
+;; has to be declared AFTER windmove-default-keybindings, or else
+;; windmove is recursivly loaded
+;;;###autoload
+(defcustom windmove-modifiers '(shift super)
+  "Modifiers for `windmove-default-keybindings'.
+Can either be a symbol or list of modifier symbols,
+i.e. `meta',`control', `shift', `hyper', `super', or `alt'
+representing modifier keys to use with the arrow keys.
+
+If the value is just `none', the arrow keys will be directly
+bound to the windmove functions."
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (windmove--unbind nil (default-value sym)
+                           '(windmove-left
+                             windmove-right
+                             windmove-up
+                             windmove-down))
+         (when val
+           (windmove-default-keybindings val))
+         (set-default sym val)))
+
 
 ;;; Directional window display and selection
 
@@ -543,6 +603,8 @@ windmove-display-new-tab
   (interactive "P")
   (windmove-display-in-direction 'new-tab arg))
 
+(defvar windmove-display-modifiers)
+
 ;;;###autoload
 (defun windmove-display-default-keybindings (&optional modifiers)
   "Set up keybindings for directional buffer display.
@@ -551,9 +613,10 @@ windmove-display-default-keybindings
 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'."
+Default value of MODIFIERS is stored in `windmove-display-modifiers'."
   (interactive)
-  (unless modifiers (setq modifiers '(shift meta)))
+  (unless modifiers
+    (setq modifiers windmove-display-modifiers))
   (when (eq modifiers 'none) (setq modifiers nil))
   (unless (listp modifiers) (setq modifiers (list modifiers)))
   (global-set-key (vector (append modifiers '(left)))  'windmove-display-left)
@@ -564,6 +627,27 @@ windmove-display-default-keybindings
   (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
   (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
 
+;;;###autoload
+(defcustom windmove-display-modifiers '(shift meta)
+  "Modifiers for `windmove-display-default-keybindings'.
+Analogous to `windmove-modifiers'."
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (windmove--unbind nil (default-value sym)
+                           '(windmove-display-left
+                             windmove-display-right
+                             windmove-display-up
+                             windmove-display-down
+                             windmove-display-same-window
+                             windmove-display-new-frame
+                             windmove-display-new-tab)
+                           '(?0 ?f ?t))
+         (when val
+           (windmove-display-default-keybindings val))
+         (set-default sym val)))
+
 
 ;;; Directional window deletion
 
@@ -618,6 +702,9 @@ windmove-delete-down
   (interactive "P")
   (windmove-delete-in-direction 'down arg))
 
+(defvar windmove-delete-prefix)
+(defvar windmove-delete-modifiers)
+
 ;;;###autoload
 (defun windmove-delete-default-keybindings (&optional prefix modifiers)
   "Set up keybindings for directional window deletion.
@@ -627,12 +714,15 @@ windmove-delete-default-keybindings
 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'."
+The default values for PREFIX and MODIFIERS are stored in `windmove-delete-prefix'
+and `windmove-delete-modifiers' respectively."
   (interactive)
-  (unless prefix (setq prefix '(?\C-x)))
+  (unless prefix
+    (setq prefix (list windmove-delete-prefix)))
   (when (eq prefix 'none) (setq prefix nil))
   (unless (listp prefix) (setq prefix (list prefix)))
-  (unless modifiers (setq modifiers '(shift)))
+  (unless modifiers
+    (setq modifiers windmove-delete-modifiers))
   (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)
@@ -640,6 +730,32 @@ windmove-delete-default-keybindings
   (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
   (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
 
+(defcustom windmove-delete-prefix (kbd "C-x")
+  "Prefix for `windmove-delete-default-keybindings'."
+  :type 'key-sequence
+  :require 'windmove
+  :initialize #'custom-initialize-changed)
+
+;;;###autoload
+(defcustom windmove-delete-modifiers '(shift)
+  "Modifiers for `windmove-delete-default-keybindings'.
+See `windmove-modifiers' for more details"
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set-after '(windmove-delete-prefix)
+  :set (lambda (sym val)
+         (windmove--unbind windmove-delete-prefix
+                           (default-value sym)
+                           '(windmove-delete-left
+                             windmove-delete-right
+                             windmove-delete-up
+                             windmove-delete-down))
+         (when val
+           (windmove-delete-default-keybindings
+            windmove-delete-prefix val))
+         (set-default sym val)))
+
 
 ;;; Directional window swap states
 
@@ -678,6 +794,8 @@ windmove-swap-states-right
   (interactive)
   (windmove-swap-states-in-direction 'right))
 
+(defvar windmove-swap-states-modifiers)
+
 ;;;###autoload
 (defun windmove-swap-states-default-keybindings (&optional modifiers)
   "Set up keybindings for directional window swap states.
@@ -687,9 +805,10 @@ windmove-swap-states-default-keybindings
 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'."
+Default value of MODIFIERS is stored in `windmove-swap-states-modifiers'."
   (interactive)
-  (unless modifiers (setq modifiers '(shift super)))
+  (unless modifiers
+    (setq modifiers windmove-swap-states-modifiers))
   (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)
@@ -697,6 +816,23 @@ windmove-swap-states-default-keybindings
   (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
   (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
 
+;;;###autoload
+(defcustom windmove-swap-states-modifiers '(shift super)
+  "Modifiers for `windmove-swap-states-default-keybindings'.
+Analogous to `windmove-modifiers'."
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (windmove--unbind nil (default-value sym)
+                           '(windmove-swap-states-left
+                             windmove-swap-states-right
+                             windmove-swap-states-up
+                             windmove-swap-states-downp))
+         (when val
+           (windmove-swap-states-default-keybindings val))
+         (set-default sym val)))
+
 
 (provide 'windmove)
 
-- 
2.20.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 7 Aug 2020 00:52:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 06 20:52:57 2020
Received: from localhost ([127.0.0.1]:55172 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k3qcz-0000dY-78
	for submit <at> debbugs.gnu.org; Thu, 06 Aug 2020 20:52:57 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:57983)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1k3qcw-0000d5-7q
 for 41438 <at> debbugs.gnu.org; Thu, 06 Aug 2020 20:52:56 -0400
X-Originating-IP: 91.129.102.47
Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47])
 (Authenticated sender: juri@HIDDEN)
 by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 923291C0002;
 Fri,  7 Aug 2020 00:52:46 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Philip K." <philipk@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87pn84p1hj.fsf@HIDDEN>
Date: Fri, 07 Aug 2020 02:43:03 +0300
In-Reply-To: <87pn84p1hj.fsf@HIDDEN> (Philip K.'s message of "Thu, 06 Aug
 2020 11:28:24 +0200")
Message-ID: <87a6z78gqw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, larsi@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> (I see there were some unfinished parts in your previous patch).
>
> It's been a while since I submitted it, so I had to re-read the thread,
> but I'm not quite sure what the "unfinished" parts were, aside from the
> missing autoload cookies. Sorry if I missed something :/

I don't know, my impression seems to suggest the first version was not
completely tested, for example, windmove-modifiers defcustom called
windmove-swap-states-default-keybindings, not windmove-default-keybindings.
But maybe you already fixed this.

> Also, the second patch (the one with the user options) depended on the
> previous one in this thread[0], that introduced the "none" prefix. Is
> that fine, or should I just merge both patches into one.

This is perfectly fine - better to commit two separate patches.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 6 Aug 2020 09:28:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 06 05:28:36 2020
Received: from localhost ([127.0.0.1]:53133 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k3cCS-0002MJ-2P
	for submit <at> debbugs.gnu.org; Thu, 06 Aug 2020 05:28:36 -0400
Received: from mout02.posteo.de ([185.67.36.66]:37579)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1k3cCP-0002M1-AU
 for 41438 <at> debbugs.gnu.org; Thu, 06 Aug 2020 05:28:34 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id DA7F22400FC
 for <41438 <at> debbugs.gnu.org>; Thu,  6 Aug 2020 11:28:26 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1596706106; bh=3zeyTyAmnzLQwqJErrm4maNuFHSa+Aq8YhUkSL717Cw=;
 h=From:To:Cc:Subject:Date:From;
 b=SpuSDyt74PXjuJxTnR2uAvYqt1jqz98/0YAPIkFyuR245YAbQB7cn0rdvqtvgnE6i
 CP0KuG3NbTMIinaxD+ik8bNhPgu04L1XwZFYtQ5dEetGjrauq9Wl4CerOTTTou1l+t
 EvsjlVsr1fOlRQuzxJlyhAykA2YZFMscxrcglMMght51sAZAClXKBT/MbGSiiwfbm+
 pNqpowmzQAsgkacrJTtJh2UC753Xe1VohD9GMKxD4YgRnXK7MhupLS8x80vHaKN+H9
 1D4OUcvXBaLh2REgmPQ2NK85VlLNE7zJUbQYEHh3x7Obt9iIalJcLO9SUZVRPS7fib
 Kks2ePUNYbngw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4BMjpd4StSz6tmD;
 Thu,  6 Aug 2020 11:28:25 +0200 (CEST)
From: "Philip K." <philipk@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
In-Reply-To: <87y2mssltt.fsf@HIDDEN> (message from Juri Linkov on
 Thu, 06 Aug 2020 02:40:46 +0300)
Date: Thu, 06 Aug 2020 11:28:24 +0200
Message-ID: <87pn84p1hj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, larsi@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Juri Linkov <juri@HIDDEN> writes:

> Philip, could you please prepare the final version of your patch

Sure, I'll try to finish it today.

> (I see there were some unfinished parts in your previous patch).

It's been a while since I submitted it, so I had to re-read the thread,
but I'm not quite sure what the "unfinished" parts were, aside from the
missing autoload cookies. Sorry if I missed something :/

Also, the second patch (the one with the user options) depended on the
previous one in this thread[0], that introduced the "none" prefix. Is
that fine, or should I just merge both patches into one.

[0] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41438#5

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 6 Aug 2020 00:15:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 05 20:15:19 2020
Received: from localhost ([127.0.0.1]:52438 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k3TZ0-0007Cs-QS
	for submit <at> debbugs.gnu.org; Wed, 05 Aug 2020 20:15:19 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:46905)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1k3TYy-0007CW-1m
 for 41438 <at> debbugs.gnu.org; Wed, 05 Aug 2020 20:15:17 -0400
X-Originating-IP: 91.129.102.47
Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47])
 (Authenticated sender: juri@HIDDEN)
 by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 347B01C0002;
 Thu,  6 Aug 2020 00:15:07 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87imgpw7k3.fsf@HIDDEN> <87366ftww6.fsf@HIDDEN>
 <87pn9ibv6x.fsf@HIDDEN> <87imdxhssv.fsf@HIDDEN>
Date: Thu, 06 Aug 2020 02:40:46 +0300
In-Reply-To: <87imdxhssv.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Wed,
 05 Aug 2020 20:05:36 +0200")
Message-ID: <87y2mssltt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, "Philip K." <philip@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>> I get what you were saying, but it seems the issue with windmove is the
>>> opposite. Just loading windmove shouldn't create any new keybindings,
>>> but customising the new user options should, *even if* windmove hasn't
>>> been loaded yet (ideally).
>>
>> Then it seems explicitly requiring windmove and autoloading variables
>> is unavoidable, so your previous patch was the right thing to do.
>
> The patch wasn't applied, though?  I know nothing about windmove, so I'm
> not really qualified to have an opinion, but if you think it's the right
> thing to do, then you should apply it?

Philip, could you please prepare the final version of your patch
(I see there were some unfinished parts in your previous patch).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 5 Aug 2020 18:05:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 05 14:05:49 2020
Received: from localhost ([127.0.0.1]:52207 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k3NnR-00057j-GU
	for submit <at> debbugs.gnu.org; Wed, 05 Aug 2020 14:05:49 -0400
Received: from quimby.gnus.org ([95.216.78.240]:44304)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k3NnP-00057V-S7
 for 41438 <at> debbugs.gnu.org; Wed, 05 Aug 2020 14:05:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=hsPPVNbjDu0rDbYxNuUm9iKL8XU43wkFQjzU6YcrHI4=; b=eD43h7d1d1RHXiJrVeqtYDIp7Q
 HsNbmzx1XQk3lVzmbgM1oJnM9aw/bj7CFfHKzAaxUxT7zeryFMakR+o+mhrdcaKu/nLH68pa/V4IE
 q5tuNIvpICWpfJAjWZ4Su/Y7rz8eCej6Y6WN2CWxiCtFK5i002AjzorrgXZyP1l7I6Yc=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k3NnF-0007WR-Md; Wed, 05 Aug 2020 20:05:41 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87366ftww6.fsf@HIDDEN>
 <87pn9ibv6x.fsf@HIDDEN>
Date: Wed, 05 Aug 2020 20:05:36 +0200
In-Reply-To: <87pn9ibv6x.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 29 Jun 2020 02:37:10 +0300")
Message-ID: <87imdxhssv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Juri Linkov <juri@HIDDEN> writes: >> I get what you were
 saying, but it seems the issue with windmove is the >> opposite. Just loading
 windmove shouldn't create any new keybindings, >> but customising the new
 user options should, *eve [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, "Philip K." <philip@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Juri Linkov <juri@HIDDEN> writes:

>> I get what you were saying, but it seems the issue with windmove is the
>> opposite. Just loading windmove shouldn't create any new keybindings,
>> but customising the new user options should, *even if* windmove hasn't
>> been loaded yet (ideally).
>
> Then it seems explicitly requiring windmove and autoloading variables
> is unavoidable, so your previous patch was the right thing to do.

The patch wasn't applied, though?  I know nothing about windmove, so I'm
not really qualified to have an opinion, but if you think it's the right
thing to do, then you should apply it?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 28 Jun 2020 23:58:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 28 19:58:11 2020
Received: from localhost ([127.0.0.1]:47219 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jphBb-0006qS-8V
	for submit <at> debbugs.gnu.org; Sun, 28 Jun 2020 19:58:11 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:44807)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1jphBZ-0006qD-VA
 for 41438 <at> debbugs.gnu.org; Sun, 28 Jun 2020 19:58:10 -0400
X-Originating-IP: 91.129.96.187
Received: from mail.gandi.net (m91-129-96-187.cust.tele2.ee [91.129.96.187])
 (Authenticated sender: juri@HIDDEN)
 by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 524461C0002;
 Sun, 28 Jun 2020 23:58:00 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Philip K." <philip@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87366ftww6.fsf@HIDDEN>
Date: Mon, 29 Jun 2020 02:37:10 +0300
In-Reply-To: <87366ftww6.fsf@HIDDEN> (Philip K.'s message of "Sun, 28
 Jun 2020 10:30:49 +0200")
Message-ID: <87pn9ibv6x.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I get what you were saying, but it seems the issue with windmove is the
> opposite. Just loading windmove shouldn't create any new keybindings,
> but customising the new user options should, *even if* windmove hasn't
> been loaded yet (ideally).

Then it seems explicitly requiring windmove and autoloading variables
is unavoidable, so your previous patch was the right thing to do.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 28 Jun 2020 08:31:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 28 04:31:01 2020
Received: from localhost ([127.0.0.1]:45167 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jpSiL-00088Z-8v
	for submit <at> debbugs.gnu.org; Sun, 28 Jun 2020 04:31:01 -0400
Received: from out2-smtp.messagingengine.com ([66.111.4.26]:42833)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philip@HIDDEN>) id 1jpSiJ-00088F-C0
 for 41438 <at> debbugs.gnu.org; Sun, 28 Jun 2020 04:31:00 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.nyi.internal (Postfix) with ESMTP id E6B435C00E4;
 Sun, 28 Jun 2020 04:30:53 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Sun, 28 Jun 2020 04:30:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h=
 from:to:cc:subject:in-reply-to:date:message-id:mime-version
 :content-type; s=fm3; bh=X1KLDSGRzjTSVkSCWeKMhlN0CcTM7s9HBeJyuNU
 QfKc=; b=kfOMTKy5tpngeFH1G1SV1BkeebV8kJcwV7BV+L2iK4GajwL5g9Apkl/
 TdM06knMxIZN2Dl7Tt+HXYCALwepjaEt4exXQnNT9YhhIk8NSdfaVB3UXFree9j2
 vQ/g4Lg/ww3xAwvm6jo+7jZJD0HWOuEAOZaRiUWzC02GhiNKvhFn0G9SIgKvFWO5
 9Yk9n0dXH6AM+AnYNtPlwBKgPCHc18LfCW/J5aFa9AeY8VMcWf/fCHQa80Gx1Ugz
 ZSko47muCPM0aJFyqCfnKMf4pqrkljTj74AUR+9chFjFy/5HZrgkZU9dvfOov/G0
 QNyLr950sw0XJR8GSfjofLP7nzcrlcA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:date:from:in-reply-to
 :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=X1KLDSGRzjTSVkSCW
 eKMhlN0CcTM7s9HBeJyuNUQfKc=; b=bjaxluligNochNazPK2a03z4tRALJUOYv
 0U6erVpbLsciA47oEsrVK9CyDqMQHz/Hfc7dkDSTe2WjUVSRO7KV4SvYQiO+8TTw
 M4alw205lGcZlvcTZutVIEN3iRY5oIbbIrmqF6/Wzc88Q1Ko4oTpQeYxZttgKrzu
 cb8EcIKmBPQBxnBjlBlJ0rs27WFYzINhI5Tm4iJRdr+hkWfnbQ7dZ2C5aum8HxdZ
 VsK69AxG/7gLiHUT0AMJYlhe5k0dZjI43kxFVxowtaoBVChVm+4sXG/62ICmV/I6
 va2yNEaiSiEbf4Mx4sCEqnrN5nNeaIZNzHAGjRYUflc3Iodr9RYXA==
X-ME-Sender: <xms:PVX4XpKPW_hIQ8-ixLdNsjM2ivIlCiWFqASjifGmIr6WTNL67KI0Iw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeliedgtdeiucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufgjfffkgggtsehttdertddttddtnecuhfhrohhmpedfrfhhihhlihhp
 ucfmrddfuceophhhihhlihhpseifrghrphhmrghilhdrnhgvtheqnecuggftrfgrthhtvg
 hrnhepheeuieffveevkeetffeufeekfeejkeekkeefjeelueeftdduffdugfeuieegfffh
 necukfhppeekjedrudeghedrudehrdeludenucevlhhushhtvghrufhiiigvpedtnecurf
 grrhgrmhepmhgrihhlfhhrohhmpehphhhilhhiphesfigrrhhpmhgrihhlrdhnvght
X-ME-Proxy: <xmx:PVX4XlJph0BCCs7iHncKyJeDhcJ-KPaHSsJLwhw-lTHohozv3_cD0Q>
 <xmx:PVX4XhvcP02c01w2z7I-Y-nUmSWe-WWU2Q3LriSNf8uQPaZXV8Ob8Q>
 <xmx:PVX4XqZluNsBUEjcIbL_SMB_b_kbghF12x1QBezP1JXTFswb7OWg0A>
 <xmx:PVX4XpmaY9x3dD-ZPiQIB4GwwxYs3v2edYxRk_D2Ddar5Yy1SnfHtw>
Received: from localhost (p57910f5b.dip0.t-ipconnect.de [87.145.15.91])
 by mail.messagingengine.com (Postfix) with ESMTPA id 1B3423280063;
 Sun, 28 Jun 2020 04:30:52 -0400 (EDT)
From: "Philip K." <philip@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
In-Reply-To: <87o8p4avy5.fsf@HIDDEN> (message from Juri Linkov on
 Sun, 28 Jun 2020 02:53:54 +0300)
Date: Sun, 28 Jun 2020 10:30:49 +0200
Message-ID: <87366ftww6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Juri Linkov <juri@HIDDEN> writes:

> Actually, I meant not so much the defconst form (that is an unimportant
> detail), but more the :set function, and also I forgot to mention
> :initialize.  Their combination in char-fold.el looks like:
>
>   :initialize #'custom-initialize-default
>   :set (lambda (sym val)
>          (custom-set-default sym val)
>          (char-fold-update-table))
>
> Then after loading char-fold.el, this function is executed at the top level:
>
> (char-fold-update-table)
>
> Maybe something like this could help to initialize default keybindings
> after loading windmove.el.

I get what you were saying, but it seems the issue with windmove is the
opposite. Just loading windmove shouldn't create any new keybindings,
but customising the new user options should, *even if* windmove hasn't
been loaded yet (ideally).

-- 
	Philip K.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 28 Jun 2020 00:18:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 27 20:18:49 2020
Received: from localhost ([127.0.0.1]:44796 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jpL21-0004Bx-8Z
	for submit <at> debbugs.gnu.org; Sat, 27 Jun 2020 20:18:49 -0400
Received: from relay12.mail.gandi.net ([217.70.178.232]:52979)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1jpL1v-0004BH-8Z
 for 41438 <at> debbugs.gnu.org; Sat, 27 Jun 2020 20:18:43 -0400
Received: from mail.gandi.net (m91-129-96-187.cust.tele2.ee [91.129.96.187])
 (Authenticated sender: juri@HIDDEN)
 by relay12.mail.gandi.net (Postfix) with ESMTPSA id BBB49200003;
 Sun, 28 Jun 2020 00:18:35 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Philip K." <philip@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
References: <87imgpw7k3.fsf@HIDDEN> <87k0zttxti.fsf@HIDDEN>
Date: Sun, 28 Jun 2020 02:53:54 +0300
In-Reply-To: <87k0zttxti.fsf@HIDDEN> (Philip K.'s message of "Fri, 26
 Jun 2020 21:46:17 +0200")
Message-ID: <87o8p4avy5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, 41438@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> Recently we had a similar problem in char-fold.el that was solved
>> using defconst for the default value and a :set function, this might
>> help here.
>
> I've been trying to understand what was changed there (I presume you're
> referring to 376f5df), but I don't think I can quite follow. What
> difference does adding the defconst forms to the eval-and-compile block
> do?

Actually, I meant not so much the defconst form (that is an unimportant
detail), but more the :set function, and also I forgot to mention
:initialize.  Their combination in char-fold.el looks like:

  :initialize #'custom-initialize-default
  :set (lambda (sym val)
         (custom-set-default sym val)
         (char-fold-update-table))

Then after loading char-fold.el, this function is executed at the top level:

(char-fold-update-table)

Maybe something like this could help to initialize default keybindings
after loading windmove.el.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 26 Jun 2020 19:51:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 26 15:51:19 2020
Received: from localhost ([127.0.0.1]:43109 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jouNb-0004mP-P0
	for submit <at> debbugs.gnu.org; Fri, 26 Jun 2020 15:51:19 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:41385)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philip@HIDDEN>) id 1jouNX-0004m7-Az
 for 41438 <at> debbugs.gnu.org; Fri, 26 Jun 2020 15:51:18 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.west.internal (Postfix) with ESMTP id 924DA413
 for <41438 <at> debbugs.gnu.org>; Fri, 26 Jun 2020 15:51:09 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Fri, 26 Jun 2020 15:51:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h=
 resent-from:resent-date:resent-to:from:to:cc:subject:in-reply-to
 :date:message-id:mime-version:content-type:resent-message-id; s=
 fm3; bh=NATBS4WouEuaBFjo/TDrcgUiAXbz2hhtC9XBRgu3YiU=; b=gdZ49o57
 OtVOs0pMbJc0PBJjHDfYLlpGNjmJtFCXXVj4c+klQtGJqo8NAsyKs/X79DcZitjG
 z4Qw+wyB02SBmBQpEJaQAT1zwndaMu8S1OnNHxCiQY0n2915Id1JyH0QVm7KtcKO
 vX+YiFJvLKPVQ4w2CPXWB8ZYZmScnBe7FsQI3Bte80cC63XhiWeLiinCWYCU+bhz
 5VqrAa0sAb+yLH5wfTGNXNXlWX4knqRjfrqiTNgnKvI+xfsOU42RHVRmvFcqyqVu
 o3Jqam/jUGBmGAZ9pv1THPaw8S9bDcg32o4+t14eiqSeKmnjwfTLaJFccv4AmVlv
 cxFYTRoIml4DiQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:date:from:in-reply-to
 :message-id:mime-version:resent-date:resent-from
 :resent-message-id:resent-to:subject:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=NATBS4WouEuaBFjo/
 TDrcgUiAXbz2hhtC9XBRgu3YiU=; b=DaPb3CQQ7YNgkGyhhzxjBBkfGDbkmAJkG
 ataqhcUnYUJY0ejvPxlmRVGKLY172MLwTrsu+BDpf2nnUD+YZ+dbMT9jSEn56qAX
 EMRkdy+Gh6gOPKi9wl9VFnM9lAep2ZmQA26wo1vFzYWLeuEvT6TgOpAvTvQ5KURM
 A5osH3a6aBtzRQYKX8lzuDFBtNtYoIrY+988akmbgznYdpHLO7QvykyMigziyIPs
 cO/Y8kisfQWOkSwuB1/facJP3fWIwSefuHXbS/J+umc11g0X2Fyt9skeulnVWN2x
 YymKWD1xtJHEU+dtJPmYnm0+Wu3ZzBAMddUjh8yYDStLqL8Tme9Gg==
X-ME-Sender: <xms:rFH2XrzPUkY1Y08nvKymXD4uKm0BllfPqxJf3GCTCMoQOe8jzmvjTQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeluddgudeggecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfffkgggtsehttdertd
 dttddtnecuhfhrohhmpedfrfhhihhlihhpucfmrddfuceophhhihhlihhpseifrghrphhm
 rghilhdrnhgvtheqnecuggftrfgrthhtvghrnhepheeuieffveevkeetffeufeekfeejke
 ekkeefjeelueeftdduffdugfeuieegfffhnecukfhppeekjedrudeghedrudehrdeluden
 ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilh
 hiphesfigrrhhpmhgrihhlrdhnvght
X-ME-Proxy: <xmx:rFH2XjR3Kyn8JOGWpJyLkA9-psrdp-xX7y2_4-h9aL-DB9EaHXvOXw>
 <xmx:rFH2XlXR6odxzkFFgvm5F4q83t2BERRULptEytxQtH7IeQ75ekM9yw>
 <xmx:rFH2XljrTMxFBnvmZsy1j3eQZ91fIaFxTYDixM9Q2YEgyzwmC2qXIQ>
 <xmx:rVH2XpzzvYJreK5qh30uC22ST4d-I-ewMgMKAXA0r_cDD5Hw_eJYjQ>
Received: from localhost (p57910f5b.dip0.t-ipconnect.de [87.145.15.91])
 by mail.messagingengine.com (Postfix) with ESMTPA id 85D4A3280065
 for <41438 <at> debbugs.gnu.org>; Fri, 26 Jun 2020 15:51:08 -0400 (EDT)
Resent-From: philip@HIDDEN
Resent-Date: 26 Jun 2020 21:51:06 +0200
Resent-To: 41438 <at> debbugs.gnu.org
From: "Philip K." <philip@HIDDEN>
To: juri@HIDDEN
Subject: bug#41438: [PATCH] Allow windmove keys to be bound without prefix
 or modifiers 
In-Reply-To: 87blmewc7p.fsf@HIDDEN
Date: Fri, 26 Jun 2020 21:46:17 +0200
Message-ID: <87k0zttxti.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-RMAIL-ATTRIBUTES: --------
Resent-Message-Id: <20200626195108.85D4A3280065@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


> Recently we had a similar problem in char-fold.el that was solved
> using defconst for the default value and a :set function, this might
> help here.

I've been trying to understand what was changed there (I presume you're
referring to 376f5df), but I don't think I can quite follow. What
difference does adding the defconst forms to the eval-and-compile block
do?

-- 
	Philip K.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Jun 2020 19:51:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 26 15:51:25 2020
Received: from localhost ([127.0.0.1]:43114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jouNg-0004mh-VF
	for submit <at> debbugs.gnu.org; Fri, 26 Jun 2020 15:51:25 -0400
Received: from lists.gnu.org ([209.51.188.17]:36400)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philip@HIDDEN>) id 1jouNe-0004mZ-AF
 for submit <at> debbugs.gnu.org; Fri, 26 Jun 2020 15:51:23 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50396)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philip@HIDDEN>)
 id 1jouNe-00015j-18
 for bug-gnu-emacs@HIDDEN; Fri, 26 Jun 2020 15:51:22 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:54233)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philip@HIDDEN>)
 id 1jouNc-0004vH-DB
 for bug-gnu-emacs@HIDDEN; Fri, 26 Jun 2020 15:51:21 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.west.internal (Postfix) with ESMTP id 30001413
 for <bug-gnu-emacs@HIDDEN>; Fri, 26 Jun 2020 15:51:19 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Fri, 26 Jun 2020 15:51:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h=
 resent-from:resent-date:resent-to:from:to:cc:subject:in-reply-to
 :date:message-id:mime-version:content-type:resent-message-id; s=
 fm3; bh=NATBS4WouEuaBFjo/TDrcgUiAXbz2hhtC9XBRgu3YiU=; b=qVR8UEJ8
 0JZi17zDq64lwue+Hyv4ogwKRk7eKrckgiEPCm5DyRUgWS5D0K/zblzhOCHOxquW
 xgg+K9cUyToNoxEgS9gqJ2KG5+xv3sCSYmcZPfrQwFo6tG0x4bsIDQC3dbRZeEel
 dGwqX5v6uz5bZ2+wsp+sKTnGucxonW9F8bhGVzpprEQtS7R1TKUKotEcS7NnIqV5
 hlG3CPYhrTLy8d0Qq2zceDrZkcfA7YFD8Ne4cXhCMoa7axaZ+4dKRZHv9fQj9vbE
 v7eBo6414UbG68nNUwIMZhohxumTCw8sCH8Ts1A2I7FOPcm+vI4BgVoww7YPqnKW
 zbDH49OosVAceA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:date:from:in-reply-to
 :message-id:mime-version:resent-date:resent-from
 :resent-message-id:resent-to:subject:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=NATBS4WouEuaBFjo/
 TDrcgUiAXbz2hhtC9XBRgu3YiU=; b=kphT5X61JZZA4ZkLidZ4eoCiN5E3koG+G
 GYpm+Qm4eKmax3iV96MqGQqvQFB8PjF0XOCv97uWdprI7iLLSRV6CjzsuNez9oWg
 watEvNRYkmQggJne7nytGVJlCRVTr4DAHTZyUywgwnrcWXieaMt68SPoPZ1cdbmX
 zA5xOhduJWsne3PUaTqlVvFcVLzUa7h7WKnM29Hfeyu1GlP9M+B6NnX3ugf+5SU/
 u5wtwArS+/vP+mvcjn9+sOtA3hYw43Yi0wEaEnGRmj8XL7baR9Oq8bSqPbafnHOk
 GJ+3lfIln/K9fyXzuetKLHKMabubPN9OBzJ/Q6nuaUlRcm9sHiotg==
X-ME-Sender: <xms:tlH2XuMyLAhyJ6VqmruwdpRrMHJQQmwr1mErPBu3F0T6xImTgc3epw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeluddgudeggecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfffkgggtsehttdertd
 dttddtnecuhfhrohhmpedfrfhhihhlihhpucfmrddfuceophhhihhlihhpseifrghrphhm
 rghilhdrnhgvtheqnecuggftrfgrthhtvghrnhepheeuieffveevkeetffeufeekfeejke
 ekkeefjeelueeftdduffdugfeuieegfffhnecukfhppeekjedrudeghedrudehrdeluden
 ucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilh
 hiphesfigrrhhpmhgrihhlrdhnvght
X-ME-Proxy: <xmx:tlH2Xs-4wztjkaJCBztsRJQh0uc_a-OCL91eOoTyAQTQfws9i0ORhQ>
 <xmx:tlH2XlQClCLZMExSgtOQi_foGEMK-XZ3vl49PiDYlUY4TAMoN1TRLg>
 <xmx:tlH2Xuvhb_Uj_d2QXoGuHtgvPg8AXx9UlFEndX44xmyO9lg2LQhTKw>
 <xmx:tlH2Xl_g1O0dt0Gb0GeTwJYkT1jB-vQ4W_q1rNXShAB6RHoIztBVDg>
Received: from localhost (p57910f5b.dip0.t-ipconnect.de [87.145.15.91])
 by mail.messagingengine.com (Postfix) with ESMTPA id 32E8F3067954
 for <bug-gnu-emacs@HIDDEN>; Fri, 26 Jun 2020 15:51:18 -0400 (EDT)
Resent-From: philip@HIDDEN
Resent-Date: 26 Jun 2020 21:51:16 +0200
Resent-To: bug-gnu-emacs@HIDDEN
From: "Philip K." <philip@HIDDEN>
To: juri@HIDDEN
Subject: bug#41438: [PATCH] Allow windmove keys to be bound without prefix
 or modifiers 
In-Reply-To: 87blmewc7p.fsf@HIDDEN
Date: Fri, 26 Jun 2020 21:46:17 +0200
Message-ID: <87k0zttxti.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-RMAIL-ATTRIBUTES: -------r
Resent-Message-Id: <20200626195118.32E8F3067954@HIDDEN>
Received-SPF: pass client-ip=64.147.123.19; envelope-from=philip@HIDDEN;
 helo=wout3-smtp.messagingengine.com
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/26 14:44:59
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.01, RCVD_IN_MSPIKE_WL=-0.01,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: submit
Cc: 41438@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)


> Recently we had a similar problem in char-fold.el that was solved
> using defconst for the default value and a :set function, this might
> help here.

I've been trying to understand what was changed there (I presume you're
referring to 376f5df), but I don't think I can quite follow. What
difference does adding the defconst forms to the eval-and-compile block
do?

-- 
	Philip K.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 23 May 2020 22:56:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 23 18:56:28 2020
Received: from localhost ([127.0.0.1]:35997 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jcd48-000884-2i
	for submit <at> debbugs.gnu.org; Sat, 23 May 2020 18:56:28 -0400
Received: from relay12.mail.gandi.net ([217.70.178.232]:41923)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1jcd47-00087q-8T
 for 41438 <at> debbugs.gnu.org; Sat, 23 May 2020 18:56:27 -0400
Received: from mail.gandi.net (m91-129-97-200.cust.tele2.ee [91.129.97.200])
 (Authenticated sender: juri@HIDDEN)
 by relay12.mail.gandi.net (Postfix) with ESMTPSA id 0CF13200003;
 Sat, 23 May 2020 22:56:19 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: philip@HIDDEN (Philip K.)
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87v9kn7rnk.fsf@bulbul>
Date: Sun, 24 May 2020 01:12:42 +0300
In-Reply-To: <87v9kn7rnk.fsf@bulbul> (Philip K.'s message of "Fri, 22 May 2020
 20:26:07 +0200")
Message-ID: <87blmewc7p.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>> 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.
>>
>> I think that adding defcustoms (including a new const `none')
>> would be the most natural way to customize windmove modifiers
>> (provided that the existing functions should remain).
>
> I made a first concept, but it doesn't work unless windmove is explicity
> required (see below). As far as I know, autoloading variables isn't good
> style, so is there any other way to invoke the :set property of a user
> option?

Recently we had a similar problem in char-fold.el that was solved using
defconst for the default value and a :set function, this might help here.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 22 May 2020 19:16:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 22 15:16:00 2020
Received: from localhost ([127.0.0.1]:60424 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jcD9E-0004Xz-2z
	for submit <at> debbugs.gnu.org; Fri, 22 May 2020 15:16:00 -0400
Received: from userp2120.oracle.com ([156.151.31.85]:38402)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1jcD9C-0004Xm-Q6
 for 41438 <at> debbugs.gnu.org; Fri, 22 May 2020 15:15:59 -0400
Received: from pps.filterd (userp2120.oracle.com [127.0.0.1])
 by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04MJ7Wuf107701;
 Fri, 22 May 2020 19:15:52 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29;
 bh=P8ZP6K4/xt3ylvCMp8MZHgFiq7rDxmnUFrsxyF24niw=;
 b=q5bDJTLO3bvOlJpbFLzYiY+zFGvOCtW4abhd3IoqqZSYMvbHgqt/gkAQjGlMLFjJRrI8
 i5yscQLI9YVIG2y7CiL5M5Snxv6dwK8hz7kAmeJyjw5DCJBInlOWzo4ybfX7rNS3ukXO
 izU8S8TFUn1f2yDpSkCML+eyXgOGuajahv/LiAWEaSMT5ph/D4j5GOAp71rA0Jd8Wpm4
 w36PICB1uT7UbqCPtqsj7qAmN41dyTEh9JYVMfXZzmJbrgYoq1qh7gwveig8c8/1ou2i
 RXKzw96TiR7TOd02nHDrLu9xd0uL+GkQYXsLIJm4S7WMJnQJqHzrBjnZpKa6nMbOC+aD fg== 
Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80])
 by userp2120.oracle.com with ESMTP id 31501rnwmt-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Fri, 22 May 2020 19:15:52 +0000
Received: from pps.filterd (userp3030.oracle.com [127.0.0.1])
 by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04MJ8aQw106657;
 Fri, 22 May 2020 19:15:52 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by userp3030.oracle.com with ESMTP id 314gmbnqqb-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 22 May 2020 19:15:52 +0000
Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 04MJFoLF006352;
 Fri, 22 May 2020 19:15:51 GMT
MIME-Version: 1.0
Message-ID: <efe30ee3-5b65-40e5-bb45-b527879bb089@default>
Date: Fri, 22 May 2020 12:15:50 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: philip@HIDDEN, Juri Linkov <juri@HIDDEN>
Subject: RE: bug#41438: [PATCH] Allow windmove keys to be bound without prefix
 or modifiers
References: <874ks9rkyd.fsf@HIDDEN> <(message> <from> <Juri> <Linkov>
 <on> <Fri> <22> <May> <2020> <01:18:18> <+0300)>
 <87v9kn7rnk.fsf@bulbul>
In-Reply-To: <87v9kn7rnk.fsf@bulbul>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.5005.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9629
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0
 mlxlogscore=886
 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 suspectscore=0
 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2004280000 definitions=main-2005220150
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9629
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 lowpriorityscore=0 spamscore=0
 mlxlogscore=920 clxscore=1011 priorityscore=1501 cotscore=-2147483648
 impostorscore=0 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0
 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.12.0-2004280000 definitions=main-2005220150
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, emacs-devel@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Please don't send the same mail to both the bug list and emacs-devel.  Thx.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 22 May 2020 18:26:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 22 14:26:19 2020
Received: from localhost ([127.0.0.1]:60360 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jcCN9-0003I1-Be
	for submit <at> debbugs.gnu.org; Fri, 22 May 2020 14:26:19 -0400
Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:42001)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philip@HIDDEN>) id 1jcCN7-0003Hn-9l
 for 41438 <at> debbugs.gnu.org; Fri, 22 May 2020 14:26:17 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.west.internal (Postfix) with ESMTP id 2D220A21;
 Fri, 22 May 2020 14:26:11 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Fri, 22 May 2020 14:26:11 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h=
 from:to:cc:subject:in-reply-to:date:message-id:mime-version
 :content-type; s=fm3; bh=7s5KkJhH9MWW4tyxcvGWmRtv4GpogGS7Fs9OmIH
 PGAA=; b=eZ3jkOHW0Y+bq7CzF5QxT/D3Rne1t3ZaJ5gG7MTu5AkHAEL2UHW4+pS
 tr5i5CkftH36gMe9a+u86XF9fE4K0FMFIE8yCLiLmimV1qGMXx10578vHtJMEXHf
 C0YktMqUgWgShMhOV6akzE1PSMM/j8ct9F7L9j+CihzRTQ+bnXAJf6Yepj5c7tfp
 PXxZZAYYHO7J5CN2d6v7aQ3rgdlsnMbjmvgO04iuIszMqunOJxd9e0mlhTwNgt6O
 +bWL+m539CKzvBprXRNyuM0dXCJQZsW0v4LscMKv98ZXjNNkSclsXUgiLWGJz3yX
 /okfXueKhGXuvQxCCKqYLRyAzcNfAYQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:date:from:in-reply-to
 :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=7s5KkJhH9MWW4tyxc
 vGWmRtv4GpogGS7Fs9OmIHPGAA=; b=d7ZkM5IDZfACzPIXN3rpWcPiCR3qvhER9
 qcguhBnGVSj3q3Q+eDT+Zd67ryeWa5YflImK1t05o5SyzpA9tE2KIuxrjLYj4Ony
 txVCxNzxSeLAoWBmeWTirPkcsjj0nG5LjqZKwoN6rjEWApwsNeGKfJD5xqitfFJ2
 sWb8eMA4Fs/YuS5H/SrMsexxLVnScxU7kwgc7DXgtjJu0xmZN1mKVZADU/c0T/FV
 R4y5SqxLrT1yHVJQX1mNZDjCFs4EWDQMqy3w7mDPn8POJ2GQOLIlZcBaROYjH3ie
 HjdGVRsyx8ks7LkAocinw+C1xuYeOTk3+MNil9J1gqAgkPcBF41cA==
X-ME-Sender: <xms:QhnIXu2VuHpThejTFcEDbxUCLieO9UclFr8GKREhn2uVoou68Zg2Gg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddufedguddvfecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefhvffujgffkfggtgesmhdtreertddttdenucfhrhhomhepphhhihhlihhp
 seifrghrphhmrghilhdrnhgvthculdfrhhhilhhiphcumfdrmdenucggtffrrghtthgvrh
 hnpeegfeffieeljedujeekudduffehhefhhfejvdefvdffgfejtddtvdeuffeutdetteen
 ucfkphepjeelrddvudelrdduleelrdegjeenucevlhhushhtvghrufhiiigvpedtnecurf
 grrhgrmhepmhgrihhlfhhrohhmpehphhhilhhiphesfigrrhhpmhgrihhlrdhnvght
X-ME-Proxy: <xmx:QhnIXhHgvBuRxpnV_w0mpSciY5hEtbAA080sOhtox7DTXul8Dha4yg>
 <xmx:QhnIXm4Fx8XgvTD6UdVoLRjicB9EeHJGT_gaUb_Yn60wsddzHfCJDA>
 <xmx:QhnIXv2P6a5OxulgczApNgZSKTGcuEmFashtSfaSBF-qcdUcf-aP2g>
 <xmx:QhnIXgykvEMgKBSJAaKRhkAcs5QntBXvxinrVqepNx87D26eoDrkvg>
Received: from localhost (p4fdbc72f.dip0.t-ipconnect.de [79.219.199.47])
 by mail.messagingengine.com (Postfix) with ESMTPA id 4DB653280059;
 Fri, 22 May 2020 14:26:10 -0400 (EDT)
From: philip@HIDDEN (Philip K.)
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
In-Reply-To: <874ks9rkyd.fsf@HIDDEN> (message from Juri Linkov on Fri,
 22 May 2020 01:18:18 +0300)
Date: Fri, 22 May 2020 20:26:07 +0200
Message-ID: <87v9kn7rnk.fsf@bulbul>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org, emacs-devel@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Juri Linkov <juri@HIDDEN> writes:

>> 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.
>
> I think that adding defcustoms (including a new const `none')
> would be the most natural way to customize windmove modifiers
> (provided that the existing functions should remain).

I made a first concept, but it doesn't work unless windmove is explicity
required (see below). As far as I know, autoloading variables isn't good
style, so is there any other way to invoke the :set property of a user
option?

-- 
	Philip K.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Implement-user-options-for-windmove-modifiers-and-pr.patch

From b35173936e681e170172eb3d4548a2f91f70dad3 Mon Sep 17 00:00:00 2001
From: Philip K <philip@HIDDEN>
Date: Fri, 22 May 2020 20:21:59 +0200
Subject: [PATCH] Implement user options for windmove modifiers and prefixes

---
 lisp/windmove.el | 103 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 95 insertions(+), 8 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index 3d7f86b9af..95f74bfb81 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -162,6 +162,19 @@ windmove-window-distance-delta
 (make-obsolete-variable 'windmove-window-distance-delta
                         "no longer used." "27.1")
 
+(defconst windmove-modifier-type
+  '(choice (set :tag "Modifier Symbols"
+                :greedy t
+                ;; See `(elisp) Keyboard Events'
+                (const :tag "Meta" meta)
+                (const :tag "Control" control)
+                (const :tag "Shift" shift)
+                (const :tag "Hyper" hyper)
+                (const :tag "Super" super)
+                (const :tag "Alt" alt))
+           (const :tag "No modifier" none))
+  "Customisation type for windmove modifiers")
+
 
 ;; Note:
 ;;
@@ -419,6 +432,7 @@ windmove-down
   (interactive "P")
   (windmove-do-window-select 'down (and arg (prefix-numeric-value arg))))
 
+(defvar windmove-modifiers)
 
 ;;; set up keybindings
 ;; Idea for this function is from iswitchb.el, by Stephen Eglen
@@ -433,9 +447,10 @@ windmove-default-keybindings
 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'."
+Default value of MODIFIERS is stored in `windmove-modifiers'."
   (interactive)
-  (unless modifiers (setq modifiers 'shift))
+  (unless modifiers
+    (setq modifiers windmove-modifiers))
   (when (eq modifiers 'none) (setq modifiers nil))
   (unless (listp modifiers) (setq modifiers (list modifiers)))
   (global-set-key (vector (append modifiers '(left)))  'windmove-left)
@@ -443,6 +458,25 @@ windmove-default-keybindings
   (global-set-key (vector (append modifiers '(up)))    'windmove-up)
   (global-set-key (vector (append modifiers '(down)))  'windmove-down))
 
+;; has to be declared AFTER windmove-default-keybindings, or else
+;; windmove is recursivly loaded
+;;;###autoload
+(defcustom windmove-modifiers '(shift super)
+  "Modifiers for `windmove-default-keybindings'.
+Can either be a symbol or list of modifier symbols,
+i.e. `meta',`control', `shift', `hyper', `super', or `alt'
+representing modifier keys to use with the arrow keys.
+
+If the value is just `none', the arrow keys will be directly
+bound to the windmove functions."
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (when val
+           (windmove-swap-states-default-keybindings val))
+         (set-default sym val)))
+
 
 ;;; Directional window display and selection
 
@@ -565,6 +599,8 @@ windmove-display-new-tab
   (interactive "P")
   (windmove-display-in-direction 'new-tab arg))
 
+(defvar windmove-display-modifiers)
+
 ;;;###autoload
 (defun windmove-display-default-keybindings (&optional modifiers)
   "Set up keybindings for directional buffer display.
@@ -573,7 +609,7 @@ windmove-display-default-keybindings
 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'."
+Default value of MODIFIERS is stored in `windmove-display-modifiers'."
   (interactive)
   (unless modifiers (setq modifiers '(shift meta)))
   (when (eq modifiers 'none) (setq modifiers nil))
@@ -586,6 +622,17 @@ windmove-display-default-keybindings
   (global-set-key (vector (append modifiers '(?f)))    'windmove-display-new-frame)
   (global-set-key (vector (append modifiers '(?t)))    'windmove-display-new-tab))
 
+(defcustom windmove-display-modifiers '(shift meta)
+  "Modifiers for `windmove-display-default-keybindings'.
+Analogous to `windmove-modifiers'."
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (when val
+           (windmove-display-default-keybindings val))
+         (set-default sym val)))
+
 
 ;;; Directional window deletion
 
@@ -640,6 +687,9 @@ windmove-delete-down
   (interactive "P")
   (windmove-delete-in-direction 'down arg))
 
+(defvar windmove-delete-prefix)
+(defvar windmove-delete-modifiers)
+
 ;;;###autoload
 (defun windmove-delete-default-keybindings (&optional prefix modifiers)
   "Set up keybindings for directional window deletion.
@@ -649,12 +699,13 @@ windmove-delete-default-keybindings
 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'."
+The default values for PREFIX and MODIFIERS are stored in `windmove-delete-prefix'
+and `windmove-delete-modifiers' respectively."
   (interactive)
-  (unless prefix (setq prefix '(?\C-x)))
+  (unless prefix (setq prefix (list windmove-delete-prefix)))
   (when (eq prefix 'none) (setq prefix nil))
   (unless (listp prefix) (setq prefix (list prefix)))
-  (unless modifiers (setq modifiers '(shift)))
+  (unless modifiers (setq modifiers windmove-delete-modifiers))
   (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)
@@ -662,6 +713,28 @@ windmove-delete-default-keybindings
   (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
   (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))
 
+(defcustom windmove-delete-prefix (kbd "C-x")
+  "Prefix for `windmove-delete-default-keybindings'."
+  :type 'key-sequence
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (windmove-delete-default-keybindings
+          val windmove-delete-modifiers)
+         (set-default sym val)))
+
+(defcustom windmove-delete-modifiers '(shift)
+  "Modifiers for `windmove-delete-default-keybindings'.
+See `windmove-modifiers' for more details"
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (when val
+           (windmove-delete-default-keybindings
+            windmove-delete-prefix val))
+         (set-default sym val)))
+
 
 ;;; Directional window swap states
 
@@ -700,6 +773,8 @@ windmove-swap-states-right
   (interactive)
   (windmove-swap-states-in-direction 'right))
 
+(defvar windmove-swap-states-modifiers)
+
 ;;;###autoload
 (defun windmove-swap-states-default-keybindings (&optional modifiers)
   "Set up keybindings for directional window swap states.
@@ -709,9 +784,10 @@ windmove-swap-states-default-keybindings
 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'."
+Default value of MODIFIERS is stored in `windmove-swap-states-modifiers'."
   (interactive)
-  (unless modifiers (setq modifiers '(shift super)))
+  (unless modifiers
+    (setq modifiers windmove-swap-states-modifiers))
   (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)
@@ -719,6 +795,17 @@ windmove-swap-states-default-keybindings
   (global-set-key (vector (append modifiers '(up)))    'windmove-swap-states-up)
   (global-set-key (vector (append modifiers '(down)))  'windmove-swap-states-down))
 
+(defcustom windmove-swap-states-modifiers
+  '(shift super)
+  "Modifiers for `windmove-swap-states-default-keybindings'.
+Analogous to `windmove-modifiers'."
+  :type windmove-modifier-type
+  :require 'windmove
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym val)
+         (windmove-swap-states-default-keybindings val)
+         (set-default sym val)))
+
 
 (provide 'windmove)
 
-- 
2.20.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at 41438 <at> debbugs.gnu.org:


Received: (at 41438) by debbugs.gnu.org; 21 May 2020 22:33:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 21 18:33:44 2020
Received: from localhost ([127.0.0.1]:57491 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jbtl2-0000r6-2n
	for submit <at> debbugs.gnu.org; Thu, 21 May 2020 18:33:44 -0400
Received: from relay11.mail.gandi.net ([217.70.178.231]:59629)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1jbtkw-0000qp-LZ
 for 41438 <at> debbugs.gnu.org; Thu, 21 May 2020 18:33:43 -0400
Received: from mail.gandi.net (m91-129-97-200.cust.tele2.ee [91.129.97.200])
 (Authenticated sender: juri@HIDDEN)
 by relay11.mail.gandi.net (Postfix) with ESMTPSA id 7EC1810000B;
 Thu, 21 May 2020 22:33:30 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: "Philip K." <philip@HIDDEN>
Subject: Re: bug#41438: [PATCH] Allow windmove keys to be bound without
 prefix or modifiers
Organization: LINKOV.NET
References: <87imgpw7k3.fsf@HIDDEN>
Date: Fri, 22 May 2020 01:18:18 +0300
In-Reply-To: <87imgpw7k3.fsf@HIDDEN> (Philip K.'s message of "Thu, 21
 May 2020 18:56:28 +0200")
Message-ID: <874ks9rkyd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41438
Cc: 41438 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> 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.

Thanks, since `nil' means a default binding it seems there is no other way
than using a pseudo-modifier `none'.

> 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.

I think that adding defcustoms (including a new const `none')
would be the most natural way to customize windmove modifiers
(provided that the existing functions should remain).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 May 2020 16:56:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 21 12:56:39 2020
Received: from localhost ([127.0.0.1]:57197 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jboUo-0001Jg-Qz
	for submit <at> debbugs.gnu.org; Thu, 21 May 2020 12:56:39 -0400
Received: from lists.gnu.org ([209.51.188.17]:55240)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philip@HIDDEN>) id 1jboUm-0001JW-8j
 for submit <at> debbugs.gnu.org; Thu, 21 May 2020 12:56:37 -0400
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 <philip@HIDDEN>)
 id 1jboUl-0004JG-V7
 for bug-gnu-emacs@HIDDEN; Thu, 21 May 2020 12:56:35 -0400
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 <philip@HIDDEN>)
 id 1jboUk-0000fp-Ge
 for bug-gnu-emacs@HIDDEN; Thu, 21 May 2020 12:56:35 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.nyi.internal (Postfix) with ESMTP id 751DD5C00CF
 for <bug-gnu-emacs@HIDDEN>; Thu, 21 May 2020 12:56:31 -0400 (EDT)
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: <xms:v7LGXvVFK-QsBQ7MNiJqYMnwzeeFoWKXlvQXULidQhan-6Va7TTVVg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudduuddguddtudcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesmhdtreertd
 dttdenucfhrhhomhepfdfrhhhilhhiphcumfdrfdcuoehphhhilhhiphesfigrrhhpmhgr
 ihhlrdhnvghtqeenucggtffrrghtthgvrhhnpefgtdduhfdtleetjeeihedtkeejgfejgf
 fftdetkeeftddvtefghfejvdeltdejfeenucfkphepjeelrddvudelrdduleelrdegjeen
 ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilh
 hiphesfigrrhhpmhgrihhlrdhnvght
X-ME-Proxy: <xmx:v7LGXnkDGUNZOwfTLCIbqaFCtvkSxGzKKasVJ_UD7D1rJ3Mx23eWoQ>
 <xmx:v7LGXraIsSO9Jbr0QdF5rvOfPbbtTwOOvM3FDeF0pQVriBVPr9YOTQ>
 <xmx:v7LGXqUlFtQEW7DQm9AnLQyTL6ZnuEmvfUreumHwLm_rKcoNP6XjPA>
 <xmx:v7LGXrll-YMqzxBFB8nRMVSyJa_OiMRIB30rQBSVEwzIjopCIcptGQ>
Received: from localhost (p4fdbc72f.dip0.t-ipconnect.de [79.219.199.47])
 by mail.messagingengine.com (Postfix) with ESMTPA id DC4E73066491
 for <bug-gnu-emacs@HIDDEN>; Thu, 21 May 2020 12:56:30 -0400 (EDT)
From: "Philip K." <philip@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Allow windmove keys to be bound without prefix or modifiers
Date: Thu, 21 May 2020 18:56:28 +0200
Message-ID: <87imgpw7k3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=66.111.4.25; envelope-from=philip@HIDDEN;
 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-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

--=-=-=
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 <philip@HIDDEN>
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


--=-=-=--




Acknowledgement sent to "Philip K." <philip@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#41438; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 3 Jun 2021 20:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.