summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-10-13 19:00:25 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-10-13 19:00:31 +0200
commit913a7d30a33f7faa1a98e7dffd10159b1d2a6b97 (patch)
tree87feb7d1943a4dbb6a86cb7ddb675303deae094c /lisp/emacs-lisp
parentab34293d849086a67effc52800e18bab1400ce72 (diff)
downloademacs-913a7d30a33f7faa1a98e7dffd10159b1d2a6b97.tar.gz
emacs-913a7d30a33f7faa1a98e7dffd10159b1d2a6b97.tar.bz2
emacs-913a7d30a33f7faa1a98e7dffd10159b1d2a6b97.zip
Allow inhibiting `not-unused' warnings
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): Allow inhibiting the `not-unused' warning (bug#31641). (There has been some discussion about removing the `not-unused' warning, but it's still in there, so making it possible to inhibit it seems like the right thing to do.) * lisp/emacs-lisp/cconv.el (cconv--analyze-use): Don't warn about `not-unused'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el3
-rw-r--r--lisp/emacs-lisp/cconv.el7
2 files changed, 5 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 3f050d1b799..471a0b623ad 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -299,7 +299,7 @@ The information is logged to `byte-compile-log-buffer'."
'(redefine callargs free-vars unresolved
obsolete noruntime interactive-only
make-local mapcar constants suspicious lexical lexical-dynamic
- docstrings)
+ docstrings not-unused)
"The list of warning types used when `byte-compile-warnings' is t.")
(defcustom byte-compile-warnings t
"List of warnings that the byte-compiler should issue (t for all).
@@ -321,6 +321,7 @@ Elements of the list may be:
lexically bound variable declared dynamic elsewhere
make-local calls to `make-variable-buffer-local' that may be incorrect.
mapcar mapcar called for effect.
+ not-unused warning about using variables with symbol names starting with _.
constants let-binding of, or assignment to, constants/nonvariables.
docstrings docstrings that are too wide (longer than
`byte-compile-docstring-max-column' or
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 0a6b04b4c1f..03e109f2508 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -608,10 +608,9 @@ FORM is the parent form that binds this var."
(`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_)
,_ ,_ ,_ ,_)
;; FIXME: Convert this warning to use `macroexp--warn-wrap'
- ;; so as to give better position information and obey
- ;; `byte-compile-warnings'.
- (byte-compile-warn
- "%s `%S' not left unused" varkind var))
+ ;; so as to give better position information.
+ (when (byte-compile-warning-enabled-p 'not-unused var)
+ (byte-compile-warn "%s `%S' not left unused" varkind var)))
((and (let (or 'let* 'let) (car form))
`((,var) ;; (or `(,var nil) : Too many false positives: bug#47080
t nil ,_ ,_))