From: Stefan Kangas Date: Fri, 5 Aug 2022 10:55:28 +0000 (+0200) Subject: Fix namespace problems in viper.el X-Git-Tag: emacs-29.0.90~1447^2~415 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=010e2e5e5e2c45c9aab08dffbe83f9acb4a87191;p=emacs.git Fix namespace problems in viper.el * lisp/emulation/viper.el (viper-this-major-mode-requires-vi-state): Rename from 'this-major-mode-requires-vi-state'. Retain old name as an obsolete alias. (viper-set-state-in-major-mode): Rename from 'set-viper-state-in-major-mode'. Retain old name as an obsolete alias. --- diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index be87d788e92..4c2ee1ce232 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -605,7 +605,7 @@ This startup message appears whenever you load Viper, unless you type \\`y' now. ;; 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) @@ -634,7 +634,7 @@ This startup message appears whenever you load Viper, unless you type \\`y' now. (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) ))) @@ -786,12 +786,12 @@ It also can't undo some Viper settings." (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) @@ -810,7 +810,7 @@ It also can't undo some Viper settings." ;; 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 @@ -820,7 +820,7 @@ It also can't undo some Viper settings." (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 @@ -891,7 +891,7 @@ Two differences: (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) @@ -1242,12 +1242,15 @@ These two lines must come in the order given.")) (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