Function: viper-add-local-keys

viper-add-local-keys is a byte-compiled function defined in viper-keym.el.gz.

Signature

(viper-add-local-keys STATE ALIST)

Documentation

Override some vi-state or insert-state bindings in the current buffer.

The effect is seen in the current buffer only.
Useful for customizing mailer buffers, gnus, etc.
STATE is vi-state, insert-state, or emacs-state. ALIST is of the form ((KEY . FUNC) (KEY . FUNC) ...) Normally, this would be called from a hook to a major mode or on a per buffer basis. Usage:
      (viper-add-local-keys state '((key-str . func) (key-str . func)...))

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-keym.el.gz
;;; Code

(defun viper-add-local-keys (state alist)
  "Override some vi-state or insert-state bindings in the current buffer.
The effect is seen in the current buffer only.
Useful for customizing  mailer buffers, gnus, etc.
STATE is `vi-state', `insert-state', or `emacs-state'.
ALIST is of the form ((KEY . FUNC) (KEY . FUNC) ...)
Normally, this would be called from a hook to a major mode or
on a per buffer basis.
Usage:
      (viper-add-local-keys state \\='((key-str . func) (key-str . func)...))"

  (let (map)
    (cond ((eq state 'vi-state)
	   (if viper-need-new-vi-local-map
	       (setq viper-vi-local-user-map (make-sparse-keymap)))
	   (setq viper-need-new-vi-local-map nil
		 map viper-vi-local-user-map))
	  ((eq state 'insert-state)
	   (if viper-need-new-insert-local-map
	       (setq viper-insert-local-user-map (make-sparse-keymap)))
	   (setq viper-need-new-insert-local-map nil
		 map viper-insert-local-user-map))
	  ((eq state 'emacs-state)
	   (if viper-need-new-emacs-local-map
	       (setq viper-emacs-local-user-map (make-sparse-keymap)))
	   (setq viper-need-new-emacs-local-map nil
		 map viper-emacs-local-user-map))
	  (t
	   (error
	    "Invalid state in viper-add-local-keys: %S.  Valid states: vi-state, insert-state or emacs-state" state)))

    (viper-modify-keymap map alist)
    (viper-normalize-minor-mode-map-alist)
    (viper-set-mode-vars-for viper-current-state)))