summaryrefslogtreecommitdiffstats
path: root/init.el
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2022-12-08 08:38:25 +0000
committerMatthew Lemon <matt@matthewlemon.com>2022-12-08 08:38:25 +0000
commitf5e5319fdf6e89e19b0dc7094288e39a6b6527f7 (patch)
tree60970fdaff4ce1269e4507f3a055f1e6a98d1c46 /init.el
parentbe2539ca8c2d8c1ba8f8ac6fadf208971772686a (diff)
refactored journal func to remove unnecessary conditional
Diffstat (limited to 'init.el')
-rw-r--r--init.el24
1 files changed, 11 insertions, 13 deletions
diff --git a/init.el b/init.el
index 081950a..aa0bd7e 100644
--- a/init.el
+++ b/init.el
@@ -272,20 +272,18 @@ Restart works only on graphic display."
(month-match? (string-match-p (concat (number-to-string month-regexp) "..T") f)))
(when (and day-match? year-match? month-match?)
f)))
-
(defun mrl/denote-journal ()
- "Create an entry tagged 'journal' with the date as its title."
- (interactive)
- (let* ((today-journal (mapcar #'mrl/is-todays-journal? (directory-files (denote-directory) nil "_journal")))
- (journal (if (> (length today-journal) 1) ; need to apply the -non-nil LIST func here to remove nils
- (car (cdr today-journal))
- nil)))
- (if journal
- (progn
- (find-file (concat (denote-directory) journal)))
- (denote
- (format-time-string "%A %e %B %Y")
- '("journal")))))
+ "Create an entry tagged 'journal' with the date as its title."
+ (interactive)
+ (let* ((today-journal
+ (car (-non-nil
+ (mapcar #'mrl/is-todays-journal? (directory-files (denote-directory) nil "_journal"))))))
+ (if today-journal
+ (find-file (concat (denote-directory )today-journal))
+ (denote
+ (format-time-string "%A %e %B %Y")
+ '("journal")))))
+
:bind (("C-c n n" . denote-create-note)
("C-c n d" . mrl/denote-journal)
("C-c n t" . denote-type))