Function: use-package-hook-injector

use-package-hook-injector is a byte-compiled function defined in use-package-core.el.gz.

Signature

(use-package-hook-injector NAME-STRING KEYWORD BODY)

Documentation

Wrap pre/post hook injections around the given BODY for KEYWORD.

The BODY is a list of forms, so ((foo)) if only foo is being called.

Source Code

;; Defined in /usr/src/emacs/lisp/use-package/use-package-core.el.gz
(defun use-package-hook-injector (name-string keyword body)
  "Wrap pre/post hook injections around the given BODY for KEYWORD.
The BODY is a list of forms, so `((foo))' if only `foo' is being called."
  (if (not use-package-inject-hooks)
      body
    (let ((keyword-name (substring (format "%s" keyword) 1)))
      `((when (run-hook-with-args-until-failure
               ',(intern (concat "use-package--" name-string
                                 "--pre-" keyword-name "-hook")))
          ,@body
          (run-hooks
           ',(intern (concat "use-package--" name-string
                             "--post-" keyword-name "-hook"))))))))