[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 86e8f315053: Silence macro expansion during completion at point
From: |
Stefan Monnier |
Subject: |
master 86e8f315053: Silence macro expansion during completion at point |
Date: |
Thu, 5 Oct 2023 14:06:57 -0400 (EDT) |
branch: master
commit 86e8f3150533da1ff5e8bf0afa87c3e97240b253
Author: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Silence macro expansion during completion at point
* lisp/emacs-lisp/macroexp.el (macroexp-inhibit-compiler-macros): Add
variable.
(macroexp--compiler-macro): Inspect that new variable and, if it is
non-nil, return the input form unchanged.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Silence
messages. Avoid compiler macros. (Bug#58148)
---
lisp/emacs-lisp/macroexp.el | 20 ++++++++++++++------
lisp/progmodes/elisp-mode.el | 6 +++++-
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 3ef924a5c73..6eb670d6dc1 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -105,13 +105,21 @@ each clause."
(macroexp--all-forms clause skip)
clause)))
+(defvar macroexp-inhibit-compiler-macros nil
+ "Inhibit application of compiler macros if non-nil.")
+
(defun macroexp--compiler-macro (handler form)
- (condition-case-unless-debug err
- (apply handler form (cdr form))
- (error
- (message "Warning: Optimization failure for %S: Handler: %S\n%S"
- (car form) handler err)
- form)))
+ "Apply compiler macro HANDLER to FORM and return the result.
+Unless `macroexp-inhibit-compiler-macros' is non-nil, in which
+case return FORM unchanged."
+ (if macroexp-inhibit-compiler-macros
+ form
+ (condition-case-unless-debug err
+ (apply handler form (cdr form))
+ (error
+ (message "Warning: Optimization failure for %S: Handler: %S\n%S"
+ (car form) handler err)
+ form))))
(defun macroexp--funcall-if-compiled (_form)
"Pseudo function used internally by macroexp to delay warnings.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 664299df288..ff90a744ea3 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -460,7 +460,11 @@ use of `macroexpand-all' as a way to find the \"underlying
raw code\".")
(message "Ignoring macroexpansion error: %S" err) form))))
(sexp
(unwind-protect
- (let ((warning-minimum-log-level :emergency))
+ ;; Silence any macro expansion errors when
+ ;; attempting completion at point (bug#58148).
+ (let ((inhibit-message t)
+ (macroexp-inhibit-compiler-macros t)
+ (warning-minimum-log-level :emergency))
(advice-add 'macroexpand-1 :around macroexpand-advice)
(macroexpand-all sexp elisp--local-macroenv))
(advice-remove 'macroexpand-1 macroexpand-advice)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 86e8f315053: Silence macro expansion during completion at point,
Stefan Monnier <=