summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2024-10-02 02:28:52 +0200
committerStefan Kangas <stefankangas@gmail.com>2024-10-02 02:28:52 +0200
commitfb42a253bdcbdc9f8af5f934cab4aa24d5b541bd (patch)
tree87a82b6ac4a38b89a9cdafc57eaaf3cd6cf5cb0d /lisp/emacs-lisp
parent9ad73f92617da1286724f9774b34bb7ce6a4299d (diff)
downloademacs-fb42a253bdcbdc9f8af5f934cab4aa24d5b541bd.tar.gz
emacs-fb42a253bdcbdc9f8af5f934cab4aa24d5b541bd.tar.bz2
emacs-fb42a253bdcbdc9f8af5f934cab4aa24d5b541bd.zip
Warn about bad defcustom :local keyword at compile time
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare): Warn about invalid values for the defcustom :local keyword. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-defcustom-local): New test.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 5ed058e0a14..72953502f51 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -5467,7 +5467,13 @@ FORM is used to provide location, `bytecomp--cus-function' and
(when (and name
byte-compile-current-file ; only when compiling a whole file
(eq fun 'custom-declare-group))
- (setq byte-compile-current-group name))))
+ (setq byte-compile-current-group name))
+
+ ;; Check :local
+ (when-let ((val (and (eq fun 'custom-declare-variable)
+ (plist-get keyword-args :local)))
+ (_ (not (memq val '(t permanent permanent-only)))))
+ (bytecomp--cus-warn form ":local keyword does not accept %S" val))))
(byte-compile-normal-call form))