1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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.
This commit is contained in:
Stefan Kangas 2024-10-02 02:28:52 +02:00
parent 9ad73f9261
commit fb42a253bd
2 changed files with 15 additions and 1 deletions

View file

@ -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))