BREAKING Change date/identifier pattern

Before it was like 20220531_091625, but now it is 20220531T091625.

I also introduced a new face, in case someone wants to style the time
part separately.
This commit is contained in:
Protesilaos Stavrou 2022-06-10 07:46:52 +03:00
parent 9f192263db
commit db9584f51d
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
3 changed files with 18 additions and 12 deletions

View file

@ -86,10 +86,10 @@ Every note produced by Denote follows this pattern:
: DATE--KEYWORDS--TITLE.org
The =DATE= field represents the date in year-month-day format followed
by an underscore and the current time in hour-minute-second notation.
The presentation is compact, with an underscore separating the two
components. Like this: =20220531_091625=. The =DATE= serves as the
unique identifier of each note.
by the capital letter =T= (for "time") and the current time in
hour-minute-second notation. The presentation is compact:
=20220531T091625=. The =DATE= serves as the unique identifier of each
note.
The =KEYWORDS= field consists of one or more entries demarcated by a
plus sign (the separator is inserted automatically). Each keyword is a
@ -106,9 +106,9 @@ string for the =TITLE= of the file name.
Examples:
: 20220107_124941--economics--plentiful-and-predictable-liquidity.org
: 20220214_104945--emacs+git--git-patch-formatting.org
: 20220420_113805--three_word_keyword--this-is-a-test.org
: 20220107T124941--economics--plentiful-and-predictable-liquidity.org
: 20220214T104945--emacs+git--git-patch-formatting.org
: 20220420T113805--three_word_keyword--this-is-a-test.org
While files end in the =.org= extension, the Denote code base does not
actually depend on org.el and/or its accoutrements.

View file

@ -117,6 +117,11 @@ renaming attachments that the user adds to their notes."
"Face for file name date in `dired-mode' buffers."
:group 'denote-dired)
(defface denote-dired-dired-field-time
'((t :inherit denote-dired-dired-field-date))
"Face for file name time in `dired-mode' buffers."
:group 'denote-dired)
(defface denote-dired-dired-field-keywords
'((default :inherit bold)
(((class color) (min-colors 88) (background light))
@ -139,9 +144,10 @@ renaming attachments that the user adds to their notes."
(defconst denote-dired-font-lock-keywords
`((,denote--file-regexp
(1 'denote-dired-dired-field-date)
(2 'denote-dired-dired-field-delimiter)
(3 'denote-dired-dired-field-keywords)
(4 'denote-dired-dired-field-delimiter)))
(2 'denote-dired-dired-field-time)
(3 'denote-dired-dired-field-delimiter)
(4 'denote-dired-dired-field-keywords)
(5 'denote-dired-dired-field-delimiter)))
"Keywords for fontification.")
;;;###autoload

View file

@ -105,10 +105,10 @@ specifiers."
;;;; Main variables
(defconst denote--id "%Y%m%d_%H%M%S"
(defconst denote--id "%Y%m%dT%H%M%S"
"Format of ID prefix of a note's filename.")
(defconst denote--id-regexp "\\([0-9_]+\\{15\\}\\)"
(defconst denote--id-regexp "\\([0-9]\\{8\\}\\)\\(T[0-9]\\{6\\}\\)"
"Regular expression to match `denote--id'.")
(defconst denote--keyword-regexp "\\(--\\)\\([0-9A-Za-z_+]*\\)\\(--\\)"