mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(core): ignore org-attach-id-dir by default (#2160)
This commit is contained in:
26
org-roam.el
26
org-roam.el
@ -83,6 +83,7 @@
|
||||
(require 'emacsql-sqlite)
|
||||
|
||||
(require 'org)
|
||||
(require 'org-attach) ; To set `org-attach-id-dir'
|
||||
(require 'org-id)
|
||||
(require 'ol)
|
||||
(require 'org-element)
|
||||
@ -136,9 +137,11 @@ responsibility to ensure that."
|
||||
:type '(repeat string)
|
||||
:group 'org-roam)
|
||||
|
||||
(defcustom org-roam-file-exclude-regexp nil
|
||||
(defcustom org-roam-file-exclude-regexp (list org-attach-id-dir)
|
||||
"Files matching this regular expression are excluded from the Org-roam."
|
||||
:type '(choice
|
||||
(repeat
|
||||
(string :tag "Regular expression matching files to ignore"))
|
||||
(string :tag "Regular expression matching files to ignore")
|
||||
(const :tag "Include everything" nil))
|
||||
:group 'org-roam)
|
||||
@ -193,14 +196,25 @@ FILE is an Org-roam file if:
|
||||
(ext (when path (org-roam--file-name-extension path)))
|
||||
(ext (if (string= ext "gpg")
|
||||
(org-roam--file-name-extension (file-name-sans-extension path))
|
||||
ext)))
|
||||
ext))
|
||||
(org-roam-dir-p (org-roam-descendant-of-p path org-roam-directory))
|
||||
(valid-file-ext-p (member ext org-roam-file-extensions))
|
||||
(match-exclude-regexp-p
|
||||
(cond
|
||||
((not org-roam-file-exclude-regexp) nil)
|
||||
((stringp org-roam-file-exclude-regexp)
|
||||
(string-match-p org-roam-file-exclude-regexp path))
|
||||
((listp org-roam-file-exclude-regexp)
|
||||
(let (is-match)
|
||||
(dolist (exclude-re org-roam-file-exclude-regexp)
|
||||
(setq is-match (or is-match (string-match-p exclude-re path))))
|
||||
is-match)))))
|
||||
(save-match-data
|
||||
(and
|
||||
path
|
||||
(member ext org-roam-file-extensions)
|
||||
(not (and org-roam-file-exclude-regexp
|
||||
(string-match-p org-roam-file-exclude-regexp path)))
|
||||
(org-roam-descendant-of-p path (expand-file-name org-roam-directory))))))
|
||||
org-roam-dir-p
|
||||
valid-file-ext-p
|
||||
(not match-exclude-regexp-p)))))
|
||||
|
||||
(defun org-roam-list-files ()
|
||||
"Return a list of all Org-roam files under `org-roam-directory'.
|
||||
|
Reference in New Issue
Block a user