unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Irritation about re-search-backward
@ 2018-05-24 13:42 Marco Wahl
  2018-05-24 15:41 ` Michael Heerdegen
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Wahl @ 2018-05-24 13:42 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

with "|" marking point and the following buffer

#v+
aaaaaaaaaaaa|
#v-

M-: (re-search-backward "a*")

does not change point.

Shouldn't point have been moved to the beginning of the line?

BTW

#v+
|aaaaaaaaaaaa
#v-

M-: (re-search-forward "a*")

moves point to the end of the line.


Any hint would be nice, thanks,
                               Marco






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

* Re: Irritation about re-search-backward
  2018-05-24 13:42 Irritation about re-search-backward Marco Wahl
@ 2018-05-24 15:41 ` Michael Heerdegen
  2018-05-24 20:25   ` Marco Wahl
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael Heerdegen @ 2018-05-24 15:41 UTC (permalink / raw)
  To: Marco Wahl; +Cc: help-gnu-emacs

Marco Wahl <marcowahlsoft@gmail.com> writes:

> Hi,
>
> with "|" marking point and the following buffer
>
> #v+
> aaaaaaaaaaaa|
> #v-
>
>
> M-: (re-search-backward "a*")
>
> does not change point.
>
> Shouldn't point have been moved to the beginning of the line?

Good question - but it's the intended behavior.  Try

(progn (re-search-backward "a*")
       (message "Matched string: \"%s\"" (match-string 0))
       (sit-for 2))

The docstring once included this sentence:

   The match found is the one starting last in the buffer
   and yet ending before the origin of the search.

but it obviously has been removed.

I would make a bug report, since the documentation is insufficient in
this regard.


Michael.



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

* Re: Irritation about re-search-backward
  2018-05-24 15:41 ` Michael Heerdegen
@ 2018-05-24 20:25   ` Marco Wahl
  2018-05-24 21:33     ` Michael Heerdegen
  2018-05-25  6:32   ` Andreas Röhler
       [not found]   ` <mailman.418.1527195625.1292.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 7+ messages in thread
From: Marco Wahl @ 2018-05-24 20:25 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Marco Wahl <marcowahlsoft@gmail.com> writes:
>
>> Hi,
>>
>> with "|" marking point and the following buffer
>>
nn>> #v+
>> aaaaaaaaaaaa|
>> #v-
>>
>>
>> M-: (re-search-backward "a*")
>>
>> does not change point.
>>
>> Shouldn't point have been moved to the beginning of the line?
>
> Good question - but it's the intended behavior.  Try
>
> (progn (re-search-backward "a*")
>        (message "Matched string: \"%s\"" (match-string 0))
>        (sit-for 2))

Thanks!

BTW to get the "greedy" match backwards I use now a further element in
the search pattern like (re-search-backward "^a*").

[...]

> I would make a bug report, since the documentation is insufficient in
> this regard.

Thanks for the suggestion but I won't file a report.  If you would like
to take over feel free to do so.


Best regards,
-- 
Marco



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

* Re: Irritation about re-search-backward
  2018-05-24 20:25   ` Marco Wahl
@ 2018-05-24 21:33     ` Michael Heerdegen
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Heerdegen @ 2018-05-24 21:33 UTC (permalink / raw)
  To: Marco Wahl; +Cc: help-gnu-emacs

Marco Wahl <marcowahlsoft@gmail.com> writes:

> Thanks for the suggestion but I won't file a report.  If you would like
> to take over feel free to do so.

Done - see Bug#31584.


Michael.



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

* Re: Irritation about re-search-backward
  2018-05-24 15:41 ` Michael Heerdegen
  2018-05-24 20:25   ` Marco Wahl
@ 2018-05-25  6:32   ` Andreas Röhler
       [not found]   ` <mailman.418.1527195625.1292.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2018-05-25  6:32 UTC (permalink / raw)
  To: help-gnu-emacs

On 24.05.2018 17:41, Michael Heerdegen wrote:
> Marco Wahl <marcowahlsoft@gmail.com> writes:
> 
>> Hi,
>>
>> with "|" marking point and the following buffer
>>
>> #v+
>> aaaaaaaaaaaa|
>> #v-
>>
>>
>> M-: (re-search-backward "a*")
>>
>> does not change point.
>>
>> Shouldn't point have been moved to the beginning of the line?
> 
> Good question - but it's the intended behavior.  Try
> 

Wouldn't say "intended", just "as is".



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

* Re: Irritation about re-search-backward
       [not found]   ` <mailman.418.1527195625.1292.help-gnu-emacs@gnu.org>
@ 2018-05-25  9:23     ` Ralf Fassel
  2018-05-25 13:03       ` Michael Heerdegen
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Fassel @ 2018-05-25  9:23 UTC (permalink / raw)
  To: help-gnu-emacs

* Marco Wahl <marcowahlsoft@gmail.com>
| BTW to get the "greedy" match backwards I use now a further element in
| the search pattern like (re-search-backward "^a*").

Note that this matches each and every line, even those not starting with 'a'.

HTH
R'


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

* Re: Irritation about re-search-backward
  2018-05-25  9:23     ` Ralf Fassel
@ 2018-05-25 13:03       ` Michael Heerdegen
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Heerdegen @ 2018-05-25 13:03 UTC (permalink / raw)
  To: Ralf Fassel; +Cc: help-gnu-emacs

Ralf Fassel <ralfixx@gmx.de> writes:

> * Marco Wahl <marcowahlsoft@gmail.com>
> | BTW to get the "greedy" match backwards I use now a further element in
> | the search pattern like (re-search-backward "^a*").
>
> Note that this matches each and every line, even those not starting
> with 'a'.

Indeed.  Or the OP wants `looking-back' instead of `re-search-backward'.


Michael.



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

end of thread, other threads:[~2018-05-25 13:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-24 13:42 Irritation about re-search-backward Marco Wahl
2018-05-24 15:41 ` Michael Heerdegen
2018-05-24 20:25   ` Marco Wahl
2018-05-24 21:33     ` Michael Heerdegen
2018-05-25  6:32   ` Andreas Röhler
     [not found]   ` <mailman.418.1527195625.1292.help-gnu-emacs@gnu.org>
2018-05-25  9:23     ` Ralf Fassel
2018-05-25 13:03       ` Michael Heerdegen

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).