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: Sun, 14 Mar 2021 12:59:23 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Michael Albinus <michael.albinus@gmx.de> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> - The function command-completion-default-include-p checks whether
>>>   completion-predicate is functionp.
>> I think this is *also* needed, tho a better option is
>> `with-demoted-errors` since no matter what error is signal'd we don't
>> want it to prevent `M-x` from doing its job.
> Yes.

Like so?  Or do we want the safety net higher up, e.g. in
read-extended-command or its callers?

>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

> I have adapted tramp-crypt.el such a way, that `completion-predicate'
> for `tramp-crypt-add-directory' is set only after loading tramp-crypt.el.

Thanks,

-- 
Basil

reply via email to

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