branch: externals/denote
commit 23d268a15675cc7175ad74f463d1575b098dc24c
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Fix regression caused by commit f08bed0
    
    We want the title prompt to do the following:
    
    1. Find the title from the file's front matter.
    2. Find the title from the relevant Denote file name component.
    3. Fall back to the name of the file UNLESS it already has an
       identifier. In this case, the file does not have a Denote title
       component, so we do not want to put the rest of the file name (e.g.
       identifier plus signature/keywords) as the initial title as that
       will duplicate the contents of the file name.
    
    We had this before, but point 3 was failing.
    
    Thanks to Alan Schmitt for bringing this matter to my attention in
    discussion 353: <https://github.com/protesilaos/denote/discussions/353>.
---
 denote.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 8980441860..eb4e5089a4 100644
--- a/denote.el
+++ b/denote.el
@@ -1795,7 +1795,9 @@ This is a wrapper for 
`denote-retrieve-front-matter-title-value' and
            (title (denote-retrieve-front-matter-title-value file type))
            ((not (string-blank-p title))))
       title
-    (denote-retrieve-filename-title file)))
+    (or (denote-retrieve-filename-title file)
+        (and (not (denote-file-has-identifier-p file))
+             (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