7a026533051982d3b97704ff345227d419aa9980 — Protesilaos Stavrou 2 months ago 42fcbd3
Fix nil file expansion in denote--extract-title-from-file-history

Thanks to ezchi for bringing this matter to my attention.  It was done
in issue 166 on the GitHub mirror:
2 files changed, 3 insertions(+), 5 deletions(-)

M denote.el
M README.org => README.org +1 -1
@@ 4528,7 4528,7 @@ Denote is meant to be a collective effort.  Every bit of help matters.
  Fargas, Matthew Lemon, Noboru Ota (nobiot), Norwid Behrnd, Peter
  Prevos, Philip Kaludercic, Quiliro Ordóñez, Stefan Monnier, Stefan
  Thesing, Thibaut Benjamin, Tomasz Hołubowicz, Vedang Manerikar,
  ezchi, relict007.

+ Ideas and/or user feedback :: Abin Simon, Aditya Yadav, Alan
  Schmitt, Alfredo Borrás, Ashton Wiersdorf, Benjamin Kästner, Colin

M denote.el => denote.el +2 -4
@@ 2020,10 2020,8 @@ technicalities)."

(defun denote--extract-title-from-file-history ()
  "Extract last file title input from `file-name-history'."
  ;; We do not need to check if `file-name-history' is initialised
  ;; because it is defined in files.el.  My understanding is that it
  ;; is always loaded.
  (when-let ((title (expand-file-name (car denote--file-history))))
  (when-let ((file (car denote--file-history))
             (title (expand-file-name file)))
    (string-match (denote-directory) title)
    (substring title (match-end 0))))