branch: externals/denote
commit 1ac6a22ee3573c1c8ebff819e14642d6d863c75b
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Simplify the 'denote-links' Org dynamic block; add :id-only parameter
---
denote-org-dblock.el | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/denote-org-dblock.el b/denote-org-dblock.el
index fffcd80e06..353367a382 100644
--- a/denote-org-dblock.el
+++ b/denote-org-dblock.el
@@ -50,28 +50,23 @@
(read-regexp "Search for notes matching REGEX: " nil
'denote-link--add-links-history)))
(org-create-dblock (list :name "denote-links"
:regexp regexp
+ :id-only nil
:reverse nil))
(org-update-dblock))
(org-dynamic-block-define "denote-links" 'denote-org-dblock-insert-links)
-;; By using the `org-dblock-write:' format, Org-mode knows how to
-;; compute the dynamic block. Inner workings of this function copied
-;; from `denote-add-links'.
(defun org-dblock-write:denote-links (params)
"Function to update `denote-links' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
(let* ((regexp (plist-get params :regexp))
(rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
(block-name (plist-get params :block-name))
- (denote-link-add-links-sort (plist-get params :reverse))
- (current-file (buffer-file-name)))
+ (denote-link-add-links-sort (plist-get params :reverse)))
(when block-name
(insert "#+name: " block-name "\n"))
- (when-let ((files (delete current-file
- (denote-directory-files-matching-regexp rx))))
- (insert (denote-link--prepare-links files current-file nil))
- (join-line)))) ;; remove trailing empty line
+ (denote-add-links rx (plist-get params :id-only))
+ (join-line))) ; remove trailing empty line
;;;; Dynamic block to insert backlinks