diff --git a/doc/org-roam.org b/doc/org-roam.org index 2d9847a..7debbd2 100644 --- a/doc/org-roam.org +++ b/doc/org-roam.org @@ -569,7 +569,7 @@ the default template, reproduced below. 3. ~plain~ text is inserted. Other options include Org headings via ~entry~. 4. ~(function org-roam--capture-get-point)~ should not be changed. -5. ~"%?"~ is the template inserted on each call to ~org-roam-capture--capture~. +5. ~"%?"~ is the template inserted on each call to ~org-roam-capture-~. This template means don't insert any content, but place the cursor here. 6. ~:file-name~ is the file-name template for a new note, if it doesn't yet exist. This creates a file at path that looks like diff --git a/doc/org-roam.texi b/doc/org-roam.texi index 7e6e708..6a6e2af 100644 --- a/doc/org-roam.texi +++ b/doc/org-roam.texi @@ -938,7 +938,7 @@ The template is given a description of @code{"default"}. @code{(function org-roam--capture-get-point)} should not be changed. @item -@code{"%?"} is the template inserted on each call to @code{org-roam-capture--capture}. +@code{"%?"} is the template inserted on each call to @code{org-roam-capture-}. This template means don't insert any content, but place the cursor here. @item diff --git a/org-roam-capture.el b/org-roam-capture.el index dd64fc1..4890a24 100644 --- a/org-roam-capture.el +++ b/org-roam-capture.el @@ -353,7 +353,8 @@ properties to be added to the template." (rest (org-plist-delete template :key)) (rest (org-plist-delete rest :desc)) (rest (org-plist-delete rest :body)) - (org-roam-plist props) + (rest (append rest props)) + org-roam-plist options) (while rest (let* ((key (pop rest)) @@ -362,13 +363,15 @@ properties to be added to the template." (when (and custom (not val)) (user-error "Invalid capture template format: %s\nkey %s cannot be nil" template key)) - (push val (if custom org-roam-plist options)) - (push key (if custom org-roam-plist options)))) + (if custom + (setq org-roam-plist (plist-put org-roam-plist key val)) + (setq options (plist-put options key val))))) (append `(,key ,desc plain #'org-roam-capture--get-point ,body) options (list :org-roam org-roam-plist)))) -(cl-defun org-roam-capture--capture (&key goto keys info props templates) +;;;###autoload +(cl-defun org-roam-capture- (&key goto keys info props templates) "Main entry point. GOTO and KEYS correspond to `org-capture' arguments. INFO is an alist for filling up Org-roam's capture templates. @@ -391,12 +394,13 @@ This uses the templates defined at `org-roam-capture-templates'. Arguments GOTO and KEYS see `org-capture'." (interactive "P") (let ((node (org-roam-node-read))) - (org-roam-capture--capture :goto goto + (org-roam-capture- :goto goto :keys keys :info `((title . ,(org-roam-node-title node)) (slug . ,(funcall org-roam-title-to-slug-function (org-roam-node-title node))) - (file . ,(org-roam-node-file node)))))) + (file . ,(org-roam-node-file node))) + :props '(:immediate-finish nil)))) (provide 'org-roam-capture) diff --git a/org-roam-dailies.el b/org-roam-dailies.el index b07fcca..9ffa2a5 100644 --- a/org-roam-dailies.el +++ b/org-roam-dailies.el @@ -102,7 +102,7 @@ When GOTO is non-nil, go the note without creating an entry." (if goto (list (car it)) it))) (org-roam-capture--info (list (cons 'time time))) (org-roam-capture--context 'dailies)) - (org-roam-capture--capture :goto (when goto '(4)) + (org-roam-capture- :goto (when goto '(4)) :info (list (cons 'time time)) :context 'dailies))) diff --git a/org-roam-protocol.el b/org-roam-protocol.el index 2f1b329..8c06eef 100644 --- a/org-roam-protocol.el +++ b/org-roam-protocol.el @@ -79,7 +79,7 @@ It opens or creates a note with the given ref. :annotation orglink :initial body) (raise-frame) - (org-roam-capture--capture + (org-roam-capture- :keys (cdr (assoc 'template decoded-alist)) :info decoded-alist :props (list :ref ref) diff --git a/org-roam.el b/org-roam.el index d101d04..b5c6c85 100644 --- a/org-roam.el +++ b/org-roam.el @@ -687,7 +687,7 @@ If OTHER-WINDOW, visit the NODE in another window." (let ((node (org-roam-node-read initial-input filter-fn))) (if (org-roam-node-file node) (org-roam-node-visit node other-window) - (org-roam-capture--capture + (org-roam-capture- :info `((title . ,(org-roam-node-title node)) (slug . ,(funcall org-roam-title-to-slug-function (org-roam-node-title node)))) :props (list :finalize 'find-file))))) @@ -720,7 +720,7 @@ which takes as its argument an alist of path-completions." (insert (org-link-make-string (concat "id:" (org-roam-node-id node)) description))) - (org-roam-capture--capture + (org-roam-capture- :info `((title . ,(org-roam-node-title node)) (slug . ,(funcall org-roam-title-to-slug-function (org-roam-node-title node)))) :props (list :region (when (and beg end)