[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote e1bd4c9cb8 094/355: BREAKING Put keywords after
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote e1bd4c9cb8 094/355: BREAKING Put keywords after the title |
Date: |
Sun, 26 Jun 2022 23:58:03 -0400 (EDT) |
branch: externals/denote
commit e1bd4c9cb8100dd2d556a439174a0c0471584c9a
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
BREAKING Put keywords after the title
Putting the tags/keywords at the end of the file has several advantages:
1. It is consistent with how such interfaces are designed, such as with
the 'elfeed', 'notmuch', and 'mu4e' Emacs packages.
2. It makes it easier to read the title of the file even if it is
truncated.
3. Makes fontification look better, as the more intensely coloured
keywords are further apart from the date/identifier which is also
colourful.
One way to update existing file names in Dired:
* Switch to wdired (C-x C-q by default)
* M-x isearch-forward-regexp (bound to C-M-s by default)
* Search for (without the quotes) '--\(.*?\)--\(.*?\)\.org'
* While in isearch, type M-%
* For the replacement use (without the quotes) '--\2--\1.org'
* Verify the conversion as you go through the query-replace.
A similar series of steps can be followed for file contents (e.g. by
making the grep buffer editable with the wgrep package).
---
README.org | 18 +++++++++---------
denote-dired.el | 18 +++++++++++++++---
denote.el | 14 +++++++-------
3 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/README.org b/README.org
index 4f7a73b395..ee6c2eb000 100644
--- a/README.org
+++ b/README.org
@@ -83,7 +83,7 @@ the creation of such files.
Every note produced by Denote follows this pattern:
-: DATE--KEYWORDS--TITLE.org
+: DATE--TITLE--KEYWORDS.org
The =DATE= field represents the date in year-month-day format followed
by the capital letter =T= (for "time") and the current time in
@@ -91,6 +91,11 @@ hour-minute-second notation. The presentation is compact:
=20220531T091625=. The =DATE= serves as the unique identifier of each
note.
+The =TITLE= field is the title of the note, as provided by the user,
+that automatically gets downcased and hyphenated. An entry about
+"Economics in the Euro Area" produces an =economics-in-the-euro-area=
+string for the =TITLE= of the file name.
+
The =KEYWORDS= field consists of one or more entries demarcated by a
plus sign (the separator is inserted automatically). Each keyword is a
string provided by the user at the relevant prompt which broadly
@@ -99,16 +104,11 @@ one-word-long must be written with an underscore. So when
=emacs_library= appears in a file name, it is interpreted as a single
keyword, whereas =emacs+library= are two distinct keywords.
-The =TITLE= field is the title of the note, as provided by the user,
-that automatically gets downcased and hyphenated. An entry about
-"Economics in the Euro Area" produces an =economics-in-the-euro-area=
-string for the =TITLE= of the file name.
-
Examples:
-: 20220107T124941--economics--plentiful-and-predictable-liquidity.org
-: 20220214T104945--emacs+git--git-patch-formatting.org
-: 20220420T113805--three_word_keyword--this-is-a-test.org
+: 20220107T124941--plentiful-and-predictable-liquidity--economics.org
+: 20220214T104945--git-patch-formatting--emacs+git.org
+: 20220420T113805--this-is-a-test--three_word_keyword.org
While files end in the =.org= extension, the Denote code base does not
actually depend on org.el and/or its accoutrements.
diff --git a/denote-dired.el b/denote-dired.el
index c467bac47b..f69a2878e2 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -122,6 +122,16 @@ renaming attachments that the user adds to their notes."
"Face for file name time in `dired-mode' buffers."
:group 'denote-dired)
+(defface denote-dired-dired-field-title
+ '((t ))
+ "Face for file name title in `dired-mode' buffers."
+ :group 'denote-dired)
+
+(defface denote-dired-dired-field-extension
+ '((t :inherit shadow))
+ "Face for file extension type in `dired-mode' buffers."
+ :group 'denote-dired)
+
(defface denote-dired-dired-field-keywords
'((default :inherit bold)
(((class color) (min-colors 88) (background light))
@@ -142,12 +152,14 @@ renaming attachments that the user adds to their notes."
:group 'denote-dired)
(defconst denote-dired-font-lock-keywords
- `((,denote--file-regexp
+ `((,denote--keyword-regexp
(1 'denote-dired-dired-field-date)
(2 'denote-dired-dired-field-time)
(3 'denote-dired-dired-field-delimiter)
- (4 'denote-dired-dired-field-keywords)
- (5 'denote-dired-dired-field-delimiter)))
+ (4 'denote-dired-dired-field-title)
+ (5 'denote-dired-dired-field-delimiter)
+ (6 'denote-dired-dired-field-keywords)
+ (7 'denote-dired-dired-field-extension)))
"Keywords for fontification.")
;;;###autoload
diff --git a/denote.el b/denote.el
index b27f5b526d..0bc0ae3cbc 100644
--- a/denote.el
+++ b/denote.el
@@ -111,13 +111,14 @@ specifiers."
(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_+]*\\)\\(--\\)"
- "Regular expression to match `denote-keywords'.")
-
(defconst denote--file-regexp
- (concat denote--id-regexp denote--keyword-regexp "\\(.*\\)\\.?.*")
+ (concat denote--id-regexp "\\(--\\)\\(.*\\)\\(--\\)")
"Regular expression to match file names from `denote-new-note'.")
+(defconst denote--keyword-regexp
+ (concat denote--file-regexp "\\([0-9A-Za-z_+]*\\)\\(\\.?.*\\)")
+ "Regular expression to match `denote-keywords'.")
+
(defconst denote--punctuation-regexp "[][{}!@#$%^&*()_=+'\"?,.\|;:~`‘’“”]*"
"Regular expression of punctionation that should be removed.")
@@ -206,8 +207,7 @@ With optional N, search in the Nth line from point."
"Produce list of keywords in `denote--directory-files'."
(delq nil (mapcar
(lambda (x)
- (denote--extract
- (concat denote--id-regexp denote--keyword-regexp) x 3))
+ (denote--extract denote--keyword-regexp x 6))
(denote--directory-files))))
(defun denote--inferred-keywords ()
@@ -286,7 +286,7 @@ is specified."
(denote--keywords-combine keywords)
keywords))
(ext (or extension ".org")))
- (format "%s%s--%s--%s%s" path id kws slug ext)))
+ (format "%s%s--%s--%s%s" path id slug kws ext)))
(defun denote--file-meta-header (title date keywords id)
"Front matter for new notes.
- [elpa] externals/denote d09b748c8d 063/355: Fix fontification; add denote-dired-directories, (continued)
- [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
- [elpa] externals/denote 3df88a05d0 096/355: Make linking aware of file types (extends 299b897), ELPA Syncer, 2022/06/26
- [elpa] externals/denote e1bd4c9cb8 094/355: BREAKING Put keywords after the title,
ELPA Syncer <=
- [elpa] externals/denote 7366004e91 106/355: Fix markdown-toml front matter format, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 5fd4e97dad 105/355: Add support for markdown-toml, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 1a8b57a9a8 104/355: Fix const in denote-file-type (extends 2bc5df6), ELPA Syncer, 2022/06/26
- [elpa] externals/denote c225201c49 124/355: Use appropriate name for internal variable, ELPA Syncer, 2022/06/26
- [elpa] externals/denote a70b4cd32d 114/355: Refine backlinks' heading per file type, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 7cba33e08e 119/355: LAST BREAKING CHANGE to file-naming scheme, ELPA Syncer, 2022/06/26
- [elpa] externals/denote c5a5748594 116/355: Abstract plain text front matter delimiter, ELPA Syncer, 2022/06/26
- [elpa] externals/denote e394057985 134/355: Document how to store multiple types of notes, ELPA Syncer, 2022/06/26
- [elpa] externals/denote d90695213c 151/355: Add minor clarifications in the manual, ELPA Syncer, 2022/06/26
- [elpa] externals/denote ce41b421ef 147/355: Update denote-retrieve symbols in denote-link, ELPA Syncer, 2022/06/26