summaryrefslogtreecommitdiff
path: root/lisp/dired-aux.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-06-10 19:43:31 +0300
committerJuri Linkov <juri@linkov.net>2022-06-10 19:43:31 +0300
commit3247c31d672e5fed83435150ba62006acaddcf84 (patch)
tree8fe7376e3ce838b821e4e84cb387612b59816e35 /lisp/dired-aux.el
parent4c31fd166851ebd27a28743c613a4b1833cf2a46 (diff)
downloademacs-3247c31d672e5fed83435150ba62006acaddcf84.tar.gz
emacs-3247c31d672e5fed83435150ba62006acaddcf84.tar.bz2
emacs-3247c31d672e5fed83435150ba62006acaddcf84.zip
New function isearch-search-fun-in-text-property (bug#14013).
* lisp/dired-aux.el (dired-isearch-search-filenames): Move most of the body to the new function isearch-search-fun-in-text-property. * lisp/isearch.el (isearch-search-fun-in-text-property): New function refactored from dired-isearch-search-filenames.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r--lisp/dired-aux.el36
1 files changed, 1 insertions, 35 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 4faf9431aa3..d16aee0fa86 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -3208,41 +3208,7 @@ Intended to be added to `isearch-mode-hook'."
The returned function narrows the search to match the search string
only as part of a file name enclosed by the text property `dired-filename'.
It's intended to override the default search function."
- (let ((search-fun (funcall orig-fun))
- (property 'dired-filename))
- (lambda (string &optional bound noerror count)
- (let* ((old (point))
- ;; Check if point is already on the property.
- (beg (when (get-text-property
- (if isearch-forward old (max (1- old) (point-min)))
- property)
- old))
- end found)
- ;; Otherwise, try to search for the next property.
- (unless beg
- (setq beg (if isearch-forward
- (next-single-property-change old property)
- (previous-single-property-change old property)))
- (when beg (goto-char beg)))
- ;; Non-nil `beg' means there are more properties.
- (while (and beg (not found))
- ;; Search for the end of the current property.
- (setq end (if isearch-forward
- (next-single-property-change beg property)
- (previous-single-property-change beg property)))
- (setq found (funcall
- search-fun string (if bound (if isearch-forward
- (min bound end)
- (max bound end))
- end)
- noerror count))
- (unless found
- (setq beg (if isearch-forward
- (next-single-property-change end property)
- (previous-single-property-change end property)))
- (when beg (goto-char beg))))
- (unless found (goto-char old))
- found))))
+ (isearch-search-fun-in-text-property 'dired-filename (funcall orig-fun)))
;;;###autoload
(defun dired-isearch-filenames ()