From 8bf186b2297dc0aeba76e8e743dec7efa6a568e4 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sat, 27 Mar 2021 19:25:38 +0000 Subject: [PATCH] Demote read-extended-command-predicate errors For discussion, see the following thread: https://lists.gnu.org/r/emacs-devel/2021-03/msg00682.html * lisp/simple.el (read-extended-command): Demote errors when calling read-extended-command-predicate so M-x completion doesn't break. --- lisp/simple.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 959bd831170..c48e644345b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2005,9 +2005,14 @@ This function uses the `read-extended-command-predicate' user option." (complete-with-action action obarray string pred))) (lambda (sym) (and (commandp sym) - (or (null read-extended-command-predicate) - (and (functionp read-extended-command-predicate) - (funcall read-extended-command-predicate sym buffer))))) + (cond ((null read-extended-command-predicate)) + ((functionp read-extended-command-predicate) + ;; Don't let bugs break M-x completion; interpret + ;; them as the absence of a predicate. + (condition-case-unless-debug err + (funcall read-extended-command-predicate sym buffer) + (error (message "read-extended-command-predicate: %s: %s" + sym (error-message-string err)))))))) t nil 'extended-command-history)))) (defun command-completion-using-modes-p (symbol buffer) -- 2.39.2