summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-08-27 22:43:40 +0300
committerJuri Linkov <juri@linkov.net>2022-08-27 22:43:40 +0300
commit0ab49d46ddbe27970c62a56597de000bc1c3232c (patch)
tree460023d68311d8685bff8c426faea5f75eb5e3e0 /lisp/isearch.el
parentf427b985a1857523412a846fcaa9082c87c0bbd1 (diff)
downloademacs-0ab49d46ddbe27970c62a56597de000bc1c3232c.tar.gz
Use a list of text properties to search in symlink filenames in Wdired
* lisp/dired-aux.el (dired-isearch-search-filenames): Use text properties 'dired-filename' and 'dired-symlink-filename'. * lisp/dired.el (dired-font-lock-keywords): Add text property 'dired-symlink-filename' on symlinks. * lisp/isearch.el (isearch-search-fun-in-text-property): Support a list of text properties (bug#57293).
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el32
1 files changed, 23 insertions, 9 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 31fcf01949f..9f1fbb14a4a 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -4512,21 +4512,35 @@ is a list of cons cells of the form (START . END)."
(setq bounds (cdr bounds))))
found))))
-(defun isearch-search-fun-in-text-property (search-fun property)
- "Return the function to search inside text that has the specified PROPERTY.
+(defun isearch-search-fun-in-text-property (search-fun properties)
+ "Return the function to search inside text that has the specified PROPERTIES.
The function will limit the search for matches only inside text which has
-this property in the current buffer.
+at least one of the text PROPERTIES.
The argument SEARCH-FUN provides the function to search text, and
defaults to the value of `isearch-search-fun-default' when nil."
+ (setq properties (ensure-list properties))
(apply-partially
#'search-within-boundaries
search-fun
- (lambda (pos) (get-text-property (if isearch-forward pos
- (max (1- pos) (point-min)))
- property))
- (lambda (pos) (if isearch-forward
- (next-single-property-change pos property)
- (previous-single-property-change pos property)))))
+ (lambda (pos)
+ (let ((pos (if isearch-forward pos (max (1- pos) (point-min)))))
+ (seq-some (lambda (property)
+ (get-text-property pos property))
+ properties)))
+ (lambda (pos)
+ (let ((pos-list (if isearch-forward
+ (mapcar (lambda (property)
+ (next-single-property-change
+ pos property))
+ properties)
+ (mapcar (lambda (property)
+ (previous-single-property-change
+ pos property))
+ properties))))
+ (setq pos-list (delq nil pos-list))
+ (when pos-list (if isearch-forward
+ (seq-min pos-list)
+ (seq-max pos-list)))))))
(defun search-within-boundaries ( search-fun get-fun next-fun
string &optional bound noerror count)