emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emulation/viper-keym.el


From: Michael Kifer
Subject: [Emacs-diffs] Changes to emacs/lisp/emulation/viper-keym.el
Date: Sun, 10 Jul 2005 14:46:31 -0400

Index: emacs/lisp/emulation/viper-keym.el
diff -c emacs/lisp/emulation/viper-keym.el:1.33 
emacs/lisp/emulation/viper-keym.el:1.34
*** emacs/lisp/emulation/viper-keym.el:1.33     Mon Jul  4 17:29:04 2005
--- emacs/lisp/emulation/viper-keym.el  Sun Jul 10 18:46:24 2005
***************
*** 50,74 ****
  
  ;;; Variables
  
- (defcustom viper-toggle-key "\C-z"
-   "The key used to change states from emacs to Vi and back.
- In insert mode, this key also functions as Meta.
- Must be set in .viper file or prior to loading Viper.
- This setting cannot be changed interactively."
-   :type 'string
-   :group 'viper)
- 
- (defcustom viper-quoted-insert-key "\C-v"
-   "The key used to quote special characters when inserting them in Insert 
state."
-   :type 'string
-   :group 'viper)
- 
- (defcustom viper-ESC-key "\e"
-   "Key used to ESC.
- Must be set in .viper file or prior to loading Viper.
- This setting cannot be changed interactively."
-   :type 'string
-   :group 'viper)
  
  ;;; Emacs keys in other states.
  
--- 50,55 ----
***************
*** 176,181 ****
--- 157,234 ----
  ;; and, after .viper is loaded, we add this keymap to viper-vi-basic-map.
  (defvar viper-mode-map (make-sparse-keymap))
  
+ ;; Some important keys used in viper
+ (defcustom viper-toggle-key [(control ?z)]  ; "\C-z"
+   "The key used to change states from emacs to Vi and back.
+ In insert mode, this key also functions as Meta.
+ 
+ Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]."
+   :type 'sexp
+   :group 'viper
+   :set (lambda (symbol value)
+        (let ((old-value (if (boundp 'viper-toggle-key)
+                             viper-toggle-key
+                           [(control ?z)])))
+          (mapcar
+           (lambda (buf)
+             (save-excursion
+               (set-buffer buf)
+               (when (and (boundp 'viper-insert-basic-map)
+                          (keymapp viper-insert-basic-map))
+                 (when old-value
+                   (define-key viper-insert-basic-map old-value nil))
+                 (define-key viper-insert-basic-map value 'viper-escape-to-vi))
+               (when (and (boundp 'viper-vi-intercept-map)
+                          (keymapp viper-vi-intercept-map))
+                 (when old-value
+                   (define-key viper-vi-intercept-map old-value nil))
+                 (define-key
+                   viper-vi-intercept-map value 'viper-toggle-key-action))
+               (when (and (boundp 'viper-emacs-intercept-map)
+                          (keymapp viper-emacs-intercept-map))
+                 (define-key viper-emacs-intercept-map old-value nil)
+                 (define-key
+                   viper-emacs-intercept-map value 'viper-change-state-to-vi))
+               ))
+           (buffer-list))
+          (set-default symbol value)
+            )))
+ 
+ (defcustom viper-quoted-insert-key "\C-v"
+   "The key used to quote special characters when inserting them in Insert 
state."
+   :type 'string
+   :group 'viper)
+ 
+ (defcustom viper-ESC-key [(escape)]  ; "\e"
+   "Key used to ESC.
+ Enter as a sexp. Examples: \"\\e\", [(escape)]."
+   :type 'sexp
+   :group 'viper
+   :set (lambda (symbol value)
+        (let ((old-value (if (boundp 'viper-ESC-key)
+                             viper-ESC-key
+                           [(escape)])))
+          (mapcar
+           (lambda (buf)
+             (save-excursion
+               (set-buffer buf)
+               (when (and (boundp 'viper-insert-intercept-map)
+                          (keymapp viper-insert-intercept-map))
+                 (when old-value
+                   (define-key viper-insert-intercept-map old-value nil))
+                 (define-key
+                   viper-insert-intercept-map value 'viper-intercept-ESC-key))
+               (when (and (boundp 'viper-vi-intercept-map)
+                          (keymapp viper-vi-intercept-map))
+                 (when old-value
+                   (define-key viper-vi-intercept-map old-value nil))
+                 (define-key
+                   viper-vi-intercept-map value 'viper-intercept-ESC-key))
+               ))
+           (buffer-list))
+          (set-default symbol value)
+            )))
+ 
  
  ;;; Variables used by minor modes
  
***************
*** 197,202 ****
--- 250,259 ----
  ;; to its Emacs state in various major modes.
  (defvar viper-emacs-state-modifier-alist nil)
  
+ ;; The list of viper keymaps. Set by viper-normalize-minor-mode-map-alist
+ (viper-deflocalvar viper--key-maps nil)
+ (viper-deflocalvar viper--intercept-key-maps nil)
+ 
  ;; Tells viper-add-local-keys to create a new viper-vi-local-user-map for new
  ;; buffers.  Not a user option.
  (viper-deflocalvar viper-need-new-vi-local-map t "")
***************
*** 509,515 ****
  
  (defun viper-zap-local-keys ()
    "Unconditionally reset Viper viper-*-local-user-map's.
! Rarely useful, but if u made a mistake by switching to a mode that adds
  undesirable local keys, e.g., comint-mode, then this function can restore
  sanity."
    (interactive)
--- 566,572 ----
  
  (defun viper-zap-local-keys ()
    "Unconditionally reset Viper viper-*-local-user-map's.
! Rarely useful, but if you made a mistake by switching to a mode that adds
  undesirable local keys, e.g., comint-mode, then this function can restore
  sanity."
    (interactive)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]