[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 06437c276e 1/2: Update the sample configuration
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/denote 06437c276e 1/2: Update the sample configuration for my-denote-journal |
|
Date: |
Thu, 25 May 2023 23:58:04 -0400 (EDT) |
branch: externals/denote
commit 06437c276e1fb88f92c1a16e20725366d8633a62
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Update the sample configuration for my-denote-journal
We already have this example in the manual, though it is helpful to
also show it in the sample configuration section.
---
README.org | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index 284ff8e3ee..d1e8f14b42 100644
--- a/README.org
+++ b/README.org
@@ -3126,11 +3126,23 @@ Everything is in place to set up the package.
;; showed in this manual. We define it here and add it to a key binding
;; below.
(defun my-denote-journal ()
- "Create an entry tagged 'journal', while prompting for a title."
+ "Create an entry tagged 'journal' with the date as its title.
+If a journal for the current day exists, visit it. If multiple
+entries exist, prompt with completion for a choice between them.
+Else create a new file."
(interactive)
- (denote
- (denote-title-prompt)
- '("journal")))
+ (let* ((today (format-time-string "%A %e %B %Y"))
+ (string (denote-sluggify today))
+ (files (denote-directory-files-matching-regexp string)))
+ (cond
+ ((> (length files) 1)
+ (find-file (completing-read "Select file: " files nil :require-match)))
+ (files
+ (find-file (car files)))
+ (t
+ (denote
+ today
+ '("journal"))))))
;; Denote DOES NOT define any key bindings. This is for the user to
;; decide. For example: