From 185759e07adc9acda25eff7e1d551619cfba874b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 27 Aug 2021 17:27:52 +0200 Subject: [PATCH] Fix `M-X TAB' completion for commands marked for multiple modes * lisp/simple.el (command-completion-using-modes-p): Fix completion over commands that are defined for multiple modes (bug#50228). --- lisp/simple.el | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index db083cfc25d..d6c448b36a5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2070,7 +2070,7 @@ This function uses the `read-extended-command-predicate' user option." "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. + ;; Common fast case: Just a single mode. (if (null (cdr modes)) (or (provided-mode-derived-p (buffer-local-value 'major-mode buffer) (car modes)) @@ -2078,13 +2078,7 @@ This function uses the `read-extended-command-predicate' user option." (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)))) + (command-completion-with-modes-p modes buffer)))) (defun command-completion-default-include-p (symbol buffer) "Say whether SYMBOL should be offered as a completion. -- 2.39.2