From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: master fb4f2aa038: * lisp/textmodes/paragraphs.el (repunctuate-sentences-filter): New function. Date: Wed, 05 Jan 2022 20:47:51 +0200 Organization: LINKOV.NET Message-ID: <86sfu2aujs.fsf@mail.linkov.net> References: <87r19ns9fv.fsf@miha-pc> <86y23vml8n.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23340"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: jakanakaevangeli@chiru.no, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 05 19:56:48 2022 Return-path: Envelope-to: ged-emacs-devel@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 1n5BSo-0005sF-Pw for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Jan 2022 19:56:46 +0100 Original-Received: from localhost ([::1]:57786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5BSn-0003Fi-0K for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Jan 2022 13:56:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5BLN-0006Vv-M3 for emacs-devel@gnu.org; Wed, 05 Jan 2022 13:49:05 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:50609) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5BLE-0004bH-Ul for emacs-devel@gnu.org; Wed, 05 Jan 2022 13:49:05 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id EB298240006; Wed, 5 Jan 2022 18:48:45 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Tue, 04 Jan 2022 15:44:23 -0500") Received-SPF: pass client-ip=217.70.183.193; envelope-from=juri@linkov.net; helo=relay1-d.mail.gandi.net X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284264 Archived-At: >> (not (length= (match-string 4) 2))) > > Note that the default function (whose body is visible above) depends on > the match data set by the caller, so `add-function` risks messing it up > if it clobbers the match data with code that runs before this default. > > At the very least, we need a docstring that makes it very clear what > match-data is expected to be set when the function is called and that > explains how/when it should be preserved. > > Tho maybe a better approach is to change the calling convention so we > don't need to depend this way on the match data set by the caller. Another reason not to use the match data is not to depend on group numbering in the regexp such as (match-string 4). So I replaced it with: (/= 2 (- (point) (save-excursion (skip-chars-backward " ") (point)))) Then there is no need to add a warning to the docstring because query-replace-regexp is permissive in regard to interfering user regexps.