Variable: org-roam-capture-preface-hook

org-roam-capture-preface-hook is a variable defined in org-roam-capture.el.

Value

(org-roam-dailies--override-capture-time-h
 org-roam-capture--try-capture-to-ref-h)

Documentation

Hook run when Org-roam tries to determine capture location of the node.

If any hook returns a value (which should be an ID), all hooks after it are ignored.

With this hook you can hijack controls over the location of the node for which the capture process is currently running for, or use to just perform an arbitrary side effect, e.g. modify the state related to the capture process. See org-roam-protocol and org-roam-dailies as examples for what and how this hook is used for.

If you're trying to perform the hijack, it's mandatory for you to:
  1. Set the currently active buffer for editing operations using
     org-capture-target-buffer.
  2. Place the point in this buffer from where the location starts
     from (e.g. if it's a file based node it should be the BOB,
     otherwise it should be the position from where the heading
     based node starts from).
  3. Return the ID (as a string) of the capturing node.

If you use this hook for any other purpose, but not the hijack, it's mandatory that you should return nil as the return value; so the capture process would be able to setup the capture buffer.

If you need to do something when you capture new nodes, use org-roam-capture-new-node-hook instead of this hook.

WARNING: This hook is primarily designed for the usage by the extensions and packages, and requires understanding of the internal capture process. If you don't understand it, you should learn these internals before using this or use it at your own risk breaking things.

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-capture.el
(defvar org-roam-capture-preface-hook nil
  "Hook run when Org-roam tries to determine capture location of the node.
If any hook returns a value (which should be an ID), all hooks
after it are ignored.

With this hook you can hijack controls over the location of the
node for which the capture process is currently running for, or
use to just perform an arbitrary side effect, e.g. modify the
state related to the capture process. See `org-roam-protocol' and
`org-roam-dailies' as examples for what and how this hook is used
for.

If you're trying to perform the hijack, it's mandatory for you to:
  1. Set the currently active buffer for editing operations using
     `org-capture-target-buffer'.
  2. Place the point in this buffer from where the location starts
     from (e.g. if it's a file based node it should be the BOB,
     otherwise it should be the position from where the heading
     based node starts from).
  3. Return the ID (as a string) of the capturing node.

If you use this hook for any other purpose, but not the hijack,
it's mandatory that you should return nil as the return value; so
the capture process would be able to setup the capture buffer.

If you need to do something when you capture new nodes, use
`org-roam-capture-new-node-hook' instead of this hook.

WARNING: This hook is primarily designed for the usage by the
extensions and packages, and requires understanding of the
internal capture process. If you don't understand it, you should
learn these internals before using this or use it at your own
risk breaking things.")