From: Juanma Barranquero Date: Tue, 7 May 2002 16:37:46 +0000 (+0000) Subject: (windmove-default-keybindings): Add optional parameter to allow using a X-Git-Tag: ttn-vms-21-2-B4~15157 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=125d5ec7081f3b8e47b53f084509d6ce30b16664;p=emacs.git (windmove-default-keybindings): Add optional parameter to allow using a modifier other than 'shift. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3e17ef53aa4..cd762c0cc76 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2002-05-07 Juanma Barranquero + + * windmove.el (windmove-default-keybindings): Add optional + parameter to allow using a modifier other than 'shift. + 2002-05-07 Thomas Link * filesets.el: diff --git a/lisp/windmove.el b/lisp/windmove.el index 0320fd0aaef..fc5e864391c 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -98,7 +98,13 @@ ;; ;; Put the following line in your `.emacs' file: ;; -;; (windmove-default-keybindings) ; default keybindings +;; (windmove-default-keybindings) ; shifted arrow keys +;; +;; or +;; +;; (windmove-default-keybindings 'hyper) ; etc. +;; +;; to use another modifier key. ;; ;; ;; If you wish to enable wrap-around, also add a line like: @@ -110,7 +116,7 @@ ;; causes the occasional creation of a "lost column" between windows, ;; so that two adjacent windows do not actually touch, you may want to ;; increase the value of `windmove-window-distance-delta' to 2 or 3: -;; +;; ;; (setq windmove-window-distance-delta 2) ;; @@ -589,13 +595,16 @@ 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 () - "Set up default keybindings for `windmove'." +(defun windmove-default-keybindings (&optional modifier) + "Set up keybindings for `windmove'. +Keybindings are of the form MODIFIER-{left,right,up,down}. +Default MODIFIER is 'shift." (interactive) - (global-set-key [(shift left)] 'windmove-left) - (global-set-key [(shift up)] 'windmove-up) - (global-set-key [(shift right)] 'windmove-right) - (global-set-key [(shift down)] 'windmove-down)) + (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)) (provide 'windmove)