emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 695f679: Remove ; ; ; ###tramp-autoload cookie from Tramp def


From: Basil L. Contovounesios
Subject: Re: master 695f679: Remove ; ; ; ###tramp-autoload cookie from Tramp defcustoms (Bug#47063)
Date: Wed, 24 Mar 2021 22:19:19 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Like so?  Or do we want the safety net higher up, e.g. in
>> read-extended-command or its callers?
>
> LGTM, but I think Lars would know better,

Lars, any thoughts on how best to protect M-x from errors in
completion-predicate?  Is the following okay?

>From 41cbd533d7fb770ef3ce8a8a88180f9e0e1ecc54 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
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

Thanks,

-- 
Basil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]