(windmove-default-keybindings): Add optional parameter to allow using a
authorJuanma Barranquero <lekktu@gmail.com>
Tue, 7 May 2002 16:37:46 +0000 (16:37 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Tue, 7 May 2002 16:37:46 +0000 (16:37 +0000)
modifier other than 'shift.

lisp/ChangeLog
lisp/windmove.el

index 3e17ef5..cd762c0 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-07  Juanma Barranquero  <lektu@terra.es>
+
+       * windmove.el (windmove-default-keybindings): Add optional
+       parameter to allow using a modifier other than 'shift.
+
 2002-05-07 Thomas Link <t.link@gmx.at>
 
        * filesets.el: 
index 0320fd0..fc5e864 100644 (file)
 ;;
 ;; 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:
 ;; 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)