[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 3f51ba3b79 03/14: Rework denote--only-note-p
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 3f51ba3b79 03/14: Rework denote--only-note-p |
Date: |
Sat, 9 Jul 2022 02:57:36 -0400 (EDT) |
branch: externals/denote
commit 3f51ba3b79fbadaa5f1193e4a534511ef7f99cdf
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Rework denote--only-note-p
A file is a Denote note if it starts with an id and ends with a
supported extension.
---
denote.el | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/denote.el b/denote.el
index f971fb4e6a..dd9e484469 100644
--- a/denote.el
+++ b/denote.el
@@ -242,6 +242,9 @@ are described in the doc string of `format-time-string'."
(defconst denote--keywords-regexp "__\\([0-9A-Za-z_-]*\\)"
"Regular expression to match keywords.")
+(defconst denote--extension-regexp "\\.\\(org\\|md\\|txt\\)"
+ "Regular expression to match supported Denote extensions.")
+
(defconst denote--file-title-regexp
(concat denote--id-regexp "\\(--\\)\\(.*\\)\\(__\\)")
"Regular expression to match file names from `denote'.")
@@ -250,10 +253,6 @@ are described in the doc string of `format-time-string'."
(concat denote--file-title-regexp "\\([0-9A-Za-z_-]*\\)\\(\\.?.*\\)")
"Regular expression to match the entire file name'.")
-(defconst denote--file-only-note-regexp
- (concat denote--file-regexp "\\.\\(org\\|md\\|txt\\)")
- "Regular expression to match the entire file name of a note file.")
-
(defconst denote--punctuation-regexp "[][{}!@#$%^&*()_=+'\"?,.\|;:~`‘’“”/]*"
"Regular expression of punctionation that should be removed.
We consider those characters illigal for our purposes.")
@@ -321,10 +320,13 @@ trailing hyphen."
(defun denote--only-note-p (file)
"Make sure FILE is an actual Denote note.
FILE is relative to the variable `denote-directory'."
- (and (not (file-directory-p file))
- (file-regular-p file)
- (string-match-p denote--file-only-note-regexp file)
- (not (string-match-p "[#~]\\'" file))))
+ (let ((file-name (file-name-nondirectory file)))
+ (and (not (file-directory-p file))
+ (file-regular-p file)
+ (string-match-p (concat "\\`" denote--id-regexp
+ ".*" denote--extension-regexp "\\'")
+ file-name)
+ (not (string-match-p "[#~]\\'" file)))))
(defun denote--file-name-relative-to-denote-directory (file)
"Return file name of FILE relative to the variable `denote-directory'.
- [elpa] externals/denote updated (1075cbb65f -> 39d85280ee), ELPA Syncer, 2022/07/09
- [elpa] externals/denote 564c139c78 04/14: Rework denote-faces-file-name-keywords, ELPA Syncer, 2022/07/09
- [elpa] externals/denote bde1e0f36e 07/14: Fontify all file type extensions, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 29a5a2d966 09/14: Remove face override from keywords separator, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 9dbfd371ff 02/14: Refactor of denote--inferred-keywords, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 627df2e311 06/14: Remove dev notice about performance, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 5abcd2fe87 08/14: Remove needless face override from delimiter, ELPA Syncer, 2022/07/09
- [elpa] externals/denote f1e08702e5 11/14: Make fontification more robust (revise f13fdd4), ELPA Syncer, 2022/07/09
- [elpa] externals/denote 39d85280ee 14/14: Define obsolete alias of fontification var, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 916344321a 01/14: Support permutations of file names, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 3f51ba3b79 03/14: Rework denote--only-note-p,
ELPA Syncer <=
- [elpa] externals/denote ab18e32e1b 05/14: Merge pull request #38 from jeanphilippegg/file-name-permutations, ELPA Syncer, 2022/07/09
- [elpa] externals/denote f13fdd439c 10/14: Fix false positives in fontification regexp, ELPA Syncer, 2022/07/09
- [elpa] externals/denote 3f2e0788a9 12/14: Adjust fontification, ELPA Syncer, 2022/07/09
- [elpa] externals/denote e7de7baaa4 13/14: Merge pull request #40 from jeanphilippegg/file-name-permutations, ELPA Syncer, 2022/07/09