all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* search-backward returning matches which end after point
@ 2024-08-23 14:18 Spencer Baugh
  2024-08-24 15:20 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-08-26 18:27 ` Andreas Röhler
  0 siblings, 2 replies; 8+ messages in thread
From: Spencer Baugh @ 2024-08-23 14:18 UTC (permalink / raw)
  To: help-gnu-emacs


search-backward (and re-search-backward, and looking-back) don't return
matches which end after point.  Is there a version which does?

For example,
(with-temp-buffer
  (insert "foo")
  (save-excursion (insert "bar"))
  (search-backward "foobar"))
 
fails to find the match.

Is there a function which will find this match?

Specifically, I noticed this when trying to use
easy-mmode-define-navigation to define navigation commands for a major
mode based on a regex.

The -prev commands defined by easy-mmode-define-navigation use
re-search-backward.  So if the point is inside the thing which the regex
matches, then thing-prev command will not go to the start of the thing.
But if point is after the thing, then thing-prev will go to the start of
the thing.  This is because of this behavior of search-backward.

I'd like to instead define movement commands which will always go to the
start of the thing when point is inside the thing.  But to do that for
an arbitrary regex/string, I need a version of search-backward which
will return matches which end after point.



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

end of thread, other threads:[~2024-08-29  1:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23 14:18 search-backward returning matches which end after point Spencer Baugh
2024-08-24 15:20 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-08-26 14:26   ` Spencer Baugh
2024-08-26 16:54     ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-08-28 13:45       ` Spencer Baugh via Users list for the GNU Emacs text editor
2024-08-29  1:24         ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-08-26 18:27 ` Andreas Röhler
2024-08-26 19:37   ` Stefan Monnier via Users list for the GNU Emacs text editor

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.