From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Saving match data Date: Wed, 28 Sep 2016 22:58:17 +0200 Message-ID: References: <87twd0j7fi.fsf@web.de> <83zimrokuj.fsf@gnu.org> <87y42b3hni.fsf@web.de> <83ponnojv6.fsf@gnu.org> <87twcz3geb.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1475097368 18424 195.159.176.226 (28 Sep 2016 21:16:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Sep 2016 21:16:08 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: Eli Zaretskii , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 28 23:16:03 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 1bpMCn-0003LA-Cn for ged-emacs-devel@m.gmane.org; Wed, 28 Sep 2016 23:15:53 +0200 Original-Received: from localhost ([::1]:33215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpMCo-0006Br-R7 for ged-emacs-devel@m.gmane.org; Wed, 28 Sep 2016 17:15:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpLxn-0008IH-Ac for emacs-devel@gnu.org; Wed, 28 Sep 2016 17:00:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpLxj-0000Pa-8N for emacs-devel@gnu.org; Wed, 28 Sep 2016 17:00:22 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]:55364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpLxj-0000FX-25; Wed, 28 Sep 2016 17:00:19 -0400 Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bpLxT-0002BZ-7Z; Wed, 28 Sep 2016 23:00:07 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEWimY7g1sMGBARCPToL CQkVEhJ6c2vsOAu/AAACa0lEQVQ4jXWUT3PbIBDFl2rCGcYTn1OF5KyUwrmjoJ7rADmjyOb7f4S+ BcnTS9fjGVs/v/3zWEznSkfoeygS9DWaZUlLtLbKrQqhaXA55zeAcQxLZkB4V+nCOJpwYRCvOVtr C8ltGlxoAWAcPeY6eF9k2dYH/LqDbTupzYvBQ1Bq/TF2cqGiZJnOFdkRYtgaSAB4JMoWbSkECUGy K75eb+jP+lqIX377OMCzCZiiUsWk6HhwB8AcS0ZpgKJqnXy6A8NASb9NqtTNun9AhIJsLULWrTbJ hb6NhgEJjTRawa+y7QoUzwAKWbzSA6Z06Q5iEeTtCp2iwVZ3B9kWaeN0JiEI7gyuFWeQLU5hlaRJ wDKit6YIucWyngipqEpZRFN0EIoYpFACoDIwc2i5wi+teQGKpA4gWBKehzcsgS8VLywGK5CJc6UV 6wGXMbskWo92P13gvblZ672vB+DSLjeQU3Twoe9V7yoyeOCJ8lQwz9Fueldai8ec8nTjpaTrvM/B QD469mDiVNfQazRwOjm2JsoGwsLz5d8o8nBz7Ue1gzZ4fn9WeovdNY/i1zD3GuOLUtLanJau+NpB mp+V2nZQGuiZALRupfOhaJbnkF61ZgM4dkUvzyA1C3LstvOVQsxPWhvOGiM8Xtt5cIzh6axn/sS3 rrbz4M2bX+bvUn+g4MLXjhW4syG8fIzjk2TFH5ed87XbPi/LTzObd8W7icuCW9GL4/tPE4zZUlou LkbseAM4qTGNe3d+iShC+17Bejw2OBqM6lzGP8SRCqLZZMyBvlKsdAfcskGrsAYjVrF2kA5fcmLr PgvWR/8n/gKTlwCjbGqX5QAAAABJRU5ErkJggg== In-Reply-To: <87twcz3geb.fsf@web.de> (Michael Heerdegen's message of "Wed, 28 Sep 2016 22:42:36 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.224.195 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:207884 Archived-At: Michael Heerdegen writes: > You would bind the match data to a variable directly when it is > produced, and refer to it later by that variable name. This is how it's done in most languages. To be explicit in an Emacs context: if you wanted to double the number in all instances of a, it could look like: (while (setq match (new-re-search-forward "a\\([0-9]+\\)" nil t)) (insert (match match 1))) It would be nice and clean and all, but the current global state thing we have now is rarely any problem in practice. You just have to learn to do no non-trivial operations between the match and where you use the match data. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no