From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.devel Subject: Re: Saving match data Date: Wed, 28 Sep 2016 19:00:44 +0200 Message-ID: <87mvist0w3.fsf@mbork.pl> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1475082112 8176 195.159.176.226 (28 Sep 2016 17:01:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Sep 2016 17:01:52 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.2.50.1 Cc: Emacs developers To: Philipp Stephani Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 28 19:01:48 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpIEt-0001Tk-Ar for ged-emacs-devel@m.gmane.org; Wed, 28 Sep 2016 19:01:47 +0200 Original-Received: from localhost ([::1]:60158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpIEr-0004ut-Nr for ged-emacs-devel@m.gmane.org; Wed, 28 Sep 2016 13:01:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpIDw-0004t7-KH for emacs-devel@gnu.org; Wed, 28 Sep 2016 13:00:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpIDq-0002YP-Nq for emacs-devel@gnu.org; Wed, 28 Sep 2016 13:00:47 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:52643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpIDq-0002Wb-GR for emacs-devel@gnu.org; Wed, 28 Sep 2016 13:00:42 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id B5A3FE62D6; Wed, 28 Sep 2016 19:00:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mq-vAWGV3BtW; Wed, 28 Sep 2016 19:00:35 +0200 (CEST) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 0EB0EE62BD; Wed, 28 Sep 2016 19:00:35 +0200 (CEST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 195.110.48.8 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207867 Archived-At: On 2016-09-28, at 16:01, Philipp Stephani wrote: > Hi, > > the Elisp manual (section "The Match Data") says: > > "Notice that all functions are allowed to overwrite the match data > unless they=E2=80=99re explicitly documented not to do so." > > I think this statement is surprising and puts unnecessary burden on Eli= sp Yes, it is surprising. Here's a story from three years ago about how this hit me: http://mbork.pl/2013-09-18_Selective_replacement_in_LaTeX_documents_(en) OTOH, I agree with Stefan and Eli that changing that would be a huge work (and it would make Emacs slower). OYAH, I think that it is safe to assume that only functions related to searching actually mess with match data, and one could easily grep the Emacs sources to make a list of functions which actually change match data. Then, we could extend these functions' docstrings (and mentions in the manual) with a suitable mention. IOW, I would consider doing this > and then clean up existing documentation [...] but not this: > [...] add `save-match-data' where appropriate. Also, one might consider (as hinted in my post) adding `save-match-data' to _interactive_ functions messing with match data. This way, the user would not be surprised as I was back then. This _might_ be a reasonable compromise, no? WDYT? > Philipp Best, --=20 Marcin Borkowski