Subject: Re: bug#46469: 27.1; `isearch-del-char' should move point further back

From: Juri Linkov <[email-masked]>
Date: Wed, 28 Apr 2021 23:53:14 +0300

> For the record, the search ring advance/retreat commands suffer from a
> bug similar to the `isearch-del-char' one described here.
>
> Namely, `C-s M-p M-p M-p' presumably takes you to the first match, after
> the starting point, of the third history element.  It would be very
> strange to expect that the result of this key sequence depends on the
> first and second history elements, or on the contents of the buffer
> beyond the first match of the third history element.
>
> And, in fact, everything is fine when `search-ring-update' is nil.
> However:
>
> (progn
>   (setq search-ring-update t

Your proposed change makes sense.  Since this is a non-default value
of search-ring-update, I'm not sure how the users who customized it to t
would like such change.

>> I tried again, but your patch still doesn't work.  With
>> It signals the error "Keyboard macro terminated by a command ringing the bell".
>
> Now I see, my old patch only worked in regexp mode (which is `C-s' for
> me).  The attached one seems to work (but this is subtle stuff, there
> may be edge cases).

Thanks, now it's clear why it didn't work when I tried.

But this change will cause a problem to me.  Usually, I type 'C-s'
several times with a non-empty search string to arrive to Nth occurrence.
Then to be able to continue the search with a shorter string, I remove
some characters from the search string with 'C-M-d' (isearch-del-char).
Then continue searching with 'C-s' from the same place.  But with the patch,
'C-M-d' unexpectedly jumps to a previous match, and every next 'C-M-d'
jumps back it its previous match that makes no sense.