diff --git a/CHANGELOG.md b/CHANGELOG.md index d7851e8..8ca4636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ In this release we support fuzzy links of the form `[[Title]]`, `[[*Headline]]` ### Features +- [#1046](https://github.com/org-roam/org-roam/pull/1046) New user option to exclude files from Org-roam - [#1032](https://github.com/org-roam/org-roam/pull/1032) File changes are now propagated to the database on idle timer. This prevents large wait times during file saves. - [#974](https://github.com/org-roam/org-roam/pull/974) Protect region targeted by `org-roam-insert` - [#994](https://github.com/org-roam/org-roam/pull/994) Simplify org-roam-store-link diff --git a/doc/org-roam.org b/doc/org-roam.org index 0df331f..faaec2c 100644 --- a/doc/org-roam.org +++ b/doc/org-roam.org @@ -513,6 +513,10 @@ This section concerns the placement and creation of files. It is the user’s responsibility to set this correctly, especially when used with multiple Org-roam instances. +- Variable: org-roam-file-exclude-regexp + + Files matching this regular expression are excluded from the Org-roam. + ** The Org-roam Buffer The Org-roam buffer displays backlinks for the currently active Org-roam note. diff --git a/doc/org-roam.texi b/doc/org-roam.texi index 8f57d5d..22e9d99 100644 --- a/doc/org-roam.texi +++ b/doc/org-roam.texi @@ -731,6 +731,11 @@ database is saved here. It is the user’s responsibility to set this correctly, especially when used with multiple Org-roam instances. + +@item +Variable: org-roam-file-exclude-regexp + +Files matching this regular expression are excluded from the Org-roam. @end itemize @node The Org-roam Buffer diff --git a/org-roam.el b/org-roam.el index 666ff79..a4895b0 100644 --- a/org-roam.el +++ b/org-roam.el @@ -100,6 +100,13 @@ ensure that." :type '(repeat string) :group 'org-roam) +(defcustom org-roam-file-exclude-regexp nil + "Files matching this regular expression are excluded from the Org-roam." + :type '(choice + (string :tag "Regular expression matching files to ignore") + (const :tag "Include everything" nil)) + :group 'org-roam) + (defcustom org-roam-find-file-function nil "Function called when visiting files in Org-roam commands. If nil, `find-file' is used." @@ -342,6 +349,8 @@ If FILE is not specified, use the current buffer's file-path." (save-match-data (and (org-roam--org-file-p path) + (not (and org-roam-file-exclude-regexp + (string-match-p org-roam-file-exclude-regexp path))) (f-descendant-of-p (file-truename path) (file-truename org-roam-directory))))))