[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote ee2d92859e 04/10: Merge pull request #443 from b
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote ee2d92859e 04/10: Merge pull request #443 from brabalan/denote-journal-extra-path-to-new-or-existing-entry |
Date: |
Fri, 20 Sep 2024 09:57:56 -0400 (EDT) |
branch: externals/denote
commit ee2d92859e483095db6069d86f136e5253fefe5d
Merge: dcd92c4ac6 126238c9c1
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>
Merge pull request #443 from
brabalan/denote-journal-extra-path-to-new-or-existing-entry
add `denote-journal-extra-path-to-new-or-existing-entry'
---
denote-journal-extras.el | 43 ++++++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/denote-journal-extras.el b/denote-journal-extras.el
index 7223da0e88..ee69644313 100644
--- a/denote-journal-extras.el
+++ b/denote-journal-extras.el
@@ -172,6 +172,24 @@ DATE has the same format as that returned by
`denote-parse-date'."
(string-match-p keyword file))
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."
+ (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))
+ (files
+ (car files))
+ (t nil))))
+
;;;###autoload
(defun denote-journal-extras-new-or-existing-entry (&optional date)
"Locate an existing journal entry or create a new one.
@@ -194,15 +212,9 @@ It is internally processed by `denote-parse-date'."
(list
(when current-prefix-arg
(denote-date-prompt))))
- (let* ((internal-date (denote-parse-date date))
- (files (denote-journal-extras--entry-today internal-date)))
- (cond
- ((length> files 1)
- (find-file (completing-read "Select journal entry: " files nil
:require-match)))
- (files
- (find-file (car files)))
- (t
- (denote-journal-extras-new-entry date)))))
+ (let ((path (denote-journal-extra-path-to-new-or-existing-entry date)))
+ (if path (find-file path)
+ (denote-journal-extras-new-entry date))))
;;;###autoload
(defun denote-journal-extras-link-or-create-entry (&optional date id-only)
@@ -230,19 +242,12 @@ file's title. This has the same meaning as in
`denote-link'."
(pcase current-prefix-arg
('(16) (list (denote-date-prompt) :id-only))
('(4) (list (denote-date-prompt)))))
- (let* ((internal-date (denote-parse-date date))
- (files (denote-journal-extras--entry-today internal-date))
- (path))
- (cond
- ((length> files 1)
- (setq path (completing-read "Select journal entry: " files nil
:require-match)))
- (files
- (setq path (car files)))
- (t
+ (let ((path (denote-journal-extra-path-to-new-or-existing-entry date)))
+ (unless path
(save-window-excursion
(denote-journal-extras-new-entry date)
(save-buffer)
- (setq path (buffer-file-name)))))
+ (setq path (buffer-file-name))))
(denote-link path
(denote-filetype-heuristics (buffer-file-name))
(denote--link-get-description path)
- [elpa] externals/denote updated (dcd92c4ac6 -> 0377530250), ELPA Syncer, 2024/09/20
- [elpa] externals/denote 7ddff697fc 02/10: Make a sample code a bit more robust, ELPA Syncer, 2024/09/20
- [elpa] externals/denote 126238c9c1 03/10: add `denote-journal-extra-path-to-new-or-existing-entry', ELPA Syncer, 2024/09/20
- [elpa] externals/denote 433422758a 06/10: Tweak denote-journal-extra-path-to-new-or-existing-entry, ELPA Syncer, 2024/09/20
- [elpa] externals/denote 3694b19cd3 09/10: Untabify and reindent the main file, ELPA Syncer, 2024/09/20
- [elpa] externals/denote 0377530250 10/10: Fix typo in doc string, ELPA Syncer, 2024/09/20
- [elpa] externals/denote ee2d92859e 04/10: Merge pull request #443 from brabalan/denote-journal-extra-path-to-new-or-existing-entry,
ELPA Syncer <=
- [elpa] externals/denote 1ddf6787dc 05/10: Merge branch 'main' of github.com:protesilaos/denote, ELPA Syncer, 2024/09/20
- [elpa] externals/denote 7fd4160a99 01/10: Remove an empty line, ELPA Syncer, 2024/09/20
- [elpa] externals/denote 09e4c6692f 07/10: Placate the compiler about 'denote-file-type', ELPA Syncer, 2024/09/20
- [elpa] externals/denote cd6bfb03fa 08/10: Make stylistic change to denote-link--buffer-prompt, ELPA Syncer, 2024/09/20