mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(feature): add a variable org-roam-new-file-directory
(#141)
Fixes #140
This commit is contained in:
@ -10,6 +10,7 @@
|
|||||||
* [#103][gh-103] Change `org-roam-file-format` to a function: `org-roam-file-name-function` to allow more flexible file name customizaton. Also changes `org-roam-use-timestamp-as-filename` to `org-roam-filename-noconfirm` to better describe what it does.
|
* [#103][gh-103] Change `org-roam-file-format` to a function: `org-roam-file-name-function` to allow more flexible file name customizaton. Also changes `org-roam-use-timestamp-as-filename` to `org-roam-filename-noconfirm` to better describe what it does.
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
* [#141][gh-141] add variable `org-roam-new-file-directory` for new Org-roam files
|
||||||
* [#138][gh-138] add `org-roam-switch-to-buffer`
|
* [#138][gh-138] add `org-roam-switch-to-buffer`
|
||||||
* [#124][gh-124] Maintain cache consistency on file rename
|
* [#124][gh-124] Maintain cache consistency on file rename
|
||||||
* [#87][gh-87], [#90][gh-90] Support encrypted Org files
|
* [#87][gh-87], [#90][gh-90] Support encrypted Org files
|
||||||
@ -75,9 +76,11 @@ Mostly a documentation/cleanup release.
|
|||||||
[gh-108]: https://github.com/jethrokuan/org-roam/pull/108
|
[gh-108]: https://github.com/jethrokuan/org-roam/pull/108
|
||||||
[gh-110]: https://github.com/jethrokuan/org-roam/pull/110
|
[gh-110]: https://github.com/jethrokuan/org-roam/pull/110
|
||||||
[gh-122]: https://github.com/jethrokuan/org-roam/pull/122
|
[gh-122]: https://github.com/jethrokuan/org-roam/pull/122
|
||||||
|
[gh-124]: https://github.com/jethrokuan/org-roam/pull/124
|
||||||
[gh-128]: https://github.com/jethrokuan/org-roam/pull/128
|
[gh-128]: https://github.com/jethrokuan/org-roam/pull/128
|
||||||
[gh-136]: https://github.com/jethrokuan/org-roam/pull/136
|
[gh-136]: https://github.com/jethrokuan/org-roam/pull/136
|
||||||
[gh-138]: https://github.com/jethrokuan/org-roam/pull/138
|
[gh-138]: https://github.com/jethrokuan/org-roam/pull/138
|
||||||
|
[gh-141]: https://github.com/jethrokuan/org-roam/pull/141
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# eval: (auto-fill-mode -1)
|
# eval: (auto-fill-mode -1)
|
||||||
|
14
org-roam.el
14
org-roam.el
@ -58,6 +58,13 @@ All Org files, at any level of nesting, is considered part of the Org-roam."
|
|||||||
:type 'directory
|
:type 'directory
|
||||||
:group 'org-roam)
|
:group 'org-roam)
|
||||||
|
|
||||||
|
(defcustom org-roam-new-file-directory nil
|
||||||
|
"Path to where new Org-roam files are created.
|
||||||
|
|
||||||
|
If nil, default to the org-roam-directory (preferred)."
|
||||||
|
:type 'directory
|
||||||
|
:group 'org-roam)
|
||||||
|
|
||||||
(defcustom org-roam-buffer-position 'right
|
(defcustom org-roam-buffer-position 'right
|
||||||
"Position of `org-roam' buffer.
|
"Position of `org-roam' buffer.
|
||||||
|
|
||||||
@ -191,7 +198,8 @@ If `ABSOLUTE', return an absolute file-path. Else, return a relative file-path."
|
|||||||
(if org-roam-encrypt-files
|
(if org-roam-encrypt-files
|
||||||
(concat id ".org.gpg")
|
(concat id ".org.gpg")
|
||||||
(concat id ".org"))
|
(concat id ".org"))
|
||||||
org-roam-directory))))
|
(or org-roam-new-file-directory
|
||||||
|
org-roam-directory)))))
|
||||||
(if absolute
|
(if absolute
|
||||||
absolute-file-path
|
absolute-file-path
|
||||||
(file-relative-name absolute-file-path
|
(file-relative-name absolute-file-path
|
||||||
@ -242,9 +250,9 @@ If not provided, derive the title from the file name."
|
|||||||
"Create an org-roam file at FILE-PATH, optionally setting the TITLE attribute."
|
"Create an org-roam file at FILE-PATH, optionally setting the TITLE attribute."
|
||||||
(if (file-exists-p file-path)
|
(if (file-exists-p file-path)
|
||||||
(error (format "Aborting, file already exists at %s" file-path))
|
(error (format "Aborting, file already exists at %s" file-path))
|
||||||
|
(make-empty-file file-path t)
|
||||||
(if org-roam-autopopulate-title
|
(if org-roam-autopopulate-title
|
||||||
(org-roam--populate-title file-path title)
|
(org-roam--populate-title file-path title))
|
||||||
(make-empty-file file-path))
|
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(with-current-buffer (find-file-noselect file-path)
|
(with-current-buffer (find-file-noselect file-path)
|
||||||
(org-roam--update-cache)))))
|
(org-roam--update-cache)))))
|
||||||
|
Reference in New Issue
Block a user