From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gabriele Nicolardi Newsgroups: gmane.emacs.bugs Subject: bug#67124: 26.3; query-replace Arg out of range with comma option (at end-buffer) Date: Thu, 16 Nov 2023 17:27:44 +0100 Message-ID: <6ce88bd9-7041-4cd6-a7a6-42a7e0535112@medialab.sissa.it> References: <020a72b2-b896-4ecf-abab-111a6c1c9eac@medialab.sissa.it> <83cywfuwta.fsf@gnu.org> <83r0ktu4s7.fsf@gnu.org> <03fc7766-3d3a-394b-e08c-53eb136d40a6@gutov.dev> <83jzqlu3a6.fsf@gnu.org> <383929c4-7921-1a8d-3e6c-29a753ad7e0f@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38065"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Dmitry Gutov , Eli Zaretskii , 67124@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 16 17:28:29 2023 Return-path: Envelope-to: geb-bug-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 1r3fED-0009i7-Hm for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Nov 2023 17:28:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3fDr-0002sw-AU; Thu, 16 Nov 2023 11:28:07 -0500 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 1r3fDo-0002sg-3s for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2023 11:28:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3fDn-00059n-1z for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2023 11:28:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r3fDm-0000sq-GJ for bug-gnu-emacs@gnu.org; Thu, 16 Nov 2023 11:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gabriele Nicolardi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Nov 2023 16:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67124 X-GNU-PR-Package: emacs Original-Received: via spool by 67124-submit@debbugs.gnu.org id=B67124.17001520753381 (code B ref 67124); Thu, 16 Nov 2023 16:28:02 +0000 Original-Received: (at 67124) by debbugs.gnu.org; 16 Nov 2023 16:27:55 +0000 Original-Received: from localhost ([127.0.0.1]:57484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3fDe-0000sT-JV for submit@debbugs.gnu.org; Thu, 16 Nov 2023 11:27:54 -0500 Original-Received: from smtp03.cbsolt.net ([185.97.217.42]:52592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3fDb-0000sE-VQ for 67124@debbugs.gnu.org; Thu, 16 Nov 2023 11:27:53 -0500 Original-Received: from [10.0.2.15] (host-82-60-177-34.retail.telecomitalia.it [82.60.177.34]) by smtp03.cbsolt.net (Postfix) with ESMTPSA id 4SWQS11mvmz3wfV; Thu, 16 Nov 2023 17:27:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1700152066; bh=3Vn06NugsZMgUnknAlV8T6wmNQXHYw5gxwPEykI/RKI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BeQCCabns/DCVglV369/ofN7ll3nqADYIy12DBHvvELth+QOmrXXKiJZMDN1DRsSH 8yc8QQZihd4+rKokyFgqyEn04DstVc8MQ9+B7whap7HhCaMRQk9Mq9lNcsvR1LSBqw 1xGaVcph23CrsjpuG3GKut0uDIm04XFknCOBdLp4= Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274469 Archived-At: Il 16/11/23 15:45, Stefan Monnier ha scritto: >> 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 Thank you! I'll study the code and l'll try it! Gabriele > >> 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 >>>>> >>>>> 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 >>>>>>> >>>>>>> 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.