From 7eec86f5cd98cf9a40795b9607111d8671e63ae2 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sun, 2 Jul 2017 17:45:26 +0200 Subject: [PATCH] Allow :major as the third argument in :delight calls --- lisp/use-package/use-package.el | 15 ++++++++++----- test/lisp/use-package/use-package-tests.el | 4 +++- 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." (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)) -- 2.39.2