branch: externals/denote commit 3189fbf4982128a2a3258303ad72779f0974ae2a Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make denote-open-or-create work with empty denote-directory The 'denote-file-prompt' would throw an error before. The correct behaviour is to proceed to the "Create" phase if the denote-directory is empty. Thanks to user drcxd for reporting the bug in issue 131 on the GitHub mirror and for testing my sample code: <https://github.com/protesilaos/denote/issues/131>. --- README.org | 4 ++-- denote.el | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.org b/README.org index 4481387e7f..305ffffb62 100644 --- a/README.org +++ b/README.org @@ -3722,8 +3722,8 @@ Denote is meant to be a collective effort. Every bit of help matters. Jack Baty, Jeremy Friesen, Juanjo Presa, Johan Bolmsjö, Kaushal Modi, M. Hadi Timachi, Mirko Hernandez, Paul van Gelder, Peter Prevos, Shreyas Ragavan, Stefan Thesing, Summer Emacs, Sven Seebeck, - Taoufik, Viktor Haag, Yi Liu, Ypot, atanasj, hpgisler, pRot0ta1p, - rbenit68, sienic, sundar bp. + Taoufik, Viktor Haag, Yi Liu, Ypot, atanasj, drcxd, hpgisler, + pRot0ta1p, rbenit68, sienic, sundar bp. Special thanks to Peter Povinec who helped refine the file-naming scheme, which is the cornerstone of this project. diff --git a/denote.el b/denote.el index 555ba875ec..75c50066c6 100644 --- a/denote.el +++ b/denote.el @@ -745,8 +745,9 @@ With optional INITIAL-TEXT, use it to prepopulate the minibuffer." (dirs (list (project-root project))) (all-files (project-files project dirs)) (completion-ignore-case read-file-name-completion-ignore-case)) - (funcall project-read-file-name-function - "Select note: " all-files nil 'denote--title-history initial-text))) + (when all-files + (funcall project-read-file-name-function + "Select note: " all-files nil 'denote--title-history initial-text)))) (define-obsolete-function-alias 'denote--retrieve-read-file-prompt @@ -1752,7 +1753,7 @@ further edit their last input, using it as the newly created note's actual title. At the `denote-title-prompt' type \\<minibuffer-local-map>\\[previous-history-element]." (interactive (list (denote-file-prompt))) - (if (file-exists-p target) + (if (and target (file-exists-p target)) (find-file target) (call-interactively #'denote)))