(feat): enable nested captures (#966)

This PR enables the long-awaited nested-captures.

1. Adds a hook to org-capture-prepare-finalize-hook, which installs org-roam-capture--finalize into org-capture-after-finalize-hook if the capture is an Org-roam capture. This function contains key functionality for Org-roam to Do The Right Thing after specific interactive functions, such as finding the file, or inserting a link.

2. A patch for org-capture-finalize. Specifically, we make org-capture-plist valid during org-capture-finalize.

3. Many hacks that were originally in place are now replaced with nicer alternatives.

Co-authored-by: Leo Vivier <zaephon@gmail.com>
This commit is contained in:
Jethro Kuan
2020-07-27 00:21:41 +08:00
committed by GitHub
parent 863ae2427e
commit 20f876aa6b
4 changed files with 67 additions and 50 deletions

View File

@ -103,7 +103,7 @@ Template string :\n%v")
(let ((org-roam-capture-templates org-roam-dailies-capture-templates)
(org-roam-capture--info (list (cons 'time time)))
(org-roam-capture--context 'dailies))
(add-hook 'org-capture-after-finalize-hook #'org-roam-capture--find-file-h)
(setq org-roam-capture-additional-template-props (list :finalize 'find-file))
(org-roam--with-template-error 'org-roam-dailies-capture-templates
(org-roam-capture--capture))))