GNU bug report logs - #23005
24.4; regexp replace evaluating replacements in incorrect order

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Ernesto Alfonso <erjoalgo@HIDDEN>; dated Mon, 14 Mar 2016 00:18:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 23005 <at> debbugs.gnu.org:


Received: (at 23005) by debbugs.gnu.org; 29 Jul 2019 12:59:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 29 08:59:28 2019
Received: from localhost ([127.0.0.1]:47809 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hs5FQ-0005T7-9y
	for submit <at> debbugs.gnu.org; Mon, 29 Jul 2019 08:59:28 -0400
Received: from quimby.gnus.org ([80.91.231.51]:42910)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hs5FN-0005Sw-TA
 for 23005 <at> debbugs.gnu.org; Mon, 29 Jul 2019 08:59:26 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>)
 id 1hs5FJ-00024K-FB; Mon, 29 Jul 2019 14:59:23 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ernesto Alfonso <erjoalgo@HIDDEN>
Subject: Re: bug#23005: 24.4; regexp replace evaluating replacements in
 incorrect order
References: <CAOckuXAxGOZkbX=fdwAwyM3W9qoueJpxG+ht_zpPKHtaHa_C+A@HIDDEN>
Date: Mon, 29 Jul 2019 14:59:21 +0200
In-Reply-To: <CAOckuXAxGOZkbX=fdwAwyM3W9qoueJpxG+ht_zpPKHtaHa_C+A@HIDDEN>
 (Ernesto Alfonso's message of "Sun, 13 Mar 2016 17:17:16 -0700")
Message-ID: <87o91d809i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Ernesto Alfonso <erjoalgo@HIDDEN> writes: > when using
 replace-regexp with both expressions (ie \, ) and simple > string replacements
 (ie \?), the expression replacement is evaluated > first, even if it comes
 after the \? replacement. > > Exam [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 23005
Cc: 23005 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Ernesto Alfonso <erjoalgo@HIDDEN> writes:

> when using replace-regexp with both expressions (ie \,) and simple
> string replacements (ie \?), the expression replacement is evaluated
> first, even if it comes after the \? replacement.
>
> Example:
>
> Replace regexp (default '.*?', *'.*' -> '\?', '\,(read-string "silly
> expression")'):
>
> the (read-string "silly expression") is evaluated before the first "\?".

I'm not sure this is a bug -- the doc string doesn't say anything about
the order these things are done in.  On the other hand, it doesn't seem
very useful to do the evaluation first.  If the evaluation could return
things like \&, then perhaps doing it first would be useful...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23005; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Mar 2016 00:17:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 13 20:17:27 2016
Received: from localhost ([127.0.0.1]:47254 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1afGCN-0001ns-6G
	for submit <at> debbugs.gnu.org; Sun, 13 Mar 2016 20:17:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39874)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <erjoalgo@HIDDEN>) id 1afGCM-0001ng-6Y
 for submit <at> debbugs.gnu.org; Sun, 13 Mar 2016 20:17:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <erjoalgo@HIDDEN>) id 1afGCF-00082d-Sk
 for submit <at> debbugs.gnu.org; Sun, 13 Mar 2016 20:17:20 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:45544)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <erjoalgo@HIDDEN>) id 1afGCF-00082S-PP
 for submit <at> debbugs.gnu.org; Sun, 13 Mar 2016 20:17:19 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59072)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <erjoalgo@HIDDEN>) id 1afGCE-0005Ng-Nr
 for bug-gnu-emacs@HIDDEN; Sun, 13 Mar 2016 20:17:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <erjoalgo@HIDDEN>) id 1afGCD-00081y-O8
 for bug-gnu-emacs@HIDDEN; Sun, 13 Mar 2016 20:17:18 -0400
Received: from mail-ob0-x22b.google.com ([2607:f8b0:4003:c01::22b]:32853)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <erjoalgo@HIDDEN>) id 1afGCD-00081u-GK
 for bug-gnu-emacs@HIDDEN; Sun, 13 Mar 2016 20:17:17 -0400
