summaryrefslogtreecommitdiff
path: root/lisp/windmove.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2018-01-12 00:10:39 +0200
committerJuri Linkov <juri@linkov.net>2018-01-12 00:10:39 +0200
commitad283dfb22770e241347a2f9b00241795e5250f4 (patch)
tree6c81f712908c0bfb2b5162753ed3b10fba336702 /lisp/windmove.el
parente6266cb95ce9ea7e8fdcc1e2298bcb0513416f3e (diff)
downloademacs-ad283dfb22770e241347a2f9b00241795e5250f4.tar.gz
* lisp/windmove.el (windmove-default-keybindings): Allow list of modifiers.
(Bug#29985)
Diffstat (limited to 'lisp/windmove.el')
-rw-r--r--lisp/windmove.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/windmove.el b/lisp/windmove.el
index db77d810e05..f5650684097 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -543,16 +543,18 @@ If no window is at the desired location, an error is signaled."
;; 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)