From 63754d1ccd14f477396f8ee5342fc14e2f75adee Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 19 Feb 2020 20:15:13 -0500 Subject: [PATCH] (feature): make org-roam-insert work in org-capture buffers (#134) In org-capture buffers, (buffer-file-name) will always return nil. But we can get the name of the buffer that we are capturing into via (buffer-base-buffer), then getting the path to the current file works as expected. --- org-roam.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org-roam.el b/org-roam.el index 2a11ab9..3cf55aa 100644 --- a/org-roam.el +++ b/org-roam.el @@ -287,7 +287,8 @@ If PREFIX, downcase the title before insertion." (title (completing-read "File: " completions)) (absolute-file-path (or (cadr (assoc title completions)) (org-roam--make-new-file-path (org-roam--get-new-id title) t))) - (current-file-path (-> (current-buffer) + (current-file-path (-> (or (buffer-base-buffer) + (current-buffer)) (buffer-file-name) (file-truename) (file-name-directory))))