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

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

[elpa] externals/denote 71051c85f2 2/8: Make denote--link-get-descriptio


From: ELPA Syncer
Subject: [elpa] externals/denote 71051c85f2 2/8: Make denote--link-get-description-with-signature work with selected region
Date: Mon, 16 Oct 2023 09:57:52 -0400 (EDT)

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

    Make denote--link-get-description-with-signature work with selected region
---
 denote.el | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/denote.el b/denote.el
index 670ad11193..85c6fa1581 100644
--- a/denote.el
+++ b/denote.el
@@ -2856,7 +2856,9 @@ retrieved from the FILE, unless the FORMAT is
   "Return description for `denote-link'.
 If the region is active, make the description the text within the
 region's boundaries.  Else retrieve the title from FILE, given
-FILE-TYPE."
+FILE-TYPE.
+
+Also see `denote--link-get-description-with-signature'."
   (if-let (((region-active-p))
            (beg (region-beginning))
            (end (region-end))
@@ -2916,14 +2918,19 @@ treats the active region specially, is up to it."
 
 (defun denote--link-get-description-with-signature (file file-type)
   "Return `denote-link-with-signature' description.
-Retrieve the title and signature from FILE with FILE-TYPE."
+Retrieve the title and signature from FILE with FILE-TYPE.  If
+the region is active, use it to describe the link instead of the
+file's title.  Make the signature a prefix.  If there is no title
+or text in the active region, return the signature on its own.
+
+Also see `denote--link-get-description'."
   (let* ((signature (denote-retrieve-filename-signature file))
-         (title (denote-retrieve-title-value file file-type))
-         (specifiers (if (and title
-                              (not (string-empty-p title)))
+         (text (denote--link-get-description file file-type))
+         (specifiers (if (and text
+                              (not (string-empty-p text)))
                          "%s %s"
                        "%s")))
-    (format specifiers signature title)))
+    (format specifiers signature text)))
 
 ;;;###autoload
 (defun denote-link-with-signature ()



reply via email to

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