[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote ee22a7f380 038/355: Add helper function for line
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote ee22a7f380 038/355: Add helper function for line predicates |
Date: |
Sun, 26 Jun 2022 23:57:57 -0400 (EDT) |
branch: externals/denote
commit ee22a7f380a5e7c2763fb5db8e6f576015e8071c
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add helper function for line predicates
---
denote.el | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/denote.el b/denote.el
index 71ddc9486d..99059e7626 100644
--- a/denote.el
+++ b/denote.el
@@ -143,6 +143,29 @@ trailing hyphen."
"Return non-nil if FILE is empty."
(zerop (or (file-attribute-size (file-attributes file)) 0)))
+(defvar denote--line-regexp-alist
+ '((empty . "[\s\t]*$")
+ (indent . "^[\s\t]+")
+ (non-empty . "^.+$")
+ (list . "^\\([\s\t#*+]+\\|[0-9]+[^\s]?[).]+\\)")
+ (heading . "^\\*+ +")) ; assumes Org markup
+ "Alist of regexp types used by `denote-line-regexp-p'.")
+
+(defun denote--line-regexp-p (type &optional n)
+ "Test for TYPE on line.
+TYPE is the car of a cons cell in
+`denote--line-regexp-alist'. It matches a regular
+expression.
+
+With optional N, search in the Nth line from point."
+ (save-excursion
+ (goto-char (point-at-bol))
+ (and (not (bobp))
+ (or (beginning-of-line n) t)
+ (save-match-data
+ (looking-at
+ (alist-get type denote--line-regexp-alist))))))
+
;;;; Keywords
(defun denote--directory-files ()
- [elpa] externals/denote ee4aed6376 316/355: Refine check for denote dir in dired revert, (continued)
- [elpa] externals/denote ee4aed6376 316/355: Refine check for denote dir in dired revert, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 02d6f42ab4 320/355: Merge branch 'xref-instead-of-find', ELPA Syncer, 2022/06/27
- [elpa] externals/denote 6b7aa9db48 313/355: Reword a statement in the manual, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 0fdbbae03e 305/355: Expand FAQ entry on file-naming origin, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 102d1d2d1e 334/355: refactor!: Default Org front-matter to use org-id style ID property, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 25cc5a79e6 332/355: Require built-in xref to parse cross-references, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e4697c563f 342/355: Tweak denote.el Commentary section, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 62fc0308c0 345/355: Tweak sample configuration, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 8d8e96182b 351/355: Fix two typos, ELPA Syncer, 2022/06/27
- [elpa] externals/denote fcf4ea7f53 302/355: Tweak reference to listing files, ELPA Syncer, 2022/06/27
- [elpa] externals/denote ee22a7f380 038/355: Add helper function for line predicates,
ELPA Syncer <=
- [elpa] externals/denote e21db9418e 066/355: Tweak file regexp to read files with no extension, ELPA Syncer, 2022/06/27