Make denote-retrieve-title-or-filename be a wrapper only

We do not want it to return the file-name-base because this will
duplicate the text of the file name when there is no TITLE component,
as demonstrated by duli in issue 347: <https://github.com/protesilaos/denote/issues/347>.
This commit is contained in:
Protesilaos Stavrou 2024-05-12 11:31:00 +03:00
parent a6a5698acf
commit f08bed0909
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 7 additions and 10 deletions

View file

@ -4360,10 +4360,11 @@ might change them without further notice.
#+findex: denote-retrieve-title-or-filename
+ Function ~denote-retrieve-title-or-filename~ :: Return appropriate
title for =FILE= given its =TYPE=. Try to find the value of the
title in the front matter of FILE, otherwise use its file name. This
is a wrapper for ~denote-retrieve-front-matter-title-value~ and
=denote-retrieve-filename-title=.
title for =FILE= given its =TYPE=. This is a wrapper for
~denote-retrieve-front-matter-title-value~ and
=denote-retrieve-filename-title=. [ Simplified as part of
{{{development-version}}} to only be a wrapper as its doc string
suggests. ]
#+findex: denote-get-identifier
+ Function ~denote-get-identifier~ :: Convert =DATE= into a Denote
@ -5438,7 +5439,7 @@ Denote is meant to be a collective effort. Every bit of help matters.
Prevos, Peter Smith, Suhail Singh, Shreyas Ragavan, Stefan Thesing,
Summer Emacs, Sven Seebeck, Taoufik, TJ Stankus, Vick (VicZz),
Viktor Haag, Wade Mealing, Yi Liu, Ypot, atanasj, babusri, doolio,
drcxd, fingerknight, hpgisler, mentalisttraceur, pRot0ta1p,
duli, drcxd, fingerknight, hpgisler, mentalisttraceur, pRot0ta1p,
rbenit68, relict007, sienic, sundar bp.
Special thanks to Peter Povinec who helped refine the file-naming

View file

@ -1796,17 +1796,13 @@ The return value is a list of strings."
(defun denote-retrieve-title-or-filename (file type)
"Return appropriate title for FILE given its TYPE.
Try to find the value of the title in the front matter of FILE,
otherwise use its file name.
This is a wrapper for `denote-retrieve-front-matter-title-value' and
`denote-retrieve-filename-title'."
(if-let (((denote-file-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)
(file-name-base file))))
(denote-retrieve-filename-title file)))
(defun denote--retrieve-location-in-xrefs (identifier)
"Return list of xrefs for IDENTIFIER with their respective location.