emacs-diffs
[Top][All Lists]
Advanced

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

master f931cebce76: Insert symbol `debug' into two condition-case handle


From: Alan Mackenzie
Subject: master f931cebce76: Insert symbol `debug' into two condition-case handlers
Date: Wed, 20 Sep 2023 11:52:33 -0400 (EDT)

branch: master
commit f931cebce76d911dfc61274e0a8c1de3627b9179
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    Insert symbol `debug' into two condition-case handlers
    
    This fixes bug#65622.  Also correct a mismatch between a
    function to which advice is added, and that from which it is
    removed.
    
    * lisp/emacs-lisp/macroexp.el (internal-macroexpand-for-load):
    Add a `debug' to the condition-case handler for `error', so
    that a useful backtrace will be produced on a macro expansion
    error.
    
    * lisp/progmodes/elisp-mode.el (elisp--local-variables): Add
    `debug' to a condition-case handler, as above.  In the
    advice-remove call, give the same function, macroexpand-1, as
    in the corresponding advice-add call.
---
 lisp/emacs-lisp/macroexp.el  | 2 +-
 lisp/progmodes/elisp-mode.el | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index b21f0f0d47f..f96e0d74026 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -812,7 +812,7 @@ test of free variables in the following ways:
           (if full-p
               (macroexpand--all-toplevel form)
             (macroexpand form)))
-      (error
+      ((debug error)
        ;; Hopefully this shouldn't happen thanks to the cycle detection,
        ;; but in case it does happen, let's catch the error and give the
        ;; code a chance to macro-expand later.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 8a12a154f72..664299df288 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -456,14 +456,14 @@ use of `macroexpand-all' as a way to find the 
\"underlying raw code\".")
               (lambda (expander form &rest args)
                 (condition-case err
                     (apply expander form args)
-                  (error (message "Ignoring macroexpansion error: %S" err)
-                         form))))
+                  ((debug error)
+                   (message "Ignoring macroexpansion error: %S" err) form))))
              (sexp
               (unwind-protect
                   (let ((warning-minimum-log-level :emergency))
                     (advice-add 'macroexpand-1 :around macroexpand-advice)
                     (macroexpand-all sexp elisp--local-macroenv))
-                (advice-remove 'macroexpand macroexpand-advice)))
+                (advice-remove 'macroexpand-1 macroexpand-advice)))
              (vars (elisp--local-variables-1 nil sexp)))
         (delq nil
               (mapcar (lambda (var)



reply via email to

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