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

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

[elpa] externals/denote 26629820f7 2/6: Refactor denote-retrieve-title-o


From: ELPA Syncer
Subject: [elpa] externals/denote 26629820f7 2/6: Refactor denote-retrieve-title-or-filename
Date: Mon, 9 Dec 2024 06:58:47 -0500 (EST)

branch: externals/denote
commit 26629820f7c05393b6e14ad9848258258d72e836
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Refactor denote-retrieve-title-or-filename
    
    Use denote-file-has-denoted-filename-p function. It does not validate
    the location of the file. It validates that the file respects Denote's
    file-naming scheme instead of only the presence of an identifier.
---
 denote.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/denote.el b/denote.el
index 3fb9532f30..992c57ce39 100644
--- a/denote.el
+++ b/denote.el
@@ -2145,13 +2145,16 @@ or `line', referring to what the function should 
retrieve."
   "Return appropriate title for FILE given its TYPE.
 This is a wrapper for `denote-retrieve-front-matter-title-value' and
 `denote-retrieve-filename-title'."
-  (if-let* (((denote-filename-is-note-p file))
-            (title (denote-retrieve-front-matter-title-value file type))
-            ((not (string-blank-p title))))
-      title
-    (or (denote-retrieve-filename-title file)
-        (and (not (denote-file-has-identifier-p file))
-             (file-name-base file)))))
+  (let ((has-denoted-filename (denote-file-has-denoted-filename-p file))
+        (has-supported-extension (denote-file-has-supported-extension-p file)))
+    (cond ((and has-denoted-filename has-supported-extension)
+           (or (denote-retrieve-front-matter-title-value file type)
+               (denote-retrieve-filename-title file)
+               ""))
+          (has-denoted-filename
+           (or (denote-retrieve-filename-title file) ""))
+          (t
+           (file-name-base file)))))
 
 (defun denote--retrieve-location-in-xrefs (identifier)
   "Return list of xrefs for IDENTIFIER with their respective location.



reply via email to

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