summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJoe Wreschnig <joe.wreschnig@gmail.com>2017-06-14 20:24:01 +0200
committerJoe Wreschnig <joe.wreschnig@gmail.com>2017-07-08 15:32:46 +0200
commitca83649a324128fafa33fad2dc58f54eb1c0480c (patch)
treea62042e45b6dbcd32f36f912f6a48a54d8172740 /lisp
parent463e38b1887e27a9d23c9036f60accc30db0d89e (diff)
downloademacs-ca83649a324128fafa33fad2dc58f54eb1c0480c.tar.gz
emacs-ca83649a324128fafa33fad2dc58f54eb1c0480c.tar.bz2
emacs-ca83649a324128fafa33fad2dc58f54eb1c0480c.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/use-package/use-package.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el
index 593a680eee3..d397e0e4072 100644
--- a/lisp/use-package/use-package.el
+++ b/lisp/use-package/use-package.el
@@ -1409,10 +1409,12 @@ deferred until the prefix key sequence is pressed."
SYMBOL
(SYMBOL . STRING)"
(cond
+ ((not arg)
+ (list (use-package-as-mode name)))
((symbolp arg)
(list 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)))
(list arg))
((and (not recursed) (listp arg) (listp (cdr arg)))