aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Wreschnig2017-07-02 17:45:26 +0200
committerJoe Wreschnig2017-07-02 17:45:26 +0200
commit7eec86f5cd98cf9a40795b9607111d8671e63ae2 (patch)
tree48088ea69d78cdbae1d7c973ee6d480230ed9505
parent4b8b850cf0d814bda1e39d8ea276d8e93938d573 (diff)
downloademacs-7eec86f5cd98cf9a40795b9607111d8671e63ae2.tar.gz
emacs-7eec86f5cd98cf9a40795b9607111d8671e63ae2.zip
Allow :major as the third argument in :delight calls
-rw-r--r--lisp/use-package/use-package.el15
-rw-r--r--test/lisp/use-package/use-package-tests.el4
2 files changed, 13 insertions, 6 deletions
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."
1466 (symbolp (car args))) 1466 (symbolp (car args)))
1467 `((,(car args) nil ,name))) 1467 `((,(car args) nil ,name)))
1468 ((and (= (length args) 1) 1468 ((and (= (length args) 1)
1469 (or (not (listp (car args))) 1469 (stringp (car args)))
1470 (eq 'quote (caar args))))
1471 `((,(use-package-as-mode name) ,(car args) ,name))) 1470 `((,(use-package-as-mode name) ,(car args) ,name)))
1471 ((and (= (length args) 1)
1472 (listp (car args))
1473 (eq 'quote (caar args)))
1474 `((,(use-package-as-mode name) ,@(cdar args) ,name)))
1475 ((and (= (length args) 2)
1476 (listp (nth 1 args))
1477 (eq 'quote (car (nth 1 args))))
1478 `((,(car args) ,@(cdr (nth 1 args)) ,name)))
1472 (t (mapcar 1479 (t (mapcar
1473 (apply-partially #'use-package--normalize-delight-1 name) 1480 (apply-partially #'use-package--normalize-delight-1 name)
1474 (if (symbolp (car args)) (list args) args))))) 1481 (if (symbolp (car args)) (list args) args)))))
@@ -1477,9 +1484,7 @@ deferred until the prefix key sequence is pressed."
1477 (let ((body (use-package-process-keywords name rest state))) 1484 (let ((body (use-package-process-keywords name rest state)))
1478 (use-package-concat 1485 (use-package-concat
1479 body 1486 body
1480 (mapcar (lambda (arg) 1487 `((delight '(,@args))))))
1481 `(delight ',(nth 0 arg) ,(nth 1 arg) ',(nth 2 arg)))
1482 args))))
1483 1488
1484;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1489;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1485;; 1490;;
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 @@
58 (use-package-normalize/:delight 'foo-mode :delight nil))) 58 (use-package-normalize/:delight 'foo-mode :delight nil)))
59 (should (equal `((bar-mode nil foo)) 59 (should (equal `((bar-mode nil foo))
60 (use-package-normalize/:delight 'foo :delight '(bar-mode)))) 60 (use-package-normalize/:delight 'foo :delight '(bar-mode))))
61 (should (equal `((bar-mode nil :major))
62 (use-package-normalize/:delight 'foo :delight '((bar-mode nil :major)))))
61 (should (equal `((foo-mode "abc" foo)) 63 (should (equal `((foo-mode "abc" foo))
62 (use-package-normalize/:delight 'foo :delight '("abc")))) 64 (use-package-normalize/:delight 'foo :delight '("abc"))))
63 (should (equal `((foo-mode '(:eval 1) foo)) 65 (should (equal `((foo-mode (:eval 1) foo))
64 (use-package-normalize/:delight 'foo :delight '('(:eval 1))))) 66 (use-package-normalize/:delight 'foo :delight '('(:eval 1)))))
65 (should (equal `((a-mode nil foo) 67 (should (equal `((a-mode nil foo)
66 (b-mode " b" foo)) 68 (b-mode " b" foo))