branch: elpa/denote-refs
commit 9bca564284e646a9315996df812f7608f51b3544
Author: Akib Azmain Turja <[email protected]>
Commit: Akib Azmain Turja <[email protected]>

    Report zero references when file doesn't exist
    
    * denote-refs.el (denote-refs--fetch): Report zero references
    when buffer file doesn't exist.
---
 denote-refs.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/denote-refs.el b/denote-refs.el
index 76a763b791..43595cfc2c 100644
--- a/denote-refs.el
+++ b/denote-refs.el
@@ -199,18 +199,21 @@ The car is PATH relative to user option 
`denote-directory'."
 
 (defun denote-refs--fetch ()
   "Fetch reference information."
-  (when (and (buffer-file-name) (file-exists-p (buffer-file-name)))
-    (dolist (section denote-refs-sections)
-      (pcase-exhaustive section
-        ('links
-         (setq denote-refs--links
+  (dolist (section denote-refs-sections)
+    (pcase-exhaustive section
+      ('links
+       (setq denote-refs--links
+             (when (and (buffer-file-name)
+                        (file-exists-p (buffer-file-name)))
                (mapcar #'denote-refs--make-path-relative
                        (denote-link--expand-identifiers
                         (denote--link-in-context-regexp
                          (denote-filetype-heuristics
-                          (buffer-file-name)))))))
-        ('backlinks
-         (setq denote-refs--backlinks
+                          (buffer-file-name))))))))
+      ('backlinks
+       (setq denote-refs--backlinks
+             (when (and (buffer-file-name)
+                        (file-exists-p (buffer-file-name)))
                (mapcar #'denote-refs--make-path-relative
                        (delete (buffer-file-name)
                                (denote--retrieve-files-in-xrefs

Reply via email to