(fix): Respect org-roam-file-extensions during file creation (#602)

This commit is contained in:
Jethro Kuan
2020-05-12 19:08:00 +08:00
committed by GitHub
parent b4927abbd7
commit a85205e7bc

View File

@ -88,7 +88,7 @@ Formatter may be a function that takes title as its only argument."
:group 'org-roam) :group 'org-roam)
(defcustom org-roam-encrypt-files nil (defcustom org-roam-encrypt-files nil
"Whether to encrypt new files. If true, create files with .org.gpg extension." "Whether to encrypt new files. If true, create files with .gpg extension."
:type 'boolean :type 'boolean
:group 'org-roam) :group 'org-roam)
@ -99,6 +99,7 @@ Formatter may be a function that takes title as its only argument."
(defcustom org-roam-file-extensions '("org") (defcustom org-roam-file-extensions '("org")
"Detected file extensions to include in the Org-roam ecosystem. "Detected file extensions to include in the Org-roam ecosystem.
The first item in the list is used as the default file extension.
While the file extensions may be different, the file format needs While the file extensions may be different, the file format needs
to be an `org-mode' file, and it is the user's responsibility to to be an `org-mode' file, and it is the user's responsibility to
ensure that." ensure that."
@ -691,11 +692,14 @@ included as a candidate."
(defun org-roam--file-path-from-id (id) (defun org-roam--file-path-from-id (id)
"The file path for an Org-roam file, with identifier ID." "The file path for an Org-roam file, with identifier ID."
(file-truename (file-truename
(expand-file-name (let* ((ext (or (car org-roam-file-extensions)
(if org-roam-encrypt-files "org"))
(concat id ".org.gpg") (file (concat id "." ext)))
(concat id ".org")) (expand-file-name
org-roam-directory))) (if org-roam-encrypt-files
(concat file ".gpg")
file)
org-roam-directory))))
;;; The org-roam buffer ;;; The org-roam buffer
;;;; org-roam-link-face ;;;; org-roam-link-face