[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Looking at function
From: |
Juri Linkov |
Subject: |
Looking at function |
Date: |
Tue, 28 Jun 2022 21:01:27 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
Any use of the function ‘looking-at’ is incompatible with a non-default value
of ‘isearch-search-fun-function’. So there are following problematic uses
of ‘looking-at’:
1. There is 1 call in isearch.el in ‘isearch-search-and-update’:
(looking-at (cond
((functionp isearch-regexp-function)
(funcall isearch-regexp-function
isearch-string t))
(isearch-regexp-function (word-search-regexp
isearch-string t))
(isearch-regexp isearch-string)
(t (regexp-quote isearch-string))))
It doesn't call a non-default search function when using a key sequence like
‘C-M-r ^’ on rectangular regions — it matches outside of regions
when the search function restricts the search within the region bounds.
2. In replace.el ‘looking-at/back’ are used only in ‘perform-replace’
to check if the next match is adjacent. This causes problems during
rectangular replacements to find matches based on a non-default
search function.
These possible solutions were proposed in bug#54733:
1. Replace ‘looking-at’ with a call to the search function,
but keep it at point by prepending ‘\\=’ to the regexp.
Can it break a complex regexp?
2. Call the search function as above but afterwards check if
(match-beginning 0) is equal to the original position.
Less efficient.
3. Use looking-at only when the search function is default.
4. Add a new variable ‘looking-at-function’.
It could be like ‘isearch-search-fun-function’, so redefining
the search function will also require redefining the
looking-at function with similar code that doesn't move point.
Any better ideas how to replace looking-at with something
that uses a search function?
- Looking at function,
Juri Linkov <=