(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.
This commit is contained in:
Jeremy Dormitzer
2020-02-19 20:15:13 -05:00
committed by GitHub
parent 05ada41710
commit 63754d1ccd

View File

@@ -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))))