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.
(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.
(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)