mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 22:41:06 -08:00
Allow :diminish with no arguments
When given no arguments, have :diminish assume it should diminish a mode named after the current package (the package’s name, with “-mode” appended, if it’s not already) to an empty string. When given only a string to diminish an implicit package name to, do not append “-mode” to the package name if it already ends with it. (This is a backwards-incompatible change if someone was diminishing a package named “foo-mode” implementing `foo-mode-mode`.) Add test cases for `use-package-normalize-diminish`. This addresses some of the redundancy mentioned in issue https://github.com/jwiegley/use-package/issues/288.
This commit is contained in:
parent
463e38b188
commit
ca83649a32
2 changed files with 15 additions and 1 deletions
|
|
@ -1409,10 +1409,12 @@ deferred until the prefix key sequence is pressed."
|
||||||
SYMBOL
|
SYMBOL
|
||||||
(SYMBOL . STRING)"
|
(SYMBOL . STRING)"
|
||||||
(cond
|
(cond
|
||||||
|
((not arg)
|
||||||
|
(list (use-package-as-mode name)))
|
||||||
((symbolp arg)
|
((symbolp arg)
|
||||||
(list arg))
|
(list arg))
|
||||||
((stringp arg)
|
((stringp arg)
|
||||||
(list (cons (intern (concat (use-package-as-string name) "-mode")) arg)))
|
(list (cons (use-package-as-mode name) arg)))
|
||||||
((and (consp arg) (stringp (cdr arg)))
|
((and (consp arg) (stringp (cdr arg)))
|
||||||
(list arg))
|
(list arg))
|
||||||
((and (not recursed) (listp arg) (listp (cdr arg)))
|
((and (not recursed) (listp arg) (listp (cdr arg)))
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,18 @@
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(ert-deftest use-package-normalize-diminish ()
|
||||||
|
(should (equal (use-package-normalize-diminish 'foopkg :diminish nil)
|
||||||
|
'(foopkg-mode)))
|
||||||
|
(should (equal (use-package-normalize-diminish 'foopkg :diminish 'bar)
|
||||||
|
'(bar)))
|
||||||
|
(should (equal (use-package-normalize-diminish 'foopkg :diminish "bar")
|
||||||
|
'((foopkg-mode . "bar"))))
|
||||||
|
(should (equal (use-package-normalize-diminish 'foopkg :diminish 'foo-mode)
|
||||||
|
'(foo-mode)))
|
||||||
|
(should (equal (use-package-normalize-diminish 'foopkg :diminish '(foo . "bar"))
|
||||||
|
'((foo . "bar")))))
|
||||||
|
|
||||||
;; Local Variables:
|
;; Local Variables:
|
||||||
;; indent-tabs-mode: nil
|
;; indent-tabs-mode: nil
|
||||||
;; no-byte-compile: t
|
;; no-byte-compile: t
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue