Fix file-prompt crash when denote-directory contains files like __.js

Using denote in a directory that includes files matching '*/__.js'
breaks with "Wrong type argument: stringp, nil" on the file prompt.
lodash ships such files in node_modules, so accidentally pointing
denote at a lodash checkout (or having one under denote-directory)
triggers the error.

These files pass denote-file-has-denoted-filename-p because the empty
keywords section matches denote-keywords-regexp, but they have no
identifier, so denote-file-prompt--format-identifier passed nil to
propertize during affixation. Return nil in that case;
denote-file-prompt-affixate already substitutes "" for a nil prefix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marco Baringer 2026-05-23 16:15:10 +02:00
parent 30c0d6536e
commit 6ba209704d
No known key found for this signature in database
GPG key ID: DB3AF548B79EE35D

View file

@ -1492,10 +1492,9 @@ there.")
(defun denote-file-prompt--format-identifier (file) (defun denote-file-prompt--format-identifier (file)
"Return identifier of FILE for `denote-file-prompt-affixate'." "Return identifier of FILE for `denote-file-prompt-affixate'."
(let* ((identifier (denote-retrieve-filename-identifier file)) (when-let* ((identifier (denote-retrieve-filename-identifier file))
(date-or-id (or (ignore-errors (denote-id-to-date identifier)) identifier)) (date-or-id (or (ignore-errors (denote-id-to-date identifier)) identifier)))
(propertized (propertize date-or-id 'face 'completions-annotations))) (format "%s " (propertize date-or-id 'face 'completions-annotations))))
(format "%s " propertized)))
(defun denote-file-prompt--format-keywords-and-signature (file) (defun denote-file-prompt--format-keywords-and-signature (file)
"Return keywords and signature of FILE for `denote-file-prompt-affixate'." "Return keywords and signature of FILE for `denote-file-prompt-affixate'."