[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 0185f38dde 046/355: Add denote-dired.el for usef
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 0185f38dde 046/355: Add denote-dired.el for useful fontification |
Date: |
Sun, 26 Jun 2022 23:57:59 -0400 (EDT) |
branch: externals/denote
commit 0185f38dde64c3e1bd3200093099a5b9d73e7c3e
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add denote-dired.el for useful fontification
---
denote-dired.el | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
diff --git a/denote-dired.el b/denote-dired.el
new file mode 100644
index 0000000000..12f82e2b17
--- /dev/null
+++ b/denote-dired.el
@@ -0,0 +1,110 @@
+;;; denote-dired.el --- Integration of denote with Dired -*- lexical-binding:
t -*-
+
+;; Copyright (C) 2022 Protesilaos Stavrou
+
+;; Author: Protesilaos Stavrou <info@protesilaos.com>
+;; URL: https://git.sr.ht/~protesilaos/denote
+;; Version: 0.1.0
+;; Package-Requires: ((emacs "27.1"))
+
+;; 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:
+;;
+;; Integration of denote with Dired. NOTE: does not work if
+;; diredfl-mode is enabled.
+;;
+;; Setup (only affects `denote-directory'):
+;;
+;; (add-hook 'dired-mode-hook #'denote-dired-mode)
+
+;;; Code:
+
+(require 'denote)
+
+(defgroup denote-dired ()
+ "Simple tool for plain text notes."
+ :group 'files)
+
+(defvar dired-font-lock-keywords)
+
+(defvar denote-dired-original-keywords dired-font-lock-keywords
+ "Original Dired fontification keywords.")
+
+(defface denote-dired-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-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-dired-field-delimiter
+ '((((class color) (min-colors 88) (background light))
+ :foreground "gray65")
+ (((class color) (min-colors 88) (background dark))
+ :foreground "gray35")
+ (t :inherit shadow))
+ "Face for file name delimiters in `dired-mode' buffers."
+ :group 'denote-dired)
+
+(defun denote-dired--fontify ()
+ "Append fontification rules to `dired-font-lock-keywords'."
+ (setq dired-font-lock-keywords
+ (append (list `(,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)))
+ dired-font-lock-keywords)))
+
+(defvar diredfl-mode)
+(declare-function diredfl-mode "diredfl")
+
+(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)))
+ (font-lock-refresh-defaults))
+
+;;;###autoload
+(define-minor-mode denote-dired-mode
+ "Integrate denote with Dired."
+ :global nil
+ :group 'denote-dired
+ (if denote-dired-mode
+ (denote-dired--setup)
+ (denote-dired--setup :reverse)))
+
+(provide 'denote-dired)
+;;; denote-dired.el ends here
- [elpa] externals/denote 9888c7087f 348/355: Add check mark to task of using id: links, (continued)
- [elpa] externals/denote 9888c7087f 348/355: Add check mark to task of using id: links, ELPA Syncer, 2022/06/26
- [elpa] externals/denote d56913b055 349/355: Clarify wording of FAQ entries, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 31e5eb3af8 346/355: Update documentation about links, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 019cccfb1f 015/355: Create denote-directory if absent, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 813004ea53 032/355: Make outline more consistent and informative, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 387ac0c030 033/355: Add denote--file-empty-p, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 9d8748c382 022/355: Add proof-of-concept backlink (lots of TODO), ELPA Syncer, 2022/06/26
- [elpa] externals/denote 991abe5b65 034/355: Use denote--file-empty-p, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 812da918f7 042/355: Insert comment about not editing backlinks, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 60a91fc6ef 044/355: Use correct notation for private variables, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 0185f38dde 046/355: Add denote-dired.el for useful fontification,
ELPA Syncer <=
- [elpa] externals/denote f4f1fa3c48 041/355: Declare variables with defconst, ELPA Syncer, 2022/06/26
- [elpa] externals/denote d0dbbab603 050/355: Update short descriptions, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 4d90cbb5da 054/355: Remove needless to-do, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 610c2f1670 055/355: Comment out inactive link to change log, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 3209bc23ef 059/355: Use "#+filetags" for wider Org compatibility, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 3ef51e9cd7 064/355: Update documentation about denote-dired-mode, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 52fd454153 069/355: Document denote-sort-keywords, ELPA Syncer, 2022/06/26
- [elpa] externals/denote 2eeedaf86a 075/355: Placate the compiler about 'denote-directory', ELPA Syncer, 2022/06/26
- [elpa] externals/denote eafc777268 076/355: Use 'denote-directory' function for '#+link', ELPA Syncer, 2022/06/26
- [elpa] externals/denote d08a72e19a 081/355: Re-indent line, ELPA Syncer, 2022/06/26