branch: externals/denote commit 433422758ac8c7d402a8d93f50fd51badf826e20 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Tweak denote-journal-extra-path-to-new-or-existing-entry This builds on top of commit 126238c by Alan Schmitt, which was done in pull request 443: <https://github.com/protesilaos/denote/pull/443>. The change extracts the code we had in a function into a separate function, though Alan has anyway assigned copyright to the Free Software Foundation. --- denote-journal-extras.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/denote-journal-extras.el b/denote-journal-extras.el index ee69644313..a6976db3a7 100644 --- a/denote-journal-extras.el +++ b/denote-journal-extras.el @@ -173,19 +173,20 @@ DATE has the same format as that returned by `denote-parse-date'." files))) (defun denote-journal-extra-path-to-new-or-existing-entry (&optional date) - "Return the path to the journal file corresponding to DATE, or to -the current date if DATE in nil. DATE is a string and has the same -format as that covered in the documentation of the `denote' function. -It is internally processed by `denote-parse-date'. - -If there are multiple journal entries for the date, prompt for one -using minibuffer completion. If there is only one, return it. If -there is no journal entry, return nil." + "Return path to existing or new journal file. +With optional DATE, do it for that date, else do it for today. DATE is +a string and has the same format as that covered in the documentation of +the `denote' function. It is internally processed by +`denote-parse-date'. + +If there are multiple journal entries for the date, prompt for one among +them using minibuffer completion. If there is only one, return it. If +there can be no journal entry, return nil." (let* ((internal-date (denote-parse-date date)) (files (denote-journal-extras--entry-today internal-date))) (cond ((length> files 1) - (completing-read "Select journal entry: " files nil :require-match)) + (completing-read "Select journal entry: " files nil t)) (files (car files)) (t nil)))) @@ -213,7 +214,8 @@ It is internally processed by `denote-parse-date'." (when current-prefix-arg (denote-date-prompt)))) (let ((path (denote-journal-extra-path-to-new-or-existing-entry date))) - (if path (find-file path) + (if path + (find-file path) (denote-journal-extras-new-entry date)))) ;;;###autoload