Hello,
Currently denote-rename-file-using-front-matter is failing when there
are no keywords on the front-matter, even if the filename is computed
correctly without them.
I coincidentally came across this email today, which had the same exact
issue but with the signature:
https://lists.sr.ht/~protesilaos/denote/%3C87zg86lru9.fsf%40kotlak.com%3E
I based my change on that fix, let me know if that's OK.
Thanks for the great project!
Eduardo Grajeda (1):
Fix denote-rename-file-using-front-matter failing when no keywords
denote.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--
2.34.7
[PATCH denote 1/1] Fix denote-rename-file-using-front-matter failing when no keywords
From: Eduardo Grajeda <tatofoo@gmail.com>
Keywords are optional, and the filename is computed properly when
they are nil.
---
denote.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/denote.el b/denote.el
index ca997c5..796257c 100644
--- a/denote.el+++ b/denote.el
@@ -2320,15 +2320,17 @@ proceed with the renaming."
(user-error "The file is not writable or does not have a supported file extension"))
(if-let* ((file-type (denote-filetype-heuristics file))
(title (denote-retrieve-title-value file file-type))
- (keywords (denote-retrieve-keywords-value file file-type)) (extension (file-name-extension file t))
(id (denote-retrieve-or-create-file-identifier file))
(dir (file-name-directory file))
(new-name (denote-format-file-name
- dir id keywords (denote-sluggify title) extension- ;; The `denote-retrieve-filename-signature' is+ ;; The `denote-retrieve-keywords-value' and+ ;; `denote-retrieve-filename-signature' are ;; not inside the `if-let*' because we do not
- ;; want to throw an exception if it is nil.+ ;; want to throw an exception if any is nil.+ dir id+ (or (denote-retrieve-keywords-value file file-type) nil)+ (denote-sluggify title) extension (or (denote-retrieve-filename-signature file) nil))))
(when (or auto-confirm
(denote-rename-file-prompt file new-name))
--
2.34.7
Re: [PATCH denote 1/1] Fix denote-rename-file-using-front-matter failing when no keywords
> From: ~egrajeda <egrajeda@git.sr.ht>> Date: Tue, 21 Mar 2023 22:43:15 +0100>> From: Eduardo Grajeda <tatofoo@gmail.com>>> Keywords are optional, and the filename is computed properly when> they are nil.
I installed your patch. Thank you!
--
Protesilaos Stavrou
https://protesilaos.com