branch: externals/denote
commit 123fb2b67088e98f675373b5d02b75f4d4a36f79
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Put all faces in denote-faces.el
This will help us decouple the backlinks' buffer from denote-dired-mode.
---
denote-dired.el | 61 +++++++-------------------------------
denote-faces.el | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+), 51 deletions(-)
diff --git a/denote-dired.el b/denote-dired.el
index 54a83c0805..b607e3d02a 100644
--- a/denote-dired.el
+++ b/denote-dired.el
@@ -354,60 +354,19 @@ appropriate."
;;;; Extra fontification
-(defface denote-dired-field-date
- '((((class color) (min-colors 88) (background light))
- :foreground "#00538b")
- (((class color) (min-colors 88) (background dark))
- :foreground "#00d3d0")
- (t :inherit font-lock-variable-name-face))
- "Face for file name date in `dired-mode' buffers."
- :group 'denote-dired)
-
-(defface denote-dired-field-time
- '((t :inherit denote-dired-field-date))
- "Face for file name time in `dired-mode' buffers."
- :group 'denote-dired)
-
-(defface denote-dired-field-title
- '((t ))
- "Face for file name title in `dired-mode' buffers."
- :group 'denote-dired)
-
-(defface denote-dired-field-extension
- '((t :inherit shadow))
- "Face for file extension type in `dired-mode' buffers."
- :group 'denote-dired)
-
-(defface denote-dired-field-keywords
- '((default :inherit bold)
- (((class color) (min-colors 88) (background light))
- :foreground "#8f0075")
- (((class color) (min-colors 88) (background dark))
- :foreground "#f78fe7")
- (t :inherit font-lock-builtin-face))
- "Face for file name keywords in `dired-mode' buffers."
- :group 'denote-dired)
-
-(defface denote-dired-field-delimiter
- '((((class color) (min-colors 88) (background light))
- :foreground "gray70")
- (((class color) (min-colors 88) (background dark))
- :foreground "gray30")
- (t :inherit shadow))
- "Face for file name delimiters in `dired-mode' buffers."
- :group 'denote-dired)
+(require 'denote-faces)
(defconst denote-dired-font-lock-keywords
- `((,(concat "\\(?:.*/\\)?" denote--file-regexp)
- (1 'denote-dired-field-date)
- (2 'denote-dired-field-time)
- (3 'denote-dired-field-delimiter)
- (4 'denote-dired-field-title)
- (5 'denote-dired-field-delimiter)
- (6 'denote-dired-field-keywords)
- (7 'denote-dired-field-extension))
+ `((,denote--file-regexp
+ (1 'denote-faces-date)
+ (2 'denote-faces-time)
+ (3 'denote-faces-delimiter)
+ (4 'denote-faces-title)
+ (5 'denote-faces-delimiter)
+ (6 'denote-faces-keywords)
+ (7 'denote-faces-extension))
("_"
- (0 'denote-dired-field-delimiter t)))
+ (0 'denote-faces-delimiter t)))
"Keywords for fontification.")
;;;###autoload
diff --git a/denote-faces.el b/denote-faces.el
new file mode 100644
index 0000000000..2a5e32f1d4
--- /dev/null
+++ b/denote-faces.el
@@ -0,0 +1,92 @@
+;;; denote-faces.el --- Faces and fontification rules for Denote -*-
lexical-binding: t -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Protesilaos Stavrou <[email protected]>
+;; Maintainer: Denote Development <~protesilaos/[email protected]>
+;; URL: https://git.sr.ht/~protesilaos/denote
+;; Version: 0.1.0
+;; Package-Requires: ((emacs "27.2"))
+
+;; This file is NOT part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; Used internally by Denote to fontify file names in Dired, the
+;; backlinks' buffer, and related.
+
+;;; Code:
+
+(defgroup denote-faces ()
+ "Faces for Denote."
+ :group 'denote)
+
+(defface denote-faces-subdirectory
+ '((t :inherit bold))
+ "Face for subdirectory of file name.
+This should only ever needed in the backlinks' buffer (or
+equivalent), not in Dired."
+ :group 'denote-faces)
+
+(defface denote-faces-date
+ '((((class color) (min-colors 88) (background light))
+ :foreground "#00538b")
+ (((class color) (min-colors 88) (background dark))
+ :foreground "#00d3d0")
+ (t :inherit font-lock-variable-name-face))
+ "Face for file name date in Dired buffers.
+This is the part of the identifier that covers the year, month,
+and day."
+ :group 'denote-faces)
+
+(defface denote-faces-time
+ '((t :inherit denote-faces-date))
+ "Face for file name time in Dired buffers.
+This is the part of the identifier that covers the hours, minutes,
+and seconds."
+ :group 'denote-faces)
+
+(defface denote-faces-title
+ '((t ))
+ "Face for file name title in Dired buffers."
+ :group 'denote-faces)
+
+(defface denote-faces-extension
+ '((t :inherit shadow))
+ "Face for file extension type in Dired buffers."
+ :group 'denote-faces)
+
+(defface denote-faces-keywords
+ '((default :inherit bold)
+ (((class color) (min-colors 88) (background light))
+ :foreground "#8f0075")
+ (((class color) (min-colors 88) (background dark))
+ :foreground "#f78fe7")
+ (t :inherit font-lock-builtin-face))
+ "Face for file name keywords in Dired buffers."
+ :group 'denote-faces)
+
+(defface denote-faces-delimiter
+ '((((class color) (min-colors 88) (background light))
+ :foreground "gray70")
+ (((class color) (min-colors 88) (background dark))
+ :foreground "gray30")
+ (t :inherit shadow))
+ "Face for file name delimiters in Dired buffers."
+ :group 'denote-faces)
+
+(provide 'denote-faces)
+;;; denote-faces.el ends here