[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7bfb35f8a7: Make M-S-x output better in mode that have bindings f
From: |
Lars Ingebrigtsen |
Subject: |
master 7bfb35f8a7: Make M-S-x output better in mode that have bindings for `undefined' |
Date: |
Sun, 19 Jun 2022 09:48:18 -0400 (EDT) |
branch: master
commit 7bfb35f8a7b364877c5a07297f16bc38d00f1989
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Make M-S-x output better in mode that have bindings for `undefined'
* lisp/simple.el (command-completion-using-modes-p): Speed up case
when there's no command modes.
(execute-extended-command-for-buffer): Make M-S-x output better
(bug#46665).
---
lisp/simple.el | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lisp/simple.el b/lisp/simple.el
index 99c951b24b..f2b3d82a7a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2299,7 +2299,7 @@ This function uses the `read-extended-command-predicate'
user option."
(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)))
+ (when-let ((modes (command-modes symbol)))
;; Common fast case: Just a single mode.
(if (null (cdr modes))
(or (provided-mode-derived-p
@@ -2539,7 +2539,16 @@ maps."
(read-extended-command-predicate
(lambda (symbol buffer)
(or (command-completion-using-modes-p symbol buffer)
- (where-is-internal symbol keymaps)))))
+ ;; Include commands that are bound in a keymap in the
+ ;; current buffer.
+ (and (where-is-internal symbol keymaps)
+ ;; But not if they have a command predicate that
+ ;; says that they shouldn't. (This is the case
+ ;; for `ignore' and `undefined' and similar
+ ;; commands commonly found in keymaps.)
+ (or (null (get symbol 'completion-predicate))
+ (funcall (get symbol 'completion-predicate)
+ symbol buffer)))))))
(list current-prefix-arg
(read-extended-command)
execute-extended-command--last-typed)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 7bfb35f8a7: Make M-S-x output better in mode that have bindings for `undefined',
Lars Ingebrigtsen <=