[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote dbdf8f58f2 1/6: Make denote-file-is-note-p publi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote dbdf8f58f2 1/6: Make denote-file-is-note-p public |
Date: |
Wed, 14 Sep 2022 04:57:31 -0400 (EDT) |
branch: externals/denote
commit dbdf8f58f231ac4a067769e23260d4b6b1403204
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Make denote-file-is-note-p 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.
---
README.org | 6 ++++++
denote.el | 25 +++++++++++++++++--------
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/README.org b/README.org
index 0bb3fe4320..8d6a0786f5 100644
--- a/README.org
+++ b/README.org
@@ -2015,6 +2015,12 @@ By contradistinction, a "private" form is declared with
two hyphens in
its symbol such as ~denote--file-extension~. Do not use those as we
might change them without further notice.
++ ~denote-file-is-note-p~ :: Return non-nil if =FILE= is an actual Denote
+ note. For our purposes, a note must note be a directory, must satisfy
+ ~file-regular-p~, its path must be part of the variable
+ ~denote-directory~, it must have a Denote identifier in its name, and
+ use one of the extensions implied by ~denote-file-type~.
+
+ ~denote-directory-files~ :: List absolute file paths in variable
~denote-directory~. The returned files only need to have an
identifier. This may include files that are not implied by
diff --git a/denote.el b/denote.el
index e0102fb0c0..392e77db80 100644
--- a/denote.el
+++ b/denote.el
@@ -462,8 +462,12 @@ leading and trailing hyphen."
"Return non-nil if FILE is empty."
(zerop (or (file-attribute-size (file-attributes file)) 0)))
-(defun denote--only-note-p (file)
- "Make sure FILE is an actual Denote note."
+(defun denote-file-is-note-p (file)
+ "Return non-nil if FILE is an actual Denote note.
+For our purposes, a note must note be a directory, must satisfy
+`file-regular-p', its path must be part of the variable
+`denote-directory', it must have a Denote identifier in its name,
+and use one of the extensions implied by `denote-file-type'."
(let ((file-name (file-name-nondirectory file)))
(and (not (file-directory-p file))
(file-regular-p file)
@@ -471,6 +475,11 @@ leading and trailing hyphen."
(string-match-p (concat "\\`" denote--id-regexp) file-name)
(denote--file-supported-extension-p file))))
+(define-obsolete-function-alias
+ 'denote--only-note-p
+ 'denote-file-is-note-p
+ "1.0.0")
+
(defun denote--file-has-identifier-p (file)
"Return non-nil if FILE has a Denote identifier."
(let ((file-name (file-name-nondirectory file)))
@@ -993,7 +1002,7 @@ To only return an existing identifier, refer to the
function
(defun denote--retrieve-title-or-filename (file type)
"Return appropriate title for FILE given its TYPE."
- (if (denote--only-note-p file)
+ (if (denote-file-is-note-p file)
(denote-retrieve-title-value file type)
(denote-retrieve-filename-title file)))
@@ -1015,7 +1024,7 @@ Parse `denote--retrieve-xrefs'."
(defun denote--retrieve-process-grep (identifier)
"Process lines matching IDENTIFIER and return list of files."
(seq-filter
- #'denote--only-note-p
+ #'denote-file-is-note-p
(delete (buffer-file-name) (denote--retrieve-files-in-xrefs
(denote--retrieve-xrefs identifier)))))
@@ -1158,7 +1167,7 @@ where the former does not read dates without a time
component."
(defun denote--buffer-file-names ()
"Return file names of active buffers."
(seq-filter
- #'denote--only-note-p
+ #'denote-file-is-note-p
(delq nil
(mapcar
#'buffer-file-name
@@ -1503,7 +1512,7 @@ the file type is assumed to be the first of
`denote-file-types'."
"1.0.0")
(defun denote--add-front-matter (file title keywords id file-type)
- "Prepend front matter to FILE if `denote--only-note-p'.
+ "Prepend front matter to FILE if `denote-file-is-note-p'.
The TITLE, KEYWORDS ID, and FILE-TYPE are passed from the
renaming command and are used to construct a new front matter
block if appropriate."
@@ -2460,10 +2469,10 @@ inserts links with just the identifier."
nil t)))
(defun denote-link--map-over-notes ()
- "Return list of `denote--only-note-p' from Dired marked items."
+ "Return list of `denote-file-is-note-p' from Dired marked items."
(seq-filter
(lambda (f)
- (and (denote--only-note-p f)
+ (and (denote-file-is-note-p f)
(denote--dir-in-denote-directory-p default-directory)))
(dired-get-marked-files)))
- [elpa] externals/denote updated (ea0f50575e -> fb92d22a57), ELPA Syncer, 2022/09/14
- [elpa] externals/denote 46e207a2cd 4/6: Fix typo in doc string, ELPA Syncer, 2022/09/14
- [elpa] externals/denote dbdf8f58f2 1/6: Make denote-file-is-note-p public,
ELPA Syncer <=
- [elpa] externals/denote d6b0355483 2/6: Fix typo in the manual, ELPA Syncer, 2022/09/14
- [elpa] externals/denote 88c396e0bb 3/6: Make two file/note predicates public, ELPA Syncer, 2022/09/14
- [elpa] externals/denote 8c11c5867d 5/6: Make denote-file-is-writable-and-supported-p public, ELPA Syncer, 2022/09/14
- [elpa] externals/denote fb92d22a57 6/6: Make denote-file-name-relative-to-denote-directory public, ELPA Syncer, 2022/09/14