[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote b17980a1af 3/5: Add function denote-retrieve-key
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote b17980a1af 3/5: Add function denote-retrieve-keywords-value-as-string |
Date: |
Mon, 16 Oct 2023 03:57:54 -0400 (EDT) |
branch: externals/denote
commit b17980a1af41d8befb5deada8618bdc3445b76d7
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add function denote-retrieve-keywords-value-as-string
---
README.org | 13 ++++++++++++-
denote.el | 13 ++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index c65c588c84..f6700ae394 100644
--- a/README.org
+++ b/README.org
@@ -3784,7 +3784,18 @@ might change them without further notice.
#+findex: denote-retrieve-keywords-value
+ Function ~denote-retrieve-keywords-value~ :: Return keywords value
- from =FILE= front matter per =FILE-TYPE=.
+ from =FILE= front matter per =FILE-TYPE=. The return value is a list
+ of strings. To get a combined string the way it would appear in a
+ Denote file name, use ~denote-retrieve-keywords-value-as-string~ [
+ That function is part of {{{development-version}}}. ].
+
+#+findex: denote-retrieve-keywords-value-as-string
++ Function ~denote-retrieve-keywords-value-as-string~ :: Return
+ keywords value from =FILE= front matter per =FILE-TYPE=. The return
+ value is a string, with the underscrore as a separator between
+ individual keywords. To get a list of strings instead, use
+ ~denote-retrieve-keywords-value~ (the current function uses that
+ internally). [ Part of {{{development-version}}}. ]
#+findex: denote-retrieve-keywords-line
+ Function ~denote-retrieve-keywords-line~ :: Return keywords line
diff --git a/denote.el b/denote.el
index a60d4d3cf3..5bf46731c2 100644
--- a/denote.el
+++ b/denote.el
@@ -1412,12 +1412,23 @@ Subroutine of `denote--file-with-temp-buffer'."
(buffer-substring-no-properties (line-beginning-position)
(line-end-position)))))
(defun denote-retrieve-keywords-value (file file-type)
- "Return keywords value from FILE front matter per FILE-TYPE."
+ "Return keywords value from FILE front matter per FILE-TYPE.
+The return value is a list of strings. To get a combined string
+the way it would appear in a Denote file name, use
+`denote-retrieve-keywords-value-as-string'."
(denote--file-with-temp-buffer file
(when (re-search-forward (denote--keywords-key-regexp file-type) nil t 1)
(funcall (denote--keywords-value-reverse-function file-type)
(buffer-substring-no-properties (point) (line-end-position))))))
+(defun denote-retrieve-keywords-value-as-string (file file-type)
+ "Return keywords value from FILE front matter per FILE-TYPE.
+The return value is a string, with the underscrore as a separator
+between individual keywords. To get a list of strings instead,
+use `denote-retrieve-keywords-value' (the current function uses
+that internally)."
+ (denote--keywords-combine (denote-retrieve-keywords-value file file-type)))
+
(defun denote-retrieve-keywords-line (file file-type)
"Return keywords line from FILE front matter per FILE-TYPE."
(denote--file-with-temp-buffer file