]> git.eshelyaron.com Git - emacs.git/commitdiff
Demote read-extended-command-predicate errors
authorBasil L. Contovounesios <contovob@tcd.ie>
Sat, 27 Mar 2021 19:25:38 +0000 (19:25 +0000)
committerBasil L. Contovounesios <contovob@tcd.ie>
Sat, 27 Mar 2021 20:05:10 +0000 (20:05 +0000)
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

index 959bd8311706f200ff84df883d50480f4472f636..c48e644345beea93185fa0669f01ba894f349e5b 100644 (file)
@@ -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)