From 2800f91e221e0725db839aea4ae89423e533dfa3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 21 Aug 2023 17:11:16 -0400 Subject: [PATCH] Miscellaneous minor changes * evil-common.el (evil-with-delay): Add comment for last change. * evil-macros.el (font-lock-add-keywords): Use the font-lock faces rather than their obsolete variables. * evil-ex.el (evil-ex-define-argument-type): Make sure the function arguments can be compiled. (evil-ex-init-shell-argument-completion): Don't let-bind `completion-at-point-functions` because hooks aren't just variables. --- evil-common.el | 3 +++ evil-ex.el | 12 ++++++------ evil-macros.el | 8 ++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/evil-common.el b/evil-common.el index cd620d48..f7df526c 100644 --- a/evil-common.el +++ b/evil-common.el @@ -59,6 +59,9 @@ If LOCAL is non-nil, the buffer-local value of HOOK is modified." (macroexp-let2* nil ((fun-name `(make-symbol ,(or name (format "evil-delay-in-%s" hook-sym)))) + ;; `apply-partially' is used in case this macro is expanded + ;; (via `evil-define-key') in a file which still does not + ;; activate `lexical-binding'. (fun `(apply-partially (lambda (name &rest _) (when ,(or condition t) diff --git a/evil-ex.el b/evil-ex.el index 3c917f25..f400036c 100644 --- a/evil-ex.el +++ b/evil-ex.el @@ -635,13 +635,13 @@ and function: (func (pop body))) (cond ((eq key :runner) - (setq runner func)) + (setq runner `#',func)) ((eq key :collection) - (setq completer (cons 'collection func))) + (setq completer `(cons 'collection #',func))) ((eq key :completion-at-point) - (setq completer (cons 'completion-at-point func)))))) + (setq completer `(cons 'completion-at-point #',func)))))) `(evil--add-to-alist evil-ex-argument-types - ',arg-type '(,runner ,completer)))) + ',arg-type (list ,runner ,completer)))) (evil-ex-define-argument-type file "Handle a file argument." @@ -668,8 +668,8 @@ argument handler that requires shell completion." (require 'shell) ;; Set up Comint for Shell mode, except ;; `comint-completion-at-point' will be called manually. - (let (completion-at-point-functions) - (shell-completion-vars)))) + (shell-completion-vars) + (remove-hook 'completion-at-point-functions #'comint-completion-at-point t))) (evil-ex-define-argument-type shell "Shell argument type, supports completion." diff --git a/evil-macros.el b/evil-macros.el index 09b13966..0f7fd59e 100644 --- a/evil-macros.el +++ b/evil-macros.el @@ -759,13 +759,13 @@ via KEY-VALUE pairs. BODY should evaluate to a list of values. '(("(\\(evil-\\(?:ex-\\)?define-\ \\(?:[^ k][^ e][^ y]\\|[-[:word:]]\\{4,\\}\\)\\)\ \\>[ \f\t\n\r\v]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" - (1 font-lock-keyword-face) - (2 font-lock-function-name-face nil t)) + (1 'font-lock-keyword-face) + (2 'font-lock-function-name-face nil t)) ("(\\(evil-\\(?:delay\\|narrow\\|signal\\|save\\|with\\(?:out\\)?\\)\ \\(?:-[-[:word:]]+\\)?\\)\\>\[ \f\t\n\r\v]+" - 1 font-lock-keyword-face) + 1 'font-lock-keyword-face) ("(\\(evil-\\(?:[-[:word:]]\\)*loop\\)\\>[ \f\t\n\r\v]+" - 1 font-lock-keyword-face)))) + 1 'font-lock-keyword-face)))) (provide 'evil-macros)