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

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

[elpa] externals/denote 8ce221da71: Make denote-extract-keywords-from-pa


From: ELPA Syncer
Subject: [elpa] externals/denote 8ce221da71: Make denote-extract-keywords-from-path public
Date: Thu, 15 Sep 2022 08:57:33 -0400 (EDT)

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

    Make denote-extract-keywords-from-path public
    
    We are working towards version 1.0.0.  The idea is to provide functions
    that users/developers can rely on.  By making them public (removing the
    double hyphens) we signify that those forms are (i) in a stable
    state, and (ii) any change to them will be handled with care and
    documented accordingly.
    
    Thanks to Peter Prevos for informing me about this function on the
    mailing list in relation to the 'denote-statistics' package:
    
    - <https://github.com/pprevos/denote-statistics>
    - 
<https://lists.sr.ht/~protesilaos/denote/%3C87o7vio7ix.fsf%40protesilaos.com%3E#%3C87r10cexe6.fsf@prevos.net%3E>
---
 README.org |  6 ++++++
 denote.el  | 15 ++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index 6114f1ef79..91483e0360 100644
--- a/README.org
+++ b/README.org
@@ -2139,6 +2139,12 @@ might change them without further notice.
   equivalent: they will all be converted into a single string.
   =EXTENSION= is the file type extension, as a string.
 
+#+findex: denote-extract-keywords-from-path
++ ~denote-extract-keywords-from-path~ :: Extract keywords from =PATH=
+  and return them as a list of strings.  =PATH= must be a Denote-style
+  file name where keywords are prefixed with an underscore.  If =PATH=
+  has no such keywords, return nil 
([[#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d][The file-naming scheme]]).
+
 #+findex: denote-retrieve-filename-identifier
 + ~denote-retrieve-filename-identifier~ :: Extract identifier from
   =FILE= name.  To only return an existing identifier or create a new
diff --git a/denote.el b/denote.el
index e62a8f02f9..1a8c04eb8b 100644
--- a/denote.el
+++ b/denote.el
@@ -621,19 +621,28 @@ value, as explained in its doc string."
 
 ;;;; Keywords
 
-(defun denote--extract-keywords-from-path (path)
-  "Extract keywords from PATH."
+(defun denote-extract-keywords-from-path (path)
+  "Extract keywords from PATH and return them as a list of strings.
+PATH must be a Denote-style file name where keywords are prefixed
+with an underscore.
+
+If PATH has no such keywords, return nil."
   (let* ((file-name (file-name-nondirectory path))
          (kws (when (string-match denote--keywords-regexp file-name)
                 (match-string-no-properties 1 file-name))))
     (when kws
       (split-string kws "_"))))
 
+(define-obsolete-function-alias
+  'denote--extract-keywords-from-path
+  'denote-extract-keywords-from-path
+  "1.0.0")
+
 (defun denote--inferred-keywords ()
   "Extract keywords from `denote-directory-files'.
 This function returns duplicates.  The `denote-keywords' is the
 one that doesn't."
-  (mapcan #'denote--extract-keywords-from-path
+  (mapcan #'denote-extract-keywords-from-path
           (denote-directory-files)))
 
 (defun denote-keywords ()



reply via email to

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