branch: externals/denote-journal commit b8038eb334a946f9c29a30c3a5d94d405889c31a Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make denote-journal--date-in-interval-p use if-let* throughout Since Alan Schmitt correctly converted the original 'if' to an 'if-let' in commit b72cec4, we might as well remove the intermediate 'let'. Alan's contribution was made in pull request 20: <https://github.com/protesilaos/denote-journal/pull/20>. Alan has assigned copyright to the Free Software Foundation. --- denote-journal.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/denote-journal.el b/denote-journal.el index 7b2491691e..6cf5ac296a 100644 --- a/denote-journal.el +++ b/denote-journal.el @@ -251,18 +251,19 @@ DATE has the same format as that returned by `denote-valid-date-p'." "Return DATE if it is within the INTERVAL else nil. INTERVAL is one among the symbols used by `denote-journal-interval'. DATE has the same format as that returned by `denote-valid-date-p'." - (if-let ((date (denote-valid-date-p date))) - (let* ((current (current-time)) - (specifiers (pcase interval - ('weekly "%Y-%V") - ('monthly "%Y-%m") - ('yearly "%Y")))) - (cond - ((null specifiers) - date) - ((string= (format-time-string specifiers date) - (format-time-string specifiers current)) - date))) + (if-let* ((date (denote-valid-date-p date)) + (current (current-time)) + (specifiers (pcase interval + ('weekly "%Y-%V") + ('monthly "%Y-%m") + ('yearly "%Y") + (_ t)))) + (cond + ((eq specifiers t) + date) + ((string= (format-time-string specifiers date) + (format-time-string specifiers current)) + date)) (error "The date `%s' does not satisfy `denote-valid-date-p'" date))) (defun denote-journal--get-entry (date interval)