From cc663ccb14f3fae361733fe9742d7c7d07274d54 Mon Sep 17 00:00:00 2001 From: Jens Schmidt Date: Tue, 26 Sep 2023 22:26:15 +0200 Subject: [PATCH] Silence macro expansion during completion-at-point * lisp/progmodes/elisp-mode.el (elisp--local-variables): Silence messages. Suppress all errors during macro expansion. (Bug#58396) Do not merge to master. --- lisp/progmodes/elisp-mode.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index bd3916ce108..bc01058ff3c 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -445,11 +445,19 @@ elisp--local-variables (condition-case nil (apply expander form args) (error form)))) + ;; Avoid any macro expansion errors when attempting + ;; completion at point (bug#58148). As Stefan suggested + ;; there: Silence messages [1] and suppress all errors + ;; [3]. (Not avoiding compiler macros in the current + ;; release branch, though.) (sexp (unwind-protect - (let ((warning-minimum-log-level :emergency)) + (let ((inhibit-message t) ;[1] + (warning-minimum-log-level :emergency)) (advice-add 'macroexpand :around macroexpand-advice) - (macroexpand-all sexp)) + (condition-case nil ;[3] + (macroexpand-all sexp) + (t sexp))) (advice-remove 'macroexpand macroexpand-advice))) (vars (elisp--local-variables-1 nil sexp))) (delq nil -- 2.30.2