From 08d6f48b4f7a295d3fd590ad6e5723beb3f0eadf Mon Sep 17 00:00:00 2001 From: Johannes Maier Date: Fri, 27 Aug 2021 09:40:08 +0200 Subject: [PATCH] Fix 'command-completion-using-modes-p' in case of multiple modes * lisp/simple.el: Use `command-completion-with-modes-p' inside of `command-completion-using-modes-p' instead of performing a faulty check (`or' was missing) in the case where `command-modes' returns multiple modes. --- lisp/simple.el | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index db083cfc25..82ab8927a7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2067,24 +2067,9 @@ read-extended-command t nil 'extended-command-history)))) (defun command-completion-using-modes-p (symbol buffer) - "Say whether SYMBOL has been marked as a mode-specific command in BUFFER." - ;; Check the modes. - (let ((modes (command-modes symbol))) - ;; Common case: Just a single mode. - (if (null (cdr modes)) - (or (provided-mode-derived-p - (buffer-local-value 'major-mode buffer) (car modes)) - (memq (car modes) - (buffer-local-value 'local-minor-modes buffer)) - (memq (car modes) global-minor-modes)) - ;; Uncommon case: Multiple modes. - (apply #'provided-mode-derived-p - (buffer-local-value 'major-mode buffer) - modes) - (seq-intersection modes - (buffer-local-value 'local-minor-modes buffer) - #'eq) - (seq-intersection modes global-minor-modes #'eq)))) + "Say whether SYMBOL has been marked as a mode-specific command in +BUFFER." + (command-completion-with-modes-p (command-modes symbol) buffer)) (defun command-completion-default-include-p (symbol buffer) "Say whether SYMBOL should be offered as a completion. -- 2.32.0