[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 91192f5 10/24: Add patterns for character properties
From: |
Michael Heerdegen |
Subject: |
[elpa] master 91192f5 10/24: Add patterns for character properties |
Date: |
Thu, 19 May 2016 20:46:37 +0000 (UTC) |
branch: master
commit 91192f5895f2e4d1ff8eec6faeab40099867ac89
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
Add patterns for character properties
---
packages/el-search/el-search.el | 50 +++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index db57a5e..a15a2d4 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -803,6 +803,56 @@ could use this pattern:
lpats)
,@(if match-end '() '(_)))))
+(el-search-defpattern char-prop (property)
+ "Matches the object if completely covered with PROPERTY.
+This pattern matches the object if its representation in the
+search buffer is completely covered with the character property
+PROPERTY.
+
+This pattern always tests the complete expression in the search
+buffer, it is not possible to test subexpressions calculated in
+the search pattern."
+ `(guard (and (get-char-property (point) ',property)
+ ,(macroexp-let2 nil limit '(scan-sexps (point) 1)
+ `(= (next-single-char-property-change
+ (point) ',property nil ,limit)
+ ,limit)))))
+
+(el-search-defpattern includes-prop (property)
+ "Matches the object if partly covered with PROPERTY.
+This pattern matches the object if its representation in the
+search buffer is partly covered with the character property
+PROPERTY.
+
+This pattern always tests the complete expression in the search
+buffer, it is not possible to test subexpressions calculated in
+the search pattern."
+ `(guard (or (get-char-property (point) ',property)
+ ,(macroexp-let2 nil limit '(scan-sexps (point) 1)
+ `(not (= (next-single-char-property-change
+ (point) ',property nil ,limit)
+ ,limit))))))
+
+(el-search-defpattern change ()
+ "Matches the object if it is part of a change.
+This is equivalent to (char-prop diff-hl-hunk).
+
+You need `diff-hl-mode' turned on, provided by the library
+\"diff-hl\" available in Gnu Elpa."
+ (or (bound-and-true-p diff-hl-mode)
+ (error "diff-hl-mode not enabled"))
+ '(char-prop diff-hl-hunk))
+
+(el-search-defpattern changed ()
+ "Matches the object if it contains a change.
+This is equivalent to (includes-prop diff-hl-hunk).
+
+You need `diff-hl-mode' turned on, provided by the library
+\"diff-hl\" available in Gnu Elpa."
+ (or (bound-and-true-p diff-hl-mode)
+ (error "diff-hl-mode not enabled"))
+ '(includes-prop diff-hl-hunk))
+
;;;; Highlighting
- [elpa] master updated (24ce066 -> c835174), Michael Heerdegen, 2016/05/19
- [elpa] master f9980f6 05/24: Replacing: make C-g an alternative key for quitting, Michael Heerdegen, 2016/05/19
- [elpa] master f178717 12/24: Clarify the operation scope of replacing, Michael Heerdegen, 2016/05/19
- [elpa] master 91192f5 10/24: Add patterns for character properties,
Michael Heerdegen <=
- [elpa] master 246e1ff 17/24: Small fix in el-search--setup-minibuffer, Michael Heerdegen, 2016/05/19
- [elpa] master 098582b 20/24: Reduce duration of a `sit-for', Michael Heerdegen, 2016/05/19
- [elpa] master 01e5bcd 22/24: Clean up el-search-read-expression-map; add some doc, Michael Heerdegen, 2016/05/19
- [elpa] master 0b9fe9c 23/24: Set initial input for replace when coming from el-search-pattern, Michael Heerdegen, 2016/05/19
- [elpa] master c0d9ca7 14/24: Make el-search-pattern accept an optional NO-ERROR arg, Michael Heerdegen, 2016/05/19
- [elpa] master 41fc28b 01/24: New user option: el-search-use-sloppy-strings, Michael Heerdegen, 2016/05/19
- [elpa] master 149acb9 07/24: Improve documentation and argument names of el-search-query-replace, Michael Heerdegen, 2016/05/19
- [elpa] master 3d0a12e 13/24: Fix el-search--ensure-sexp-start error at bob, Michael Heerdegen, 2016/05/19
- [elpa] master 03dd4e7 06/24: Comment and whitespace changes only, Michael Heerdegen, 2016/05/19
- [elpa] master b885ef1 03/24: el-search--check-pattern-args: make arg TYPE a string, Michael Heerdegen, 2016/05/19