GNU bug report logs -
#14013
24.3.50; dired-isearch-filenames-regexp is matching text outside filenames
Previous Next
Reported by: michael_heerdegen <at> web.de
Date: Wed, 20 Mar 2013 23:42:01 UTC
Severity: normal
Tags: patch
Merged with 29215
Found in versions 24.3.50, 26.0
Fixed in version 29.0.50
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
>> This works surprisingly well. Maybe there are more corner cases,
>> but something already works with quick tests:
>>
>> diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
>
> Yes, not bad indeed. Did you find any corner cases?
Using a temporary buffer like you proposed works fine,
and handles all possible regexps including corner cases.
However, wouldn't this make the search too inefficient?
[isearch-search-fun-in-text-property.patch (text/x-diff, inline)]
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5fbfb724a3..8470170f24 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -4482,12 +4545,25 @@ isearch-search-fun-in-text-property
(setq end (if isearch-forward
(next-single-property-change beg property)
(previous-single-property-change beg property)))
- (setq found (funcall (or search-fun (isearch-search-fun-default))
- string (if bound (if isearch-forward
- (min bound end)
- (max bound end))
- end)
- noerror count))
+ (if (and isearch-regexp (string-match-p "\\(\\^\\)\\|\\$" string))
+ (let ((substring (buffer-substring beg end))
+ match-data)
+ (with-temp-buffer
+ (insert substring)
+ (goto-char (point-min))
+ (setq found (funcall (or search-fun (isearch-search-fun-default))
+ string (if bound (- bound beg) (1+ (- end beg)))
+ noerror count))
+ (when found
+ (setq found (+ found beg)
+ match-data (mapcar (lambda (m) (1- (+ m beg))) (match-data)))))
+ (when match-data (set-match-data match-data)))
+ (setq found (funcall (or search-fun (isearch-search-fun-default))
+ 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)
This bug report was last modified 1 year and 352 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.