aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/use-package/use-package-core.el28
1 files changed, 1 insertions, 27 deletions
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el
index 1190f144893..6606681f2ea 100644
--- a/lisp/use-package/use-package-core.el
+++ b/lisp/use-package/use-package-core.el
@@ -100,8 +100,7 @@
100 :load 100 :load
101 ;; This must occur almost last; the only forms which should appear after 101 ;; This must occur almost last; the only forms which should appear after
102 ;; are those that must happen directly after the config forms. 102 ;; are those that must happen directly after the config forms.
103 :config 103 :config)
104 :local)
105 "The set of valid keywords, in the order they are processed in. 104 "The set of valid keywords, in the order they are processed in.
106The order of this list is *very important*, so it is only 105The order of this list is *very important*, so it is only
107advisable to insert new keywords, never to delete or reorder 106advisable to insert new keywords, never to delete or reorder
@@ -1580,31 +1579,6 @@ no keyword implies `:all'."
1580 (when use-package-compute-statistics 1579 (when use-package-compute-statistics
1581 `((use-package-statistics-gather :config ',name t)))))) 1580 `((use-package-statistics-gather :config ',name t))))))
1582 1581
1583;;;; :local
1584
1585(defun use-package-normalize/:local (name keyword args)
1586 (let ((first-arg-name (symbol-name (caar args))))
1587 (if (not (string-suffix-p "-hook" first-arg-name))
1588 (let* ((sym-name (symbol-name name))
1589 (addition (if (string-suffix-p "-mode" sym-name)
1590 "-hook"
1591 "-mode-hook"))
1592 (hook (intern (concat sym-name addition))))
1593 `((,hook . ,(use-package-normalize-forms name keyword args))))
1594 (cl-loop for (hook . code) in args
1595 collect `(,hook . ,(use-package-normalize-forms name keyword code))))))
1596
1597(defun use-package-handler/:local (name _keyword arg rest state)
1598 (let* ((body (use-package-process-keywords name rest state)))
1599 (use-package-concat
1600 body
1601 (cl-loop for (hook . code) in arg
1602 for func-name = (intern (concat "use-package-func/" (symbol-name hook)))
1603 collect (progn
1604 (push 'progn code)
1605 `(defun ,func-name () ,code))
1606 collect `(add-hook ',hook ',func-name)))))
1607
1608;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1582;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1609;; 1583;;
1610;;; The main macro 1584;;; The main macro