From: Noam Postavsky Date: Sun, 14 Apr 2013 19:01:37 +0000 (-0400) Subject: let :diminish "string" guess correct mode symbol X-Git-Tag: emacs-29.0.90~1306^2~15^2~457^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2abe5f9480;p=emacs.git let :diminish "string" guess correct mode symbol --- diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 68216c6a7a9..17f7309cf55 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -212,7 +212,9 @@ ;; if you have that installed. It's purpose is to remove strings from your ;; mode-line that would otherwise always be there and provide no useful ;; information. It is invoked with the `:diminish' keyword, which is passed -;; either the minor mode symbol, or a cons of the symbol and a replacement string: +;; either the minor mode symbol, a cons of the symbol and a replacement string, +;; or just a replacement string in which case the minor mode symbol is guessed +;; to be the package name with "-mode" at the end: ;; ;; (use-package abbrev ;; :diminish abbrev-mode @@ -453,16 +455,20 @@ For full documentation. please see commentary. `(progn ,config-body (ignore-errors - ,@(if (listp diminish-var) - (if (listp (cdr diminish-var)) - (mapcar (lambda (var) - (if (listp var) - `(diminish (quote ,(car var)) ,(cdr var)) - `(diminish (quote ,var)))) - diminish-var) - `((diminish (quote ,(car diminish-var)) ,(cdr diminish-var))) - ) - `((diminish (quote ,diminish-var)))))))) + ,@(cond + ((stringp diminish-var) + `(diminish (quote ,(intern (concat name-string "-mode"))) + ,diminish-var)) + ((symbolp diminish-var) + `(diminish (quote ,diminish-var))) + ((and (consp diminish-var) (stringp (cdr diminish-var))) + `(diminish (quote ,(car diminish-var)) ,(cdr diminish-var))) + (t ; list of symbols or (symbol . "string") pairs + (mapcar (lambda (var) + (if (listp var) + `(diminish (quote ,(car var)) ,(cdr var)) + `(diminish (quote ,var)))) + diminish-var))))))) (if (and commands (symbolp commands)) (setq commands (list commands)))