From 41cbd533d7fb770ef3ce8a8a88180f9e0e1ecc54 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sun, 14 Mar 2021 12:52:31 +0000 Subject: [PATCH] Demote completion-predicate errors For discussion, see the following thread: https://lists.gnu.org/r/emacs-devel/2021-03/msg00682.html * lisp/simple.el (command-completion-default-include-p): Demote errors when calling completion-predicate so M-x doesn't break. --- lisp/simple.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 98fccf4ff2..295c01e21f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2025,7 +2025,12 @@ command-completion-default-include-p BUFFER." (if (get symbol 'completion-predicate) ;; An explicit completion predicate takes precedence. - (funcall (get symbol 'completion-predicate) symbol buffer) + ;; Demote any errors so M-x continues to work. + (condition-case-unless-debug err + (funcall (get symbol 'completion-predicate) symbol buffer) + (error + (message "command-completion-default-include-p: %s: %S" symbol err) + nil)) (or (null (command-modes symbol)) (command-completion-using-modes-p symbol buffer)))) -- 2.30.1