Do not try front matter rewrite on non-notes

This commit is contained in:
Protesilaos Stavrou 2022-06-16 09:08:01 +03:00
parent 9be3cfab99
commit a0525a0154
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -214,10 +214,12 @@ The return value is for `denote--file-meta-header'."
"Rewrite front matter of note after `denote-dired-rename-file'.
The FILE, TITLE, and KEYWORDS are passed from the renaming
command and are used to construct a new front matter block."
(when (and (file-regular-p file)
(file-writable-p file)
;; Heuristic to check if this is one of our notes
(string= default-directory (abbreviate-file-name (denote-directory))))
(when-let ((ext (file-name-extension file))
((and (file-regular-p file)
(file-writable-p file)
(string-match-p "\\(md\\|org\\|txt\\)\\'" ext)
;; Heuristic to check if this is one of our notes
(string= default-directory (abbreviate-file-name (denote-directory))))))
(let* ((id (denote-retrieve--filename-identifier file))
(date (denote-retrieve--value-date file))
(filetype (denote-dired--filetype-heuristics file))