unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Looking at function
@ 2022-06-28 18:01 Juri Linkov
  2022-06-28 19:22 ` Stefan Monnier
  2022-07-11  1:26 ` Dmitry Gutov
  0 siblings, 2 replies; 11+ messages in thread
From: Juri Linkov @ 2022-06-28 18:01 UTC (permalink / raw)
  To: emacs-devel

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?



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-08-21 16:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-28 18:01 Looking at function Juri Linkov
2022-06-28 19:22 ` Stefan Monnier
2022-07-01 15:49   ` Juri Linkov
2022-07-11  1:26 ` Dmitry Gutov
2022-07-11 19:14   ` Juri Linkov
2022-07-12  0:19     ` Dmitry Gutov
2022-07-12  0:29       ` Stefan Monnier
2022-08-17  0:23         ` Dmitry Gutov
2022-07-12  7:50       ` Juri Linkov
2022-08-17  0:27         ` Dmitry Gutov
2022-08-21 16:09           ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).