fix lints

This commit is contained in:
Jethro Kuan
2021-04-07 10:09:46 +08:00
parent 18aa3ac787
commit 5a3363ac22
2 changed files with 20 additions and 10 deletions

View File

@ -252,10 +252,14 @@ the capture)."
(cl-defun org-roam-capture--finalize-find-file (&key id) (cl-defun org-roam-capture--finalize-find-file (&key id)
"Visit the buffer after Org-capture is done. "Visit the buffer after Org-capture is done.
This function is to be called in the org-capture finalization process." This function is to be called in the org-capture finalization process.
ID is unused."
(switch-to-buffer (org-capture-get :buffer))) (switch-to-buffer (org-capture-get :buffer)))
(cl-defun org-roam-capture--finalize-insert-link (&key id) (cl-defun org-roam-capture--finalize-insert-link (&key id)
"Inserts the link into the buffer where org-capture was called.
ID is the Org id of the newly captured content.
This function is to be called in the org-capture finalization process."
(when-let* ((mkr (org-roam-capture--get :insert-at)) (when-let* ((mkr (org-roam-capture--get :insert-at))
(buf (marker-buffer mkr))) (buf (marker-buffer mkr)))
(with-current-buffer buf (with-current-buffer buf
@ -264,9 +268,9 @@ This function is to be called in the org-capture finalization process."
(delete-region (car region) (cdr region)) (delete-region (car region) (cdr region))
(set-marker (car region) nil) (set-marker (car region) nil)
(set-marker (cdr region) nil)) (set-marker (cdr region) nil))
(let ((desc (org-roam-capture--get :link-description))) (org-with-point-at mkr
(org-with-point-at mkr (insert (org-link-make-string (concat "id:" id)
(insert (org-link-make-string (concat "id:" id) desc))))))) (desc (org-roam-capture--get :link-description))))))))
(defun org-roam-capture--finalize-create-id () (defun org-roam-capture--finalize-create-id ()
"Get ID for newly captured information." "Get ID for newly captured information."
@ -517,6 +521,10 @@ This function is used solely in Org-roam's capture templates: see
(_ (user-error "Invalid capture template format: %s" template)))) (_ (user-error "Invalid capture template format: %s" template))))
(cl-defun org-roam-capture--capture (&key goto keys info context) (cl-defun org-roam-capture--capture (&key goto keys info context)
"Main entry point.
GOTO and KEYS correspond to `org-capture' arguments.
INFO is an alist for filling up Org-roam's capture templates.
CONTEXT is the context of the call. TODO fix this"
(let* ((org-capture-templates (let* ((org-capture-templates
(mapcar #'org-roam-capture--convert-template org-roam-capture-templates)) (mapcar #'org-roam-capture--convert-template org-roam-capture-templates))
(org-roam-capture--info info) (org-roam-capture--info info)

View File

@ -688,9 +688,10 @@ If OTHER-WINDOW, visit the NODE in another window."
(if (org-roam-node-file node) (if (org-roam-node-file node)
(org-roam-node-visit node other-window) (org-roam-node-visit node other-window)
(setq org-roam-capture-additional-template-props (list :finalize 'find-file)) (setq org-roam-capture-additional-template-props (list :finalize 'find-file))
(org-roam-capture--capture :info `((title . ,(org-roam-node-title node)) (org-roam-capture--capture
(slug . ,(funcall org-roam-title-to-slug-function (org-roam-node-title node)))) :info `((title . ,(org-roam-node-title node))
:context 'title)))) (slug . ,(funcall org-roam-title-to-slug-function (org-roam-node-title node))))
:context 'title))))
(defun org-roam-node-insert (&optional filter-fn) (defun org-roam-node-insert (&optional filter-fn)
"Find an Org-roam file, and insert a relative org link to it at point. "Find an Org-roam file, and insert a relative org link to it at point.
@ -726,9 +727,10 @@ which takes as its argument an alist of path-completions."
:insert-at (point-marker) :insert-at (point-marker)
:link-description description :link-description description
:finalize 'insert-link)) :finalize 'insert-link))
(org-roam-capture--capture :info `((title . ,(org-roam-node-title node)) (org-roam-capture--capture
(slug . ,(funcall org-roam-title-to-slug-function (org-roam-node-title node)))) :info `((title . ,(org-roam-node-title node))
:context 'title)))) (slug . ,(funcall org-roam-title-to-slug-function (org-roam-node-title node))))
:context 'title))))
(deactivate-mark))) (deactivate-mark)))
;;;###autoload ;;;###autoload