diff --git a/CHANGELOG.md b/CHANGELOG.md index 625f67b..7ba00ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.2.1 (TBD) + +### Breaking Changes + +### Features +- [#814] Implement `org-roam-insert-immediate` + +### Bugfixes + ## 1.2.0 (12-06-2020) In this release, we improved the linking process by achieving feature parity between links to files and links to headlines. Before, we used the `file:foo::*bar` format to link to the headline `bar` in file `foo`, but this was prone to breakage upon renaming the file or modifying the headline. This is not the case anymore. Now, we use `org-id` to create IDs for those headlines, which are then stored in our database to compute the relationships and jump around. Note that this will work even if you’re not using `org-id` in your global configuration for Org-mode. diff --git a/README.md b/README.md index 258a167..4860a8f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,8 @@ Here's a sample configuration with using `use-package`: ("C-c n f" . org-roam-find-file) ("C-c n g" . org-roam-show-graph)) :map org-mode-map - (("C-c n i" . org-roam-insert)))) + (("C-c n i" . org-roam-insert)) + (("C-c n I" . org-roam-insert-immediate)))) ``` `org-roam-graph` by default expects to find the `dot` executable diff --git a/org-roam-capture.el b/org-roam-capture.el index 898dc24..a74ca21 100644 --- a/org-roam-capture.el +++ b/org-roam-capture.el @@ -106,6 +106,12 @@ applies. inserted on initial creation (added only once). This is where insertion of any note metadata should go.") +(defvar org-roam-capture-immediate-template + (append (car org-roam-capture-templates) '(:immediate-finish t)) + "Capture template to use for immediate captures in Org-roam. +This is a single template, so do not enclose it into a list. +See `org-roam-capture-templates' for details on templates.") + (defvar org-roam-capture-ref-templates '(("r" "ref" plain (function org-roam-capture--get-point) "" diff --git a/org-roam.el b/org-roam.el index 5d8846e..af1ed7b 100644 --- a/org-roam.el +++ b/org-roam.el @@ -1378,6 +1378,18 @@ If DESCRIPTION is provided, use this as the link label. See (org-roam--with-template-error 'org-roam-capture-templates (org-roam-capture--capture)))))) +;;;###autoload +(defun org-roam-insert-immediate (arg &rest args) + "Find an Org-roam file, and insert a relative org link to it at point. +This variant of `org-roam-insert' inserts the link immediately by +using the template in `org-roam-capture-immediate-template'. The +interactive ARG and ARGS are forward to `org-roam-insert'. +See `org-roam-insert' for details." + (interactive "P") + (let ((args (push arg args)) + (org-roam-capture-templates (list org-roam-capture-immediate-template))) + (apply #'org-roam-insert args))) + ;;;###autoload (defun org-roam-jump-to-index () "Find the index file in `org-roam-directory'.