- New customization variable `use-package-enable-imenu-support`.
+- New customization variable `use-package-hook-name-suffix`.
+
- Allow `:diminish` to take no arguments.
- Support multiple symbols passed to `:after`, and a mini-DSL using `:all` and
(choice :tag "Enable if non-nil" sexp function)))
:group 'use-package)
+(defcustom use-package-hook-name-suffix "-hook"
+ "Text append to the name of hooks mentioned by :hook.
+Set to `nil' if you don't want this to happen; it's only a
+convenience."
+ :type '(choice string (const :tag "No suffix" nil))
+ :group 'use-package)
+
(defcustom use-package-minimum-reported-time 0.1
"Minimal load time that will be reported.
Note that `use-package-verbose' has to be set to a non-nil value
(when fun
(mapcar
#'(lambda (sym)
- `(add-hook (quote ,(intern (format "%s-hook" sym)))
- (function ,fun)))
+ `(add-hook
+ (quote ,(intern
+ (concat (symbol-name sym)
+ use-package-hook-name-suffix)))
+ (function ,fun)))
(if (use-package-non-nil-symbolp syms) (list syms) syms)))))
nargs))))))
(ignore
(bind-keys :package foo ("C-a" . key))))))))
+(ert-deftest use-package-test/:hook-2 ()
+ (match-expansion
+ (use-package foo
+ :hook (hook . fun))
+ `(progn
+ (unless (fboundp 'fun)
+ (autoload #'fun "foo" nil t))
+ (ignore
+ (add-hook 'hook-hook #'fun)))))
+
+(ert-deftest use-package-test/:hook-3 ()
+ (let ((use-package-hook-name-suffix nil))
+ (match-expansion
+ (use-package foo
+ :hook (hook . fun))
+ `(progn
+ (unless (fboundp 'fun)
+ (autoload #'fun "foo" nil t))
+ (ignore
+ (add-hook 'hook #'fun))))))
+
+(ert-deftest use-package-test/:hook-4 ()
+ (let ((use-package-hook-name-suffix "-special"))
+ (match-expansion
+ (use-package foo
+ :hook (hook . fun))
+ `(progn
+ (unless (fboundp 'fun)
+ (autoload #'fun "foo" nil t))
+ (ignore
+ (add-hook 'hook-special #'fun))))))
+
(ert-deftest use-package-test-normalize/:custom ()
(flet ((norm (&rest args)
(apply #'use-package-normalize/:custom