From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Saving match data Date: Sat, 08 Oct 2016 06:02:44 +0200 Message-ID: <87y41zv66z.fsf@web.de> References: <87twd0j7fi.fsf@web.de> <83zimrokuj.fsf@gnu.org> <87y42b3hni.fsf@web.de> <83ponnojv6.fsf@gnu.org> <87twcz3geb.fsf@web.de> <83mviro2jr.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1475899399 28264 195.159.176.226 (8 Oct 2016 04:03:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Oct 2016 04:03:19 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 08 06:03:15 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 1bsiqp-00061Z-W0 for ged-emacs-devel@m.gmane.org; Sat, 08 Oct 2016 06:03:08 +0200 Original-Received: from localhost ([::1]:39198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsiqo-0002km-Js for ged-emacs-devel@m.gmane.org; Sat, 08 Oct 2016 00:03:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsiqi-0002kg-Bd for emacs-devel@gnu.org; Sat, 08 Oct 2016 00:03:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsiqg-0003Fa-FV for emacs-devel@gnu.org; Sat, 08 Oct 2016 00:02:59 -0400 Original-Received: from mout.web.de ([212.227.15.4]:62847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsiqb-0003Bx-Db; Sat, 08 Oct 2016 00:02:53 -0400 Original-Received: from drachen.dragon ([90.186.0.242]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0Md16Y-1bbbOv32gc-00ICZB; Sat, 08 Oct 2016 06:02:48 +0200 In-Reply-To: <83mviro2jr.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 29 Sep 2016 05:36:08 +0300") X-Provags-ID: V03:K0:R6TGDbkBPxVlVwnMHIe1dA7UUjjvLl3o74C5LgkluOqGcyvtq/H KHj3DzmRAYI4BpdGWtAwFuhgx/NGNXTbFeBMIQGcjtOWtoN2FAWCIwBC3VPwijOBHtBEVHC 5VqvcW1XRYMXut+wPRXwvl73Vk8svfNdpGyr0QuynW4e3cbDtUFt3Phtm9XmLZ1UkjPDucm /io6n0Oja1z8WHC1UPjyA== X-UI-Out-Filterresults: notjunk:1;V01:K0:3TE6PuwkLF8=:HxuBuwoI/rvnVtyjx0Qnpo UZBzbQ85/CVG29zVpScmGkd5np5xc48TjhWt2AUtUx6aU1UHZWZYR780j8aMfPDNMVI7HoZcP gjWchEaxJAZUjFYS7Qzteu/sTkt+32pl50PmhgMGUJuBPnzbXAkQ1GtvOr6yOBO7pKal0Vd8Y Awd1ENqdVdSIT2wRKeCfQwUNlEOtD3Bk1f6cdYo5fyF5JfUdT8uW0a4fO9MvLis8Jv4G2+oJO gQZaEPKUOjqtCWsXhca2Q4wZHUGgwBq1D0e5ncwekpEJa2fN80XmNTxv6PctB1CvCd3bCAqm5 Dk0+jVGXTB2+qD5VzfqOW2igiEhN34xJ/TmiqCVHveuAQqMgzy7iFdSkc0BYvbdKeHnRNPjF+ ODox1nHlFgWpU6oU3HUoPzmiJ83EaCsG5HeTmh3oaKqmwlITxjB7q/+QkifSE4ZocvD1apu4/ Psa/qEahjNLzQptKyqtQcNfBPM72EGA/cDlVEWdE4wVvp46UI94kL3wyjkh3+rXDva78EC3Kb 36AqhfsirOvG7RXLACDOF1qi4NcgoOTej6XSwR6AbnVYtaCPJoBBacu1a1eK/ONxuop6zwi8a hOaAp8o4HdatOKE98pukKjAKr4fGLw5xI9CRw2G5ZQCNtynHHSOjE0SZuAhVXwXc4/sXdS8Gn aeuEdi4LfoEl+lMrznD59bqyP1DTCTfukgvrYxXS9MKW1LRPGgy9Lo2H0JqMhvnWs0pv11v67 RKxtCwG+WgACAxWHROV3v4N2uZ2KLQqObx+Xv4jL80LBSb2NMvNl/+a0EBZ3VBwmviIbvotk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.4 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:208073 Archived-At: Eli Zaretskii writes: > Maybe I misunderstand the proposal, because it sounds very similar to > what we have. Could you perhaps show an example using the current and > the proposed technique, so that the differences are clear? Well, what currently looks like (using some fantasy function names) #+begin_src emacs-lisp (progn (search-forward "test") (save-match-data (do-this) (maybe-change-match-data-here) (do-that)) (use-the-match-data)) #+end_src could become something like #+begin_src emacs-lisp (with-match-data data (search-forward "test") (do-this) (maybe-change-match-data-here) (do-that) (use-match-data data (use-the-match-data))) #+end_src We don't have multiple values in Elisp. So, `with-match-data' could be a macro that binds a specified variable in first position to the match data present after (normally) evaluating the expression in the second position. `use-match-data' would be another macro that would change the match data in its scope to the evaluation result of the sexp in the first position. Honestly, I don't really want to propose to change things, if either in this direction, or at all... as long as we don't invest too much time to consolidate what we have now (like ensuring tons of function to not change match data). Regards, Michael.