Show
Ignore:
Timestamp:
08/06/05 09:04:04 (3 years ago)
Author:
miyoshi
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • vendor/emacs-CVS_HEAD/lisp/emulation/viper-keym.el

    r3756 r3799  
    11;;; viper-keym.el --- Viper keymaps 
    22 
    3 ;; Copyright (C) 1994, 95, 96, 97, 2000, 01, 02, 2005 Free Software Foundation, Inc. 
     3;; Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 
     4;;   2005 Free Software Foundation, Inc. 
    45 
    56;; Author: Michael Kifer <kifer@cs.stonybrook.edu> 
     
    1920;; You should have received a copy of the GNU General Public License 
    2021;; along with GNU Emacs; see the file COPYING.  If not, write to the 
    21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330
    22 ;; Boston, MA 02111-1307, USA. 
     22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
     23;; Boston, MA 02110-1301, USA. 
    2324 
    2425;;; Commentary: 
     
    5152;;; Variables 
    5253 
    53 (defcustom viper-toggle-key "\C-z" 
    54   "The key used to change states from emacs to Vi and back. 
    55 In insert mode, this key also functions as Meta. 
    56 Must be set in .viper file or prior to loading Viper. 
    57 This setting cannot be changed interactively." 
    58   :type 'string 
    59   :group 'viper) 
    60  
    61 (defcustom viper-quoted-insert-key "\C-v" 
    62   "The key used to quote special characters when inserting them in Insert state." 
    63   :type 'string 
    64   :group 'viper) 
    65  
    66 (defcustom viper-ESC-key "\e" 
    67   "Key used to ESC. 
    68 Must be set in .viper file or prior to loading Viper. 
    69 This setting cannot be changed interactively." 
    70   :type 'string 
    71   :group 'viper) 
    7254 
    7355;;; Emacs keys in other states. 
     
    177159(defvar viper-mode-map (make-sparse-keymap)) 
    178160 
     161;; Some important keys used in viper 
     162(defcustom viper-toggle-key [(control ?z)]  ; "\C-z" 
     163  "The key used to change states from emacs to Vi and back. 
     164In insert mode, this key also functions as Meta. 
     165 
     166Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]." 
     167  :type 'sexp 
     168  :group 'viper 
     169  :set (lambda (symbol value) 
     170         (let ((old-value (if (boundp 'viper-toggle-key) 
     171                              viper-toggle-key 
     172                            [(control ?z)]))) 
     173           (mapcar 
     174            (lambda (buf) 
     175              (save-excursion 
     176                (set-buffer buf) 
     177                (when (and (boundp 'viper-insert-basic-map) 
     178                           (keymapp viper-insert-basic-map)) 
     179                  (when old-value 
     180                    (define-key viper-insert-basic-map old-value nil)) 
     181                  (define-key viper-insert-basic-map value 'viper-escape-to-vi)) 
     182                (when (and (boundp 'viper-vi-intercept-map) 
     183                           (keymapp viper-vi-intercept-map)) 
     184                  (when old-value 
     185                    (define-key viper-vi-intercept-map old-value nil)) 
     186                  (define-key 
     187                    viper-vi-intercept-map value 'viper-toggle-key-action)) 
     188                (when (and (boundp 'viper-emacs-intercept-map) 
     189                           (keymapp viper-emacs-intercept-map)) 
     190                  (define-key viper-emacs-intercept-map old-value nil) 
     191                  (define-key 
     192                    viper-emacs-intercept-map value 'viper-change-state-to-vi)) 
     193                )) 
     194            (buffer-list)) 
     195           (set-default symbol value) 
     196           ))) 
     197 
     198(defcustom viper-quoted-insert-key "\C-v" 
     199  "The key used to quote special characters when inserting them in Insert state." 
     200  :type 'string 
     201  :group 'viper) 
     202 
     203(defcustom viper-ESC-key [(escape)]  ; "\e" 
     204  "Key used to ESC. 
     205Enter as a sexp. Examples: \"\\e\", [(escape)]." 
     206  :type 'sexp 
     207  :group 'viper 
     208  :set (lambda (symbol value) 
     209         (let ((old-value (if (boundp 'viper-ESC-key) 
     210                              viper-ESC-key 
     211                            [(escape)]))) 
     212           (mapcar 
     213            (lambda (buf) 
     214              (save-excursion 
     215                (set-buffer buf) 
     216                (when (and (boundp 'viper-insert-intercept-map) 
     217                           (keymapp viper-insert-intercept-map)) 
     218                  (when old-value 
     219                    (define-key viper-insert-intercept-map old-value nil)) 
     220                  (define-key 
     221                    viper-insert-intercept-map value 'viper-intercept-ESC-key)) 
     222                (when (and (boundp 'viper-vi-intercept-map) 
     223                           (keymapp viper-vi-intercept-map)) 
     224                  (when old-value 
     225                    (define-key viper-vi-intercept-map old-value nil)) 
     226                  (define-key 
     227                    viper-vi-intercept-map value 'viper-intercept-ESC-key)) 
     228                )) 
     229            (buffer-list)) 
     230           (set-default symbol value) 
     231           ))) 
     232 
    179233 
    180234;;; Variables used by minor modes 
     
    197251;; to its Emacs state in various major modes. 
    198252(defvar viper-emacs-state-modifier-alist nil) 
     253 
     254;; The list of viper keymaps. Set by viper-normalize-minor-mode-map-alist 
     255(viper-deflocalvar viper--key-maps nil) 
     256(viper-deflocalvar viper--intercept-key-maps nil) 
    199257 
    200258;; Tells viper-add-local-keys to create a new viper-vi-local-user-map for new 
     
    510568(defun viper-zap-local-keys () 
    511569  "Unconditionally reset Viper viper-*-local-user-map's. 
    512 Rarely useful, but if u made a mistake by switching to a mode that adds 
     570Rarely useful, but if you made a mistake by switching to a mode that adds 
    513571undesirable local keys, e.g., comint-mode, then this function can restore 
    514572sanity."