mirror of
https://github.com/org-roam/org-roam
synced 2025-08-03 12:27:23 -05:00
(fix)node: properly expand extraction file path (#2097)
Previously, the file-path of the new node in `org-roam-extract-subtree' was incorrect in many circumstances. Expanding w.r.t. the initial prompt directory (ie, `org-roam-directory') fixes that
This commit is contained in:
@ -131,7 +131,8 @@ It takes a single argument REF, which is a propertized string."
|
|||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
(defcustom org-roam-extract-new-file-path "%<%Y%m%d%H%M%S>-${slug}.org"
|
(defcustom org-roam-extract-new-file-path "%<%Y%m%d%H%M%S>-${slug}.org"
|
||||||
"The file path to use when a node is extracted to its own file."
|
"The file path template (relative to `org-roam-directory') to use
|
||||||
|
when a node is extracted to its own file."
|
||||||
:group 'org-roam
|
:group 'org-roam
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
@ -926,8 +927,11 @@ If region is active, then use it instead of the node at point."
|
|||||||
(t (let ((r (read-from-minibuffer (format "%s: " key) default-val)))
|
(t (let ((r (read-from-minibuffer (format "%s: " key) default-val)))
|
||||||
(plist-put template-info ksym r)
|
(plist-put template-info ksym r)
|
||||||
r)))))))
|
r)))))))
|
||||||
(file-path (read-file-name "Extract node to: "
|
(file-path
|
||||||
(file-name-as-directory org-roam-directory) template nil template)))
|
(expand-file-name
|
||||||
|
(read-file-name "Extract node to: "
|
||||||
|
(file-name-as-directory org-roam-directory) template nil template)
|
||||||
|
org-roam-directory)))
|
||||||
(when (file-exists-p file-path)
|
(when (file-exists-p file-path)
|
||||||
(user-error "%s exists. Aborting" file-path))
|
(user-error "%s exists. Aborting" file-path))
|
||||||
(org-cut-subtree)
|
(org-cut-subtree)
|
||||||
|
Reference in New Issue
Block a user