summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/use-package/use-package-core.el5
-rw-r--r--test/lisp/use-package/use-package-tests.el12
2 files changed, 11 insertions, 6 deletions
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el
index 946c029ff4a..dc9b77bc5bf 100644
--- a/lisp/use-package/use-package-core.el
+++ b/lisp/use-package/use-package-core.el
@@ -1295,7 +1295,10 @@ meaning:
(setq every nil)))
every))))
#'use-package-recognize-function
- name label arg))))
+ (if (string-suffix-p "-mode" (symbol-name name))
+ name
+ (intern (concat (symbol-name name) "-mode")))
+ label arg))))
(defalias 'use-package-autoloads/:hook 'use-package-autoloads-mode)
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el
index 3ef56a09b89..9510fffb01c 100644
--- a/test/lisp/use-package/use-package-tests.el
+++ b/test/lisp/use-package/use-package-tests.el
@@ -984,15 +984,17 @@
'foopkg :hook args)))
(should-error (norm nil))
(should (equal (norm '(bar))
+ '((bar . foopkg-mode))))
+ (should (equal (norm '((bar . foopkg)))
'((bar . foopkg))))
(should (equal (norm '((bar . baz)))
'((bar . baz))))
(should (equal (norm '(((bar baz) . quux)))
'(((bar baz) . quux))))
(should (equal (norm '(bar baz))
- '(((bar baz) . foopkg))))
+ '(((bar baz) . foopkg-mode))))
(should (equal (norm '((bar baz) (quux bow)))
- '(((bar baz) . foopkg) ((quux bow) . foopkg))))
+ '(((bar baz) . foopkg-mode) ((quux bow) . foopkg-mode))))
(should (equal (norm '((bar . baz) (quux . bow)))
'((bar . baz) (quux . bow))))
(should (equal (norm '(((bar1 bar2) . baz) ((quux1 quux2) . bow)))
@@ -1945,9 +1947,9 @@
(use-package nonexistent
:hook lisp-mode)
`(when (locate-library nonexistent)
- (unless (fboundp 'nonexistent)
- (autoload #'nonexistent "nonexistent" nil t))
- (add-hook 'lisp-mode-hook #'nonexistent)))))
+ (unless (fboundp 'nonexistent-mode)
+ (autoload #'nonexistent-mode "nonexistent" nil t))
+ (add-hook 'lisp-mode-hook #'nonexistent-mode)))))
(ert-deftest bind-key/:prefix-map ()
(match-expansion