1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

Allow :major as the third argument in :delight calls

This commit is contained in:
Joe Wreschnig 2017-07-02 17:45:26 +02:00
parent 4b8b850cf0
commit 7eec86f5cd
2 changed files with 13 additions and 6 deletions

View File

@ -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))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;

View File

@ -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))