all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#29985: Allow modifier combinations in windmove-default-keybindings
@ 2018-01-04 21:47 Juri Linkov
  2018-01-11 22:10 ` Juri Linkov
  0 siblings, 1 reply; 2+ messages in thread
From: Juri Linkov @ 2018-01-04 21:47 UTC (permalink / raw)
  To: 29985

I propose to support a list of modifiers as an arg of
‘windmove-default-keybindings’ to be able to customize it
with e.g. (windmove-default-keybindings '(meta shift))

diff --git a/lisp/windmove.el b/lisp/windmove.el
index db77d81..f565068 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -543,16 +543,18 @@ windmove-down
 ;; probably want to use different bindings in that case.
 
 ;;;###autoload
-(defun windmove-default-keybindings (&optional modifier)
+(defun windmove-default-keybindings (&optional modifiers)
   "Set up keybindings for `windmove'.
-Keybindings are of the form MODIFIER-{left,right,up,down}.
-Default MODIFIER is `shift'."
+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'."
   (interactive)
-  (unless modifier (setq modifier 'shift))
-  (global-set-key (vector (list modifier 'left))  'windmove-left)
-  (global-set-key (vector (list modifier 'right)) 'windmove-right)
-  (global-set-key (vector (list modifier 'up))    'windmove-up)
-  (global-set-key (vector (list modifier 'down))  'windmove-down))
+  (unless modifiers (setq modifiers 'shift))
+  (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))
 
 
 (provide 'windmove)





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-11 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 21:47 bug#29985: Allow modifier combinations in windmove-default-keybindings Juri Linkov
2018-01-11 22:10 ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.