From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Gabriele Nicolardi <gabriele@medialab.sissa.it>
Cc: Dmitry Gutov <dmitry@gutov.dev>, Eli Zaretskii <eliz@gnu.org>,
67124@debbugs.gnu.org
Subject: bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer)
Date: Thu, 16 Nov 2023 09:45:35 -0500 [thread overview]
Message-ID: <jwva5rdn4z9.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <dedd8753-be44-48b8-a191-40887582d4b2@medialab.sissa.it> (Gabriele Nicolardi's message of "Mon, 13 Nov 2023 16:39:04 +0100")
> Ok, I'll wait for the next release, Thank you.
I think you might be able to use the following as a temporary fix which
should also be harmless when not useful:
(advice-add 'replace-match-maybe-edit :before
#'my-workaround-for-bug67124)
(defun my-workaround-for-bug67124 (&optional _newtext _fixedcase
_literal _noedit match-data
&rest _)
(when (and (integerp (car-safe match-data))
(integerp (car-safe (cdr-safe match-data))))
;; Make sure the "end" part of `match-data` is a marker
;; so it can't be pointing outside the buffer no matter
;; what the replacement does.
(setf (nth 1 match-data)
(copy-marker (nth 1 match-data)))))
-- Stefan
> Il 13/11/23 15:45, Dmitry Gutov ha scritto:
>> On 13/11/2023 16:38, Eli Zaretskii wrote:
>>>> Date: Mon, 13 Nov 2023 16:21:43 +0200
>>>> Cc:67124@debbugs.gnu.org
>>>> From: Dmitry Gutov<dmitry@gutov.dev>
>>>>
>>>> On 13/11/2023 16:06, Eli Zaretskii wrote:
>>>>> [Please use Reply All to reply, so that the bug tracker is CC'ed.]
>>>>>> Date: Sun, 12 Nov 2023 23:44:43 +0100
>>>>>> From: Gabriele Nicolardi<gabriele@medialab.sissa.it>
>>>>>>
>>>>>> I tested the patch on the MWE I sent to you. Thanks!
>>>>>>
>>>>>> Now I'm not sure what I should do. I write elisp code used by
>>>>>> a production team. We use Emacs to
>>>>>> format LaTeX documents of scientific papers. I don't control which
>>>>>> version of Emacs my
>>>>>> collaborators use. Do you have any suggestions?
>>>>> I guess either wait for the next Emacs release or build your own
>>>>> Emacs?
>>>> I haven't examined the exact problem, but in such cases some people also
>>>> either have workarounds in their own code, or supply "advices" for the
>>>> core functions that work around the problem there.
>>> Then maybe a simple replacement for the offending function, defined in
>>> an init file, would also be a possible solution?
>>
>> Sure. Though it might be more reliable with advice, since they don't
>> depend on the loading order.
>>
>> The problems I had in mind would be more subtle and independent of the
>> choice between these two methods. Stefan's latest patch includes changes
>> in search.c, so it might be difficult to work around in just Lisp. Again,
>> I haven't examined the problem itself.
next prev parent reply other threads:[~2023-11-16 14:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 19:40 bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer) Gabriele Nicolardi
2023-11-12 9:48 ` Eli Zaretskii
2023-11-13 3:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-13 14:17 ` Eli Zaretskii
2023-11-16 14:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16 14:55 ` Eli Zaretskii
2023-11-16 16:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16 16:56 ` Eli Zaretskii
2023-11-16 18:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16 18:34 ` Eli Zaretskii
2023-11-16 15:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16 16:51 ` Eli Zaretskii
2023-11-16 18:23 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-18 10:18 ` Eli Zaretskii
2023-11-18 16:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-18 21:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <ed11baa2-cf89-4a72-91d0-8f26c0af4126@medialab.sissa.it>
2023-11-13 14:06 ` Eli Zaretskii
2023-11-13 14:21 ` Dmitry Gutov
2023-11-13 14:38 ` Eli Zaretskii
2023-11-13 14:45 ` Dmitry Gutov
2023-11-13 15:39 ` Gabriele Nicolardi
2023-11-16 14:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-11-16 16:27 ` Gabriele Nicolardi
2023-11-15 13:18 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwva5rdn4z9.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=67124@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
--cc=eliz@gnu.org \
--cc=gabriele@medialab.sissa.it \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).