;; Apply a little heuristic to invoke vi state on major-modes
;; that are not listed in viper-vi-state-mode-list
-(defun this-major-mode-requires-vi-state (mode)
+(defun viper-this-major-mode-requires-vi-state (mode)
(let ((major-mode mode))
(cond ((apply #'derived-mode-p viper-vi-state-mode-list) t)
((apply #'derived-mode-p viper-emacs-state-mode-list) nil)
(remove-hook symbol #'viper-minibuffer-post-command-hook)
(remove-hook symbol #'viper-minibuffer-setup-sentinel)
(remove-hook symbol #'viper-major-mode-change-sentinel)
- (remove-hook symbol #'set-viper-state-in-major-mode)
+ (remove-hook symbol #'viper-set-state-in-major-mode)
(remove-hook symbol #'viper-post-command-sentinel)
)))
(defvar viper-new-major-mode-buffer-list nil)
;; set appropriate Viper state in buffers that changed major mode
-(defun set-viper-state-in-major-mode ()
+(defun viper-set-state-in-major-mode ()
(mapc
(lambda (buf)
(if (viper-buffer-live-p buf)
(with-current-buffer buf
- (cond ((and (this-major-mode-requires-vi-state major-mode)
+ (cond ((and (viper-this-major-mode-requires-vi-state major-mode)
(eq viper-current-state 'emacs-state))
(viper-mode))
((cl-member-if #'derived-mode-p viper-emacs-state-mode-list)
;; clear the list of bufs that changed major mode
(setq viper-new-major-mode-buffer-list nil)
;; change the global value of hook
- (remove-hook 'viper-post-command-hooks #'set-viper-state-in-major-mode))
+ (remove-hook 'viper-post-command-hooks #'viper-set-state-in-major-mode))
;; sets up post-command-hook to turn viper-mode, if the current mode is
;; fundamental
(setq viper-new-major-mode-buffer-list
(cons (current-buffer) viper-new-major-mode-buffer-list))))
;; change the global value of hook
- (add-hook 'viper-post-command-hooks #'set-viper-state-in-major-mode t))
+ (add-hook 'viper-post-command-hooks #'viper-set-state-in-major-mode t))
;;; Handling of tty's ESC event
(viper-setup-ESC-to-escape t)
(add-hook 'change-major-mode-hook #'viper-major-mode-change-sentinel)
- (add-hook 'find-file-hook #'set-viper-state-in-major-mode)
+ (add-hook 'find-file-hook #'viper-set-state-in-major-mode)
;; keep this because many modes we don't know about use this hook
(defvar text-mode-hook)
(when (eq viper-current-state 'emacs-state)
(viper-change-state-to-emacs))
- (if (this-major-mode-requires-vi-state major-mode)
+ (if (viper-this-major-mode-requires-vi-state major-mode)
(viper-mode))
- (add-function :after initial-major-mode #'set-viper-state-in-major-mode))
-
+ (add-function :after initial-major-mode #'viper-set-state-in-major-mode))
+(define-obsolete-function-alias 'set-viper-state-in-major-mode
+ #'viper-set-state-in-major-mode "29.1")
+(define-obsolete-function-alias 'this-major-mode-requires-vi-state
+ #'viper-this-major-mode-requires-vi-state "29.1")
(run-hooks 'viper-load-hook) ; the last chance to change something