From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Andreas_R=C3=B6hler?= Newsgroups: gmane.emacs.help Subject: Re: search-backward returning matches which end after point Date: Mon, 26 Aug 2024 20:27:44 +0200 Message-ID: <3422f6c4-3774-4509-b8a9-8390e6261b6c@easy-emacs.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34250"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 26 20:28:33 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sieS8-0008nV-Um for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 26 Aug 2024 20:28:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sieRV-0004ow-H2; Mon, 26 Aug 2024 14:27:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sieRT-0004oS-Qn for help-gnu-emacs@gnu.org; Mon, 26 Aug 2024 14:27:51 -0400 Original-Received: from mout.kundenserver.de ([217.72.192.75]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sieRS-0007xo-2E for help-gnu-emacs@gnu.org; Mon, 26 Aug 2024 14:27:51 -0400 Original-Received: from [192.168.178.61] ([89.247.171.241]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N5n3t-1s3W952FWF-00voMw for ; Mon, 26 Aug 2024 20:27:44 +0200 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:iArD807je8LF26dn5uIPvUlK/k1ygFiPSudWiEdtl1h88sX0NxH WDDjTizskwNbgfu+/GXVr+hA/bxHBqRTnjjOY+CbTkxG/ETWj4xE/pwNRcetHoBqMqOPgdl cl8ist1fxYwePT6QgWGo2HAmAImWfXXdvDnAGbh+XdC4idabv9J3pxHwrN1DJSAOAc6VKlp V6Nkk2u/eiD3R/OODneHQ== UI-OutboundReport: notjunk:1;M01:P0:M4ZWuWfRu6Q=;+KJMtox++NQunrb4x2T3VOMHh+B ZBn2JDJKm9zheaPEndWuARWwNrzOIO4SVzZMwAIBbz3Nw17LlZeeBhWfrapPKdApLoPP85rXD TRL0+9Nj9Yql5v9QU6Bu7b2y9308rC5v46ua19J5NDN12N98ej4greDrPHevis8/C8gyTW9b7 FiUBW2EHh2qjw9aKUwNrYu+H4OY07nHK1rYqW4EJ2P2qAKGSz7//sKAxC5964TtPUKQ66SXDY JmKrUsD4rmjU+0nynhl119Nr7ZS1cwF2LP/mENNxeDesD6vQyOpOOvba1KGZ9JjInIyB0xZ4N 003T/BFjnQzq8pbuWk9Qq/nmdQ70UDD0CsTfSzf3YRJfuiKOpmPmlwgFzRwtuKDLU4taYSstU hw1YcTTyTkXOClbWbb7aj2U+EDpk9NvHrKh7n/yFcRfoMAWbNDMbvwIwItdPFpkE0fWRieI0V T5+8mUnFMKHo+TpM+JLGKPZaXD9SplWmXl+UX7hChz3PV62xHHOdj4knf6xyvFvPw8jQT3D09 ptdq8ZgUOGeucbn6aK8Oa1HKTnJoEiPFJ/eH4GuVh8zRgZ0C2dwKIn1EyI0G3u3Bm25JIMb96 RMhw0nqsnRVu/xd/0O3SqnZiM3eEIiBSYh0Lu8T66CfhVNrXRXXCYyfp2tp4EZ2le10UEVNv1 qL1RnO6tUKm84FvE1lU2IhfOpXwNHsVkin8y/eJ+26RHqUchD+Is/XcDM57uYm+t0ecUb9gX9 xXaUXziZ0GuYF0wSrX7h7wXoTifFkSbRpWw+u5MJIe8vZBc7hpjwmw= Received-SPF: pass client-ip=217.72.192.75; envelope-from=andreas.roehler@easy-emacs.de; helo=mout.kundenserver.de X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147820 Archived-At: When already inside, you could use the thingatpt utility, for example (defun mystring()   (interactive)   (message "%s" (word-at-point))) Am 23.08.24 um 16:18 schrieb Spencer Baugh: > 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. >