Received: by mail-ob0-x22b.google.com with SMTP id fz5so161162095obc.0
 for <bug-gnu-emacs@HIDDEN>; Sun, 13 Mar 2016 17:17:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:date:message-id:subject:from:to;
 bh=D0aU0QhQpjx8mj3rUp9583yPc4v+rfHPI8+PVMIN6gM=;
 b=YeKSj+cLK80dfrS+lOWtlhS6xyMJvBB/AZEOwedu/28+VtmMypkF6PjguVlMUjE2xi
 BT/tFwD+DM3jjA7wknD9EoahJIQRgmzKYEyMdyKMX0cO/EVeBWyZIXsqmZS1I2NLDBpu
 imcfc2ytZXB3u6KTYfB8lFCTZqNGuAkFRz03vyhGVq/UdMi5gJRlMxo8+H6q4Zn/rDj4
 XG0BiqhUBrc3UwR8vz0wmBmiATqBC/jf2gDDlP4P01pSdv9O3I5cQ1hmgScg9Xlw72xe
 UeZU7fF4xW3sDT7emB8ecKgjHJJGMOUQOosPk+NA1AYc7SAJm09XnWUch+vL+UKg3/eZ
 WXLA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:date:message-id:subject:from:to;
 bh=D0aU0QhQpjx8mj3rUp9583yPc4v+rfHPI8+PVMIN6gM=;
 b=O1PTurgV5wkKm3x5Voc7t9pX/kGmKSgO+n3/uW3ziZcy37hLLggZT15DGPplfAbQef
 xCDLOWba3so/uym8SlLKqc1bjfjuhnZXQOPadph97z03hy44kueMG1jGikW2Mg0q6UY8
 8CYIA78LWdkaU19Jyfn2qzOo0zxuz/rDqnea2PgX3o6e3qQV9V5s8L1JpKsWGF7caNzk
 AyR93J8BS1SmXh8f//gL+ZD2aXO9be31QQgEjCrlp3y8FHuc1rveSJM3g9WN/yeg5UP2
 +auF4JB36MEzk7n8LQvLc/JtWgcfMo5JioS4ezXqFzpGeyhEGXY/oVeZIfluYkZ6KLYO
 jCyg==
X-Gm-Message-State: AD7BkJLbGP9hGqXKtKIomM6yBrzVFyuZBkYyCN+GzKZURPaHEx+eXAJULq4mgAlpZJ3pZ7jMEYQ5lnBBoNjyNw==
MIME-Version: 1.0
X-Received: by 10.60.58.103 with SMTP id p7mr12027341oeq.14.1457914636699;
 Sun, 13 Mar 2016 17:17:16 -0700 (PDT)
Received: by 10.76.34.228 with HTTP; Sun, 13 Mar 2016 17:17:16 -0700 (PDT)
Date: Sun, 13 Mar 2016 17:17:16 -0700
Message-ID: <CAOckuXAxGOZkbX=fdwAwyM3W9qoueJpxG+ht_zpPKHtaHa_C+A@HIDDEN>
Subject: 24.4; regexp replace evaluating replacements in incorrect order
From: Ernesto Alfonso <erjoalgo@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

when using replace-regexp with both expressions (ie \,) and simple
string replacements (ie \?), the expression replacement is evaluated
first, even if it comes after the \? replacement.

Example:

Replace regexp (default '.*?', *'.*' -> '\?', '\,(read-string "silly
expression")'):

the (read-string "silly expression") is evaluated before the first "\?".



In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.3 (jessie)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Javascript

Minor modes in effect:
  shell-dirtrack-mode: t
  text-scale-mode: t
  global-text-scale-mode: t
  global-command-mode: t
  command-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t




Acknowledgement sent to Ernesto Alfonso <erjoalgo@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#23005; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.