emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote e3a7572fea: Check for readable file in 'denote-f


From: ELPA Syncer
Subject: [elpa] externals/denote e3a7572fea: Check for readable file in 'denote-files' Org dynamic block
Date: Sun, 26 Nov 2023 09:57:37 -0500 (EST)

branch: externals/denote
commit e3a7572feaee8ac4822b9d239774e86bd838ab4b
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Check for readable file in 'denote-files' Org dynamic block
---
 denote-org-dblock.el | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/denote-org-dblock.el b/denote-org-dblock.el
index ebb30e084a..ed2e5a288e 100644
--- a/denote-org-dblock.el
+++ b/denote-org-dblock.el
@@ -100,27 +100,28 @@ file and then insert its contents.  In this case, format 
the
 contents as a typographic list.  If ADD-LINKS is `id-only', then
 insert links as `denote-link' does when supplied with an ID-ONLY
 argument."
-  (with-temp-buffer
-    (when add-links
-      (insert
-       (format "- %s\n\n"
-               (denote-format-link
-                file
-                (if (eq add-links 'id-only)
-                    denote-id-only-link-format
-                  denote-org-link-format)
-                nil))))
-    (let ((beginning-of-contents (point)))
-      (insert-file-contents file)
-      (when no-front-matter
-        (delete-region
-         (if (natnump no-front-matter)
-             (progn (forward-line no-front-matter) (line-beginning-position))
-           (1+ (re-search-forward "^$" nil :no-error 1)))
-         beginning-of-contents))
+  (when (denote-file-is-note-p file)
+    (with-temp-buffer
       (when add-links
-        (indent-region beginning-of-contents (point-max) 2)))
-    (buffer-string)))
+        (insert
+         (format "- %s\n\n"
+                 (denote-format-link
+                  file
+                  (if (eq add-links 'id-only)
+                      denote-id-only-link-format
+                    denote-org-link-format)
+                  nil))))
+      (let ((beginning-of-contents (point)))
+        (insert-file-contents file)
+        (when no-front-matter
+          (delete-region
+           (if (natnump no-front-matter)
+               (progn (forward-line no-front-matter) (line-beginning-position))
+             (1+ (re-search-forward "^$" nil :no-error 1)))
+           beginning-of-contents))
+        (when add-links
+          (indent-region beginning-of-contents (point-max) 2)))
+      (buffer-string))))
 
 (defvar denote-org-dblock-file-contents-separator
   (concat "\n\n" (make-string 50 ?-) "\n\n\n")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]