mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix)org-roam-file-p: don't exclude org-roam-directory (#2178)
* (fix)org-roam-file-p: don't exclude org-roam-directory Don't exlude the org-roam-directory even if it matches org-roam-file-exclude-regexp. Should fix [#2165]. * Refactor PR #2178 Refactor PR #2178 to avoid recalculating (file-relative-name path org-roam-directory) multiple timess.
This commit is contained in:
committed by
GitHub
parent
b63ff2a7bb
commit
5483e65d5a
@ -4,6 +4,7 @@
|
||||
### Added
|
||||
### Removed
|
||||
### Fixed
|
||||
- [#2165](https://github.com/org-roam/org-roam/pull/2165) (fix)org-roam-file-p: don't exclude org-roam-directory
|
||||
- [#2168](https://github.com/org-roam/org-roam/pull/2168) (perf)node-read: filter nodes before mapping --to-candidate
|
||||
### Changed
|
||||
|
||||
|
@ -193,6 +193,7 @@ FILE is an Org-roam file if:
|
||||
- It has a matching file extension (`org-roam-file-extensions')
|
||||
- It doesn't match excluded regexp (`org-roam-file-exclude-regexp')"
|
||||
(let* ((path (or file (buffer-file-name (buffer-base-buffer))))
|
||||
(relative-path (file-relative-name path org-roam-directory))
|
||||
(ext (when path (org-roam--file-name-extension path)))
|
||||
(ext (if (string= ext "gpg")
|
||||
(org-roam--file-name-extension (file-name-sans-extension path))
|
||||
@ -203,11 +204,11 @@ FILE is an Org-roam file if:
|
||||
(cond
|
||||
((not org-roam-file-exclude-regexp) nil)
|
||||
((stringp org-roam-file-exclude-regexp)
|
||||
(string-match-p org-roam-file-exclude-regexp path))
|
||||
(string-match-p org-roam-file-exclude-regexp relative-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))))
|
||||
(setq is-match (or is-match (string-match-p exclude-re relative-path))))
|
||||
is-match)))))
|
||||
(save-match-data
|
||||
(and
|
||||
|
Reference in New Issue
Block a user