mirror of
https://github.com/org-roam/org-roam
synced 2025-08-03 12:27:23 -05:00
(fix) org-roam-file-p
handle opening a buffer with no path (#2169)
* (fix) org-roam-file-p handle opening a buffer with no path Found this issue when opening a .epub file with nov.el (a package that renders EPUB file) because nov.el doesn't store the filename in buffer-file-name, opening it caused errors with org-roam-file-p. * (minor): org-roam-file-p check if filename is non-nil first
This commit is contained in:
@ -192,8 +192,9 @@ FILE is an Org-roam file if:
|
|||||||
- It's located somewhere under `org-roam-directory'
|
- It's located somewhere under `org-roam-directory'
|
||||||
- It has a matching file extension (`org-roam-file-extensions')
|
- It has a matching file extension (`org-roam-file-extensions')
|
||||||
- It doesn't match excluded regexp (`org-roam-file-exclude-regexp')"
|
- It doesn't match excluded regexp (`org-roam-file-exclude-regexp')"
|
||||||
|
(when (or file (buffer-file-name (buffer-base-buffer)))
|
||||||
(let* ((path (or file (buffer-file-name (buffer-base-buffer))))
|
(let* ((path (or file (buffer-file-name (buffer-base-buffer))))
|
||||||
(ext (when path (org-roam--file-name-extension path)))
|
(ext (org-roam--file-name-extension path))
|
||||||
(ext (if (string= ext "gpg")
|
(ext (if (string= ext "gpg")
|
||||||
(org-roam--file-name-extension (file-name-sans-extension path))
|
(org-roam--file-name-extension (file-name-sans-extension path))
|
||||||
ext))
|
ext))
|
||||||
@ -214,7 +215,7 @@ FILE is an Org-roam file if:
|
|||||||
path
|
path
|
||||||
org-roam-dir-p
|
org-roam-dir-p
|
||||||
valid-file-ext-p
|
valid-file-ext-p
|
||||||
(not match-exclude-regexp-p)))))
|
(not match-exclude-regexp-p))))))
|
||||||
|
|
||||||
(defun org-roam-list-files ()
|
(defun org-roam-list-files ()
|
||||||
"Return a list of all Org-roam files under `org-roam-directory'.
|
"Return a list of all Org-roam files under `org-roam-directory'.
|
||||||
|
Reference in New Issue
Block a user