From: Lars Ingebrigtsen Date: Fri, 27 Aug 2021 15:27:52 +0000 (+0200) Subject: Fix `M-X TAB' completion for commands marked for multiple modes X-Git-Tag: emacs-28.0.90~1287 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=185759e07adc9acda25eff7e1d551619cfba874b;p=emacs.git 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). --- 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.