all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: emacs-devel@gnu.org
Subject: Looking at function
Date: Tue, 28 Jun 2022 21:01:27 +0300	[thread overview]
Message-ID: <86edz8k6q1.fsf@mail.linkov.net> (raw)

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?



             reply	other threads:[~2022-06-28 18:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 18:01 Juri Linkov [this message]
2022-06-28 19:22 ` Looking at function 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86edz8k6q1.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.