"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))
(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.