bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#29573: 26.0.90; Suppress warnings during elisp completion macroexpan


From: Noam Postavsky
Subject: bug#29573: 26.0.90; Suppress warnings during elisp completion macroexpansion
Date: Mon, 04 Dec 2017 20:23:42 -0500

Tags: patch

Motivating example is use-package showing an error when given the
`elisp--witness-lisp' symbol by completion [1].

[1]: https://github.com/jwiegley/use-package/issues/524

>From d73b0094c205e8b5762dc5e5833abdfb5841348f Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Mon, 4 Dec 2017 20:01:40 -0500
Subject: [PATCH] Suppress warnings during elisp completion macroexpansion

Errors are already suppressed, therefore it is logical to suppress
warnings as well.  Some macros (e.g., use-package) may produce
warnings when given the `elisp--witness--lisp' symbol.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Let-bind
warning-minimum-log-level to :emergency.
---
 lisp/progmodes/elisp-mode.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 5ba0978909..4207edb8af 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -307,6 +307,8 @@ elisp--local-variables-1
           (setq sexp (ignore-errors (butlast sexp)))))
     res))
 
+(defvar warning-minimum-log-level)
+
 (defun elisp--local-variables ()
   "Return a list of locally let-bound variables at point."
   (save-excursion
@@ -328,7 +330,7 @@ elisp--local-variables
                                      (error form))))
              (sexp
               (unwind-protect
-                  (progn
+                  (let ((warning-minimum-log-level :emergency))
                     (advice-add 'macroexpand :around macroexpand-advice)
                     (macroexpand-all sexp))
                 (advice-remove 'macroexpand macroexpand-advice)))
-- 
2.11.0


reply via email to

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