branch: externals/denote
commit 431124fea1598105fa251957f71f06dcbd92ffff
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Generalise dired fontification
There is no need to limit it to the denote-directory. We ultimately
want to fontify all Denote-style file names, not just the notes created
by Denote.
For example, I have been recording all my longer-term storage using such
a naming scheme: this mode gives me the extra faces for .pdf, .mp3, and
other files.
Users of Denote may want this for attachments.
The upside of having this as a buffer-local mode is that the user can
write a wrapper function that applies the mode only in a given
directory (like we were doing before).
Thanks to Ypot for suggesting a kernel of this idea in issue 1 over at
the GitHub mirror: <https://github.com/protesilaos/denote/issues/1>.
---
README.org | 2 +-
denote-dired.el | 12 ++++--------
denote.el | 2 +-
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/README.org b/README.org
index 265804d15b..fc37453f41 100644
--- a/README.org
+++ b/README.org
@@ -370,7 +370,7 @@ Denote is meant to be a collective effort. Every bit of
help matters.
+ Author/maintainer :: Protesilaos Stavrou.
-+ Ideas and/or user feedback :: Kaushal Modi.
++ Ideas and/or user feedback :: Kaushal Modi, Ypot.
* GNU Free Documentation License
:PROPERTIES:
diff --git a/denote-dired.el b/denote-dired.el
index 3c5ca05b97..8628f5a1d2 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -88,18 +88,14 @@
(defun denote-dired--setup (&optional reverse)
"Setup `denote-dired--fontify' local hook.
If optional REVERSE is non-nil, remove the hook."
- (cond
- (reverse
- (setq dired-font-lock-keywords denote-dired-original-keywords))
- ((or (string-match-p (denote--directory) default-directory)
- (string-match-p (abbreviate-file-name denote-directory)
default-directory)
- (string-match-p denote-directory default-directory))
- (denote-dired--fontify)))
+ (if reverse
+ (setq dired-font-lock-keywords denote-dired-original-keywords)
+ (denote-dired--fontify))
(font-lock-refresh-defaults))
;;;###autoload
(define-minor-mode denote-dired-mode
- "Integrate denote with Dired."
+ "Fontify all Denote-style file names in Dired."
:global nil
:group 'denote-dired
(if denote-dired-mode
diff --git a/denote.el b/denote.el
index 83da40ce76..ab2ad8add8 100644
--- a/denote.el
+++ b/denote.el
@@ -112,7 +112,7 @@ specifiers."
"Regular expression to match `denote-keywords'.")
(defconst denote--file-regexp
- (concat denote--id-regexp denote--keyword-regexp "\\(.*\\)\\.org")
+ (concat denote--id-regexp denote--keyword-regexp "\\(.*\\)\\..*")
"Regular expression to match file names from `denote-new-note'.")
(defconst denote--punctuation-regexp "[][{}!@#$%^&*()_=+'\"?,.\|;:~`‘’“”]*"