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

    Refine denote-dired--filetype-heuristics
    
    This guards against unailable front matter while trying to define what
    Markdown flavour to use.
---
 denote-dired.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/denote-dired.el b/denote-dired.el
index 3964c9d0da..3063185a23 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -265,7 +265,8 @@ Return t if the file is renamed, nil otherwise."
   "Return likely file type of FILE.
 The return value is for `denote--file-meta-header'."
   (pcase (file-name-extension file)
-    ("md" (if (string-match-p "title\\s-*=" (denote-retrieve--value-title file 
t))
+    ("md" (if-let ((title-key (denote-retrieve--value-title file t))
+                   ((string-match-p "title\\s-*=" title-key)))
               'markdown-toml
             'markdown-yaml))
     ("txt" 'text)

Reply via email to