From: Joe Wreschnig Date: Sun, 2 Jul 2017 15:45:26 +0000 (+0200) Subject: Allow :major as the third argument in :delight calls X-Git-Tag: emacs-29.0.90~1306^2~15^2~261^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7eec86f5cd98cf9a40795b9607111d8671e63ae2;p=emacs.git Allow :major as the third argument in :delight calls --- diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index ce38a6e1a77..593a680eee3 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -1466,9 +1466,16 @@ deferred until the prefix key sequence is pressed." (symbolp (car args))) `((,(car args) nil ,name))) ((and (= (length args) 1) - (or (not (listp (car args))) - (eq 'quote (caar args)))) + (stringp (car args))) `((,(use-package-as-mode name) ,(car args) ,name))) + ((and (= (length args) 1) + (listp (car args)) + (eq 'quote (caar args))) + `((,(use-package-as-mode name) ,@(cdar args) ,name))) + ((and (= (length args) 2) + (listp (nth 1 args)) + (eq 'quote (car (nth 1 args)))) + `((,(car args) ,@(cdr (nth 1 args)) ,name))) (t (mapcar (apply-partially #'use-package--normalize-delight-1 name) (if (symbolp (car args)) (list args) args))))) @@ -1477,9 +1484,7 @@ deferred until the prefix key sequence is pressed." (let ((body (use-package-process-keywords name rest state))) (use-package-concat body - (mapcar (lambda (arg) - `(delight ',(nth 0 arg) ,(nth 1 arg) ',(nth 2 arg))) - args)))) + `((delight '(,@args)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index ababfe0d5b2..625e95ca587 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el @@ -58,9 +58,11 @@ (use-package-normalize/:delight 'foo-mode :delight nil))) (should (equal `((bar-mode nil foo)) (use-package-normalize/:delight 'foo :delight '(bar-mode)))) + (should (equal `((bar-mode nil :major)) + (use-package-normalize/:delight 'foo :delight '((bar-mode nil :major))))) (should (equal `((foo-mode "abc" foo)) (use-package-normalize/:delight 'foo :delight '("abc")))) - (should (equal `((foo-mode '(:eval 1) foo)) + (should (equal `((foo-mode (:eval 1) foo)) (use-package-normalize/:delight 'foo :delight '('(:eval 1))))) (should (equal `((a-mode nil foo) (b-mode " b" foo))