mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 14:30:43 -08:00
Warn about duplicated :tag strings in defcustom choices
It is bad user experience when two menu items have identical labels. * lisp/emacs-lisp/bytecomp.el (bytecomp--check-cus-type): Add check. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-defcustom-type): Add test case.
This commit is contained in:
parent
321f2e1e4d
commit
b03338c70d
2 changed files with 12 additions and 2 deletions
|
|
@ -1875,7 +1875,7 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
|
|||
(FIXTURE-FN \\='#\\='electric-pair-mode))" fill-column)))
|
||||
|
||||
(ert-deftest bytecomp-test-defcustom-type ()
|
||||
(cl-flet ((dc (type) `(defcustom mytest nil "doc" :type ',type)))
|
||||
(cl-flet ((dc (type) `(defcustom mytest nil "doc" :type ',type :group 'test)))
|
||||
(bytecomp--with-warning-test
|
||||
(rx "type should not be quoted") (dc ''integer))
|
||||
(bytecomp--with-warning-test
|
||||
|
|
@ -1890,6 +1890,9 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
|
|||
(bytecomp--with-warning-test
|
||||
(rx "duplicated value in `choice': `a'")
|
||||
(dc '(choice (const a) (const b) (const a))))
|
||||
(bytecomp--with-warning-test
|
||||
(rx "duplicated :tag string in `choice': \"X\"")
|
||||
(dc '(choice (const :tag "X" a) (const :tag "Y" b) (other :tag "X" c))))
|
||||
(bytecomp--with-warning-test
|
||||
(rx "`cons' requires 2 type specs, found 1")
|
||||
(dc '(cons :tag "a" integer)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue