[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 9bf10437e0 058/355: Add denote-front-matter-date
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 9bf10437e0 058/355: Add denote-front-matter-date-format user option |
Date: |
Sun, 26 Jun 2022 23:58:00 -0400 (EDT) |
branch: externals/denote
commit 9bf10437e0e8211622e9e5e5dbce6eac29b17f0d
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add denote-front-matter-date-format user option
Thanks to Kaushal Modi for proposing the use of an Org timestamp. (It
was done via email and this information is shared with permission.)
---
README.org | 14 ++++++++++++++
denote.el | 30 +++++++++++++++++++++++++++++-
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/README.org b/README.org
index 05b781e299..265804d15b 100644
--- a/README.org
+++ b/README.org
@@ -331,11 +331,13 @@ Everything is in place to set up the package.
#+begin_src emacs-lisp
(require 'denote)
+;; Remember to check the doc strings of those variables.
(setq denote-directory (expand-file-name "~/Documents/notes/"))
(setq denote-known-keywords
'("emacs" "philosophy" "politics" "economics"))
(setq denote-infer-keywords t)
(setq denote-sort-keywords t)
+(setq denote-front-matter-date-format 'org-timestamp)
(require 'denote-link)
(require 'denote-dired)
@@ -358,6 +360,18 @@ Everything is in place to set up the package.
:jump-to-captured t))))
#+end_src
+* Acknowledgements
+:PROPERTIES:
+:CUSTOM_ID: h:f8126820-3b59-49fa-bcc2-73bd60132bb9
+:END:
+#+cindex: Contributors
+
+Denote is meant to be a collective effort. Every bit of help matters.
+
++ Author/maintainer :: Protesilaos Stavrou.
+
++ Ideas and/or user feedback :: Kaushal Modi.
+
* GNU Free Documentation License
:PROPERTIES:
:APPENDIX: t
diff --git a/denote.el b/denote.el
index 6f5e47c862..6a4a911aa3 100644
--- a/denote.el
+++ b/denote.el
@@ -82,6 +82,24 @@ If nil, show the keywords in their given order."
:group 'denote
:type 'boolean)
+(defcustom denote-front-matter-date-format nil
+ "Date format in the front matter (file header) of new notes.
+
+If the value is nil, use a plain date in YEAR-MONTH-DAY notation,
+like 2022-06-08.
+
+If the value is the `org-timestamp' symbol, format the date as an
+inactive Org timestamp such as: [2022-06-08 Wed 06:19].
+
+If a string, use it as the argument of `format-time-string'.
+Read the documentation of that function for valid format
+specifiers."
+ :type '(choice
+ (const :tag "Just the date like 2022-06-08" nil)
+ (const :tag "An inactive Org timestamp like [2022-06-08 Wed 06:19]"
org-timestamp)
+ (string :tag "Custom format for `format-time-string'"))
+ :group 'denote)
+
;;;; Main variables
(defconst denote--id "%Y%m%d_%H%M%S"
@@ -288,6 +306,16 @@ Format current time, else use optional ID."
keywords
(denote--sluggify title))))
+(defun denote--date ()
+ "Expand the date for a new note's front matter."
+ (let ((format denote-front-matter-date-format))
+ (cond
+ ((eq format 'org-timestamp)
+ (format-time-string "[%F %a %R]"))
+ ((stringp format)
+ (format-time-string format))
+ (t (format-time-string "%F")))))
+
(defun denote--prepare-note (title keywords &optional path)
"Use TITLE and KEYWORDS to prepare new note file.
Use optional PATH, else create it with `denote--path'."
@@ -295,7 +323,7 @@ Use optional PATH, else create it with `denote--path'."
(default-directory denote-directory)
(buffer (unless path (find-file p)))
(header (denote--file-meta-header
- title (format-time-string "%F") keywords p
+ title (denote--date) keywords p
(format-time-string denote--id))))
(unless path
(with-current-buffer buffer (insert header))
- [elpa] externals/denote 27642bee14 026/355: Clarify 'denote' doc string, (continued)
- [elpa] externals/denote 27642bee14 026/355: Clarify 'denote' doc string, ELPA Syncer, 2022/06/26
- [elpa] externals/denote ec3847607b 028/355: Remove to-do about file name format, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 7fe66f43d4 030/355: Remove needless outline and empty line, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 550428cabf 037/355: Add sample org-capture-templates to Commentary, ELPA Syncer, 2022/06/26
- [elpa] externals/denote efd5135835 039/355: Improve linking functionality, ELPA Syncer, 2022/06/26
- [elpa] externals/denote a34ca52fbf 040/355: Fix regression in M-x denote, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 3b62f8e167 043/355: Implement denote-link-clear-stale-backlinks, ELPA Syncer, 2022/06/26
- [elpa] externals/denote d57ff29c3b 045/355: Add denote--file-regexp, ELPA Syncer, 2022/06/26
- [elpa] externals/denote de00f939d3 048/355: Fix typo, ELPA Syncer, 2022/06/26
- [elpa] externals/denote bf342a1d39 057/355: Correct factual statement about command args, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 9bf10437e0 058/355: Add denote-front-matter-date-format user option,
ELPA Syncer <=
- [elpa] externals/denote 96eee4aeba 068/355: Change placement of findex keyword in the manual, ELPA Syncer, 2022/06/26
- [elpa] externals/denote d09b748c8d 063/355: Fix fontification; add denote-dired-directories, ELPA Syncer, 2022/06/26
- [elpa] externals/denote f8ea03abfb 067/355: Add documentation about renaming non-notes, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 431124fea1 060/355: Generalise dired fontification, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 147901f971 072/355: Rename 'denote--directory' to 'denote-directory', ELPA Syncer, 2022/06/26
- [elpa] externals/denote a5120e0e93 061/355: Enable optional EXTENSION in file name creation, ELPA Syncer, 2022/06/26
- [elpa] externals/denote a6303a6101 074/355: Update doc string of variable 'denote-directory', ELPA Syncer, 2022/06/26
- [elpa] externals/denote e2c49771f7 078/355: Placate the compiler about symbol disambiguation, ELPA Syncer, 2022/06/26
- [elpa] externals/denote e8c1e31dec 084/355: Expand gitignore, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 739d485600 079/355: Fix bug about missing point in link de-duplication, ELPA Syncer, 2022/06/26