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

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

[elpa] externals/denote fc2e3aaefd 2/4: Merge pull request #175 from jea


From: ELPA Syncer
Subject: [elpa] externals/denote fc2e3aaefd 2/4: Merge pull request #175 from jeanphilippegg/small-fix
Date: Sun, 15 Oct 2023 12:57:47 -0400 (EDT)

branch: externals/denote
commit fc2e3aaefda1e69e710075ef9c13cd5bb19eaf2b
Merge: 9b8fb2e490 496187029a
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #175 from jeanphilippegg/small-fix
    
    Add denote-filename-is-note-p and use it in denote--buffer-file-names
---
 denote.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/denote.el b/denote.el
index ac2de851ef..d8b750b529 100644
--- a/denote.el
+++ b/denote.el
@@ -692,15 +692,20 @@ signatures and keywords."
 (defun denote-file-is-note-p (file)
   "Return non-nil if FILE is an actual Denote note.
 For our purposes, a note must not be a directory, must satisfy
-`file-regular-p', its path must be part of the variable
+`file-regular-p' and `denote-filename-is-note-p'."
+  (and (not (file-directory-p file))
+       (file-regular-p file)
+       (denote-filename-is-note-p file)))
+
+(defun denote-filename-is-note-p (filename)
+  "Return non-nil if FILENAME is a valid name for a Denote note.
+For our purposes, 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)
-         (string-prefix-p (denote-directory) (expand-file-name file))
-         (string-match-p (concat "\\`" denote-id-regexp) file-name)
-         (denote-file-has-supported-extension-p file))))
+  (and (string-prefix-p (denote-directory) (expand-file-name filename))
+       (string-match-p (concat "\\`" denote-id-regexp)
+                       (file-name-nondirectory filename))
+       (denote-file-has-supported-extension-p filename)))
 
 (defun denote-file-has-identifier-p (file)
   "Return non-nil if FILE has a Denote identifier."
@@ -1588,7 +1593,7 @@ where the former does not read dates without a time 
component."
          (lambda (buffer)
            (when-let (((buffer-live-p buffer))
                       (file (buffer-file-name buffer))
-                      ((denote-file-is-note-p file)))
+                      ((denote-filename-is-note-p file)))
              file))
          (buffer-list))))
 



reply via email to

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