Function: viper-modify-major-mode

viper-modify-major-mode is a byte-compiled function defined in viper-keym.el.gz.

Signature

(viper-modify-major-mode MODE STATE KEYMAP)

Documentation

Modify key bindings in a major-mode in a Viper state using a keymap.

If the default for a major mode is emacs-state, then modifications to this major mode may not take effect until the buffer switches state to Vi, Insert or Emacs. If this happens, add viper-change-state-to-emacs to this major mode's hook. If no such hook exists, you may have to put an advice on the function that invokes the major mode. See viper-set-hooks for hints.

The above needs not to be done for major modes that come up in Vi or Insert state by default.

Arguments: (major-mode viper-state keymap)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-keym.el.gz
(defun viper-modify-major-mode (mode state keymap)
  "Modify key bindings in a major-mode in a Viper state using a keymap.

If the default for a major mode is emacs-state, then modifications to this
major mode may not take effect until the buffer switches state to Vi,
Insert or Emacs.  If this happens, add viper-change-state-to-emacs to this
major mode's hook.  If no such hook exists, you may have to put an advice on
the function that invokes the major mode.  See viper-set-hooks for hints.

The above needs not to be done for major modes that come up in Vi or Insert
state by default.

Arguments: (major-mode viper-state keymap)"
  (let* ((alist
	  (cond ((eq state 'vi-state) 'viper-vi-state-modifier-alist)
                ((eq state 'insert-state) 'viper-insert-state-modifier-alist)
                ((eq state 'emacs-state) 'viper-emacs-state-modifier-alist))))
    (setf (alist-get mode (symbol-value alist)) keymap)

    ;; Normalization usually doesn't help here, since one needs to
    ;; normalize in the actual buffer where changes to the keymap are
    ;; to take place.  However, it doesn't hurt, and it helps whenever this
    ;; function is actually called from within the affected buffer.
    (viper-normalize-minor-mode-map-alist)

    (viper-set-mode-vars-for viper-current-state)))