branch: elpa/isl
commit 73150feb77d642980523bd18f9381addc0042130
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>
Don't limit search to symbol at point
---
isearch-light.el | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/isearch-light.el b/isearch-light.el
index 79f0f0bc2e5..524d4d8c993 100644
--- a/isearch-light.el
+++ b/isearch-light.el
@@ -312,20 +312,25 @@ Optional argument PATTERN default to `isl-pattern'."
(cons 'not (substring s 1))
(cons 'identity s))))
+(defun isl--point-at-eol ()
+ "The position of `end-of-visual-line'."
+ (save-excursion (end-of-visual-line) (point)))
+
(defun isl-multi-search-fwd (str &optional _bound _noerror)
- "Returns position of symbol matched by STR.
+ "Returns position of text matched by different parts of STR.
When arg STR contains spaces, it is converted in patterns with
-`isl-patterns' , when first pattern of list match a symbol
+`isl-patterns' , when first pattern of list match some text
subsequent patterns are used to check if all patterns match this
-symbol. The return value is a cons cell (beg . end) denoting
-symbol position."
+text. The return value is a cons cell (beg . end) denoting
+text position."
(let* ((pattern (isl-patterns str))
(initial (or (assq 'identity pattern)
'(identity . "")))
- (rest (cdr pattern)))
+ (rest (cdr pattern))
+ end)
(cl-loop while (re-search-forward (cdr initial) nil t)
for bounds = (if rest
- (bounds-of-thing-at-point 'symbol)
+ (cons (match-beginning 0) (isl--point-at-eol))
(cons (match-beginning 0) (match-end 0)))
if (or (not rest)
(cl-loop for (pred . re) in rest
@@ -334,7 +339,8 @@ symbol position."
(goto-char (car bounds))
(re-search-forward
re (cdr bounds) t)))))
- do (goto-char (cdr bounds)) and return bounds
+ do (goto-char (setq end (match-end 0)))
+ and return (cons (car bounds) end)
else do (goto-char (cdr bounds))
finally return nil)))