(fix): respect original link type during replacement (#1252)

During automatic link replacement, respect the original link type
i.e. absolute links remain absolute. Fixes #1228.
This commit is contained in:
Jethro Kuan
2020-11-11 14:25:50 +08:00
committed by GitHub
parent aef71f1623
commit e96685b1a9
3 changed files with 35 additions and 38 deletions

View File

@ -159,11 +159,11 @@ If there is no corresponding headline, return nil."
(org-id-get-create))))))))
;;; Path-related functions
(defun org-roam-link-get-path (path)
(defun org-roam-link-get-path (path &optional type)
"Return the PATH of the link to use.
Respect `org-link-file-path-type', see the variable documentation for details.
If DIR is passed, use DIR as the default directory."
(pcase org-roam-link-file-path-type
If TYPE is non-nil, create a link of TYPE. Otherwise, respect
`org-link-file-path-type'."
(pcase (or type org-roam-link-file-path-type)
('absolute
(abbreviate-file-name (expand-file-name path)))
('noabbrev