[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/el-search b4e79fb 081/332: Add patterns for character p
From: |
Stefan Monnier |
Subject: |
[elpa] externals/el-search b4e79fb 081/332: Add patterns for character properties |
Date: |
Tue, 1 Dec 2020 15:48:16 -0500 (EST) |
branch: externals/el-search
commit b4e79fb11501bff131e43adda9b18314ee660ff9
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>
Add patterns for character properties
---
el-search.el | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/el-search.el b/el-search.el
index db57a5e..a15a2d4 100644
--- a/el-search.el
+++ b/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] externals/el-search 2c1cdeb 066/332: factor out minibuffer setup hook fun; treat empty input, (continued)
- [elpa] externals/el-search 2c1cdeb 066/332: factor out minibuffer setup hook fun; treat empty input, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 02168e0 068/332: Tweak docstring of el-search--ensure-sexp-start, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search d6ae854 070/332: Minor change in `string' pattern, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search a0b44dd 078/332: Improve documentation and argument names of el-search-query-replace, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 1864f4a 077/332: Comment and whitespace changes only, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search b5b6d83 089/332: Make query-replace accept FROM -> TO style input, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 68f10d7 091/332: Reduce duration of a `sit-for', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 29d6f46 090/332: Rename a local variable, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 5b608a1 094/332: Set initial input for replace when coming from el-search-pattern, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 9c3c04d 093/332: Clean up el-search-read-expression-map; add some doc, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search b4e79fb 081/332: Add patterns for character properties,
Stefan Monnier <=
- [elpa] externals/el-search 2dd24a9 096/332: Factor out `el-search--replace-hunk', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 852643e 100/332: Fix some quoting problems in doc strings, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 2366cda 107/332: Improve `change' and `changed', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 31b9e9d 122/332: Inhibit logging of some messages, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 35a0776 119/332: Add missing settings of some vars when restoring a previous search, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search c086990 129/332: Extend the heuristic matching approach; complete review, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 57ecb9a 128/332: Fix leaving behind helper buffers, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 10e596b 113/332: Add `el-search--macroexpand', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 70477a2 150/332: Explicitly require pcase, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 4b8780f 026/332: allow search wrapping, Stefan Monnier, 2020/12/01