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

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

[elpa] externals/denote 416f2546ec 2/2: Make code for file type extensio


From: ELPA Syncer
Subject: [elpa] externals/denote 416f2546ec 2/2: Make code for file type extensions public
Date: Thu, 25 May 2023 23:58:05 -0400 (EDT)

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

    Make code for file type extensions public
    
    This is meant for developers who need to reuse parts of the Denote
    code for their extensions.
---
 README.org | 13 +++++++++++++
 denote.el  | 35 +++++++++++++++++++++++++----------
 2 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/README.org b/README.org
index d1e8f14b42..9f65c8a376 100644
--- a/README.org
+++ b/README.org
@@ -3275,6 +3275,19 @@ might change them without further notice.
 + Function ~denote-file-is-writable-and-supported-p~ :: Return non-nil
   if =FILE= is writable and has supported extension.
 
+#+findex: denote-file-type-extensions
++ Function ~denote-file-type-extensions~ :: Return all file type
+  extensions in ~denote-file-types~. [Part of {{{development-version}}}.]
+
+#+variable: denote-encryption-file-extensions
++ Variable ~denote-encryption-file-extensions~ :: List of strings
+  specifying file extensions for encryption.
+
+#+function: denote-file-type-extensions-with-encryption
++ Function ~denote-file-type-extensions-with-encryption~ :: Derive
+  ~denote-file-type-extensions~ plus ~denote-encryption-file-extensions~.
+  [Part of {{{development-version}}}.]
+
 #+findex: denote-keywords
 + Function ~denote-keywords~ :: Return appropriate list of keyword
   candidates.  If ~denote-infer-keywords~ is non-nil, infer keywords
diff --git a/denote.el b/denote.el
index ae6f7b6fcb..ff92796322 100644
--- a/denote.el
+++ b/denote.el
@@ -671,7 +671,7 @@ Also account for the possibility of an added .gpg suffix.
 Supported extensions are those implied by `denote-file-type'."
   (seq-some (lambda (e)
               (string-suffix-p e file))
-            (denote--extensions-with-encryption)))
+            (denote-file-type-extensions-with-encryption)))
 
 (define-obsolete-function-alias
   'denote--file-supported-extension-p
@@ -809,7 +809,7 @@ whatever matches `denote-excluded-directories-regexp'."
                 (or (string= (denote--file-extension denote-file-type)
                              file-extension)
                     (string= ".org" file-extension)
-                    (member file-extension (denote--extensions))))))
+                    (member file-extension (denote-file-type-extensions))))))
        files))))
 
 (define-obsolete-function-alias
@@ -1220,24 +1220,39 @@ for new note creation.  The default is `org'.")
    (alist-get file-type denote-file-types)
    :link-in-context-regexp))
 
-(defun denote--extensions ()
-  "Return all extensions in `denote-file-types'."
+(define-obsolete-function-alias
+  'denote--extensions
+  'denote-file-type-extensions
+  "2.0.0")
+
+(defun denote-file-type-extensions ()
+  "Return all file type extensions in `denote-file-types'."
   (delete-dups
    (mapcar (lambda (type)
              (plist-get (cdr type) :extension))
            denote-file-types)))
 
+(define-obsolete-variable-alias
+  'denote--encryption-file-extensions
+  'denote-encryption-file-extensions
+  "2.0.0")
+
 ;; TODO 2023-01-24: Perhaps there is a good reason to make this a user
-;; option, but I am keeping it as a private variable for now.
-(defvar denote--encryption-file-extensions '(".gpg" ".age")
+;; option, but I am keeping it as a generic variable for now.
+(defvar denote-encryption-file-extensions '(".gpg" ".age")
   "List of strings specifying file extensions for encryption.")
 
-(defun denote--extensions-with-encryption ()
-  "Derive `denote--extensions' including `denote--encryption-file-extensions'."
-  (let ((file-extensions (denote--extensions))
+(define-obsolete-function-alias
+  'denote--extensions-with-encryption
+  'denote-file-type-extensions-with-encryption
+  "2.0.0")
+
+(defun denote-file-type-extensions-with-encryption ()
+  "Derive `denote-file-type-extensions' plus 
`denote-encryption-file-extensions'."
+  (let ((file-extensions (denote-file-type-extensions))
         all)
     (dolist (ext file-extensions)
-      (dolist (enc denote--encryption-file-extensions)
+      (dolist (enc denote-encryption-file-extensions)
         (push (concat ext enc) all)))
     (append file-extensions all)))
 



reply via email to

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