From unknown Tue Aug 12 03:20:10 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#14207 <14207@debbugs.gnu.org> To: bug#14207 <14207@debbugs.gnu.org> Subject: Status: 24.2; insert-file-contents clobbers match data Reply-To: bug#14207 <14207@debbugs.gnu.org> Date: Tue, 12 Aug 2025 10:20:10 +0000 retitle 14207 24.2; insert-file-contents clobbers match data reassign 14207 emacs submitter 14207 Aidan Gauland severity 14207 minor tag 14207 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 14 21:01:07 2013 Received: (at submit) by debbugs.gnu.org; 15 Apr 2013 01:01:07 +0000 Received: from localhost ([127.0.0.1]:50928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URXn8-0002be-TP for submit@debbugs.gnu.org; Sun, 14 Apr 2013 21:01:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44003) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URXn6-0002bX-Dz for submit@debbugs.gnu.org; Sun, 14 Apr 2013 21:01:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URXj3-0001vR-3d for submit@debbugs.gnu.org; Sun, 14 Apr 2013 20:56:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:56345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URXj2-0001vM-WA for submit@debbugs.gnu.org; Sun, 14 Apr 2013 20:56:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URXiz-0007JI-El for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2013 20:56:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URXiw-0001uC-Em for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2013 20:56:49 -0400 Received: from jersey.rurallink.co.nz ([114.134.15.197]:46608 helo=smtp.rurallink.co.nz) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URXiv-0001sn-SG for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2013 20:56:46 -0400 Received: from [49.143.231.198] (helo=dimension8.tehua.net) by smtp.rurallink.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1URXik-0000LE-VT for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2013 12:56:36 +1200 From: Aidan Gauland To: bug-gnu-emacs@gnu.org Subject: 24.2; insert-file-contents clobbers match data Date: Mon, 15 Apr 2013 12:56:26 +1200 Message-ID: <87fvysbohx.fsf@dimension8.tehua.net> MIME-Version: 1.0 Content-Type: text/plain X-Rurallink-Authenticated-User: aidalgol@no8wireless.co.nz X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) If (and only if) the match data is non-nil when `insert-file-contents' is called, it clobbers the match-data. To demonstrate: *** Welcome to IELM *** Type (describe-mode) for help. ELISP> (match-data) nil ELISP> (equal (match-data) (progn (write-region "foo bar baz wiz" nil "/tmp/foo-file") (with-temp-buffer (insert-file-contents "/tmp/foo-file")) (match-data))) t ELISP> (match-data) nil ELISP> (search-backward "elisp" nil t) 340 ELISP> (match-data) (# #) ELISP> (equal (match-data) (progn (write-region "foo bar baz wiz" nil "/tmp/foo-file") (with-temp-buffer (insert-file-contents "/tmp/foo-file")) (match-data))) nil ELISP> (match-data) (0 0) ELISP> In GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of 2013-04-03 on dimension8, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10707000 Configured using: `configure '--build' 'x86_64-linux-gnu' '--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.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2/site-lisp:/usr/share/emacs/site-lisp' '--without-gconf' '--with-crt-dir=/usr/lib/' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall' 'LDFLAGS=-Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_NZ.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: IELM Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-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 line-number-mode: t transient-mark-mode: t Recent input: M-x i e l m C-y C-y ( m a t c h - d a t a ) C-y M-p M-p M-p M-p M-p M-p M-p M-p M-< C-n C-p C-SPC M-> M-w M-x r e p o r Recent messages: History item: 1 History item: 2 History item: 1 History item: 2 History item: 3 History item: 4 Wrote /tmp/foo-file History item: 1 History item: 2 Mark set [2 times] Load-path shadows: /usr/share/emacs/24.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs/24.2/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.2/lisp/textmodes/flyspell /usr/share/emacs/24.2/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.2/lisp/textmodes/ispell Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils ielm pp comint regexp-opt ansi-color ring time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 15 01:21:10 2013 Received: (at 14207) by debbugs.gnu.org; 15 Apr 2013 05:21:10 +0000 Received: from localhost ([127.0.0.1]:51160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URbqo-0006WY-79 for submit@debbugs.gnu.org; Mon, 15 Apr 2013 01:21:10 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:54215) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URbqk-0006WI-AV for 14207@debbugs.gnu.org; Mon, 15 Apr 2013 01:21:09 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MLA009006L5QQ00@a-mtaout20.012.net.il> for 14207@debbugs.gnu.org; Mon, 15 Apr 2013 08:16:27 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MLA009AG6NEID80@a-mtaout20.012.net.il>; Mon, 15 Apr 2013 08:16:26 +0300 (IDT) Date: Mon, 15 Apr 2013 08:16:35 +0300 From: Eli Zaretskii Subject: Re: bug#14207: 24.2; insert-file-contents clobbers match data In-reply-to: <87fvysbohx.fsf@dimension8.tehua.net> X-012-Sender: halo1@inter.net.il To: Aidan Gauland Message-id: <83ehec74r0.fsf@gnu.org> References: <87fvysbohx.fsf@dimension8.tehua.net> X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 14207 Cc: 14207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Aidan Gauland > Date: Mon, 15 Apr 2013 12:56:26 +1200 > > If (and only if) the match data is non-nil when `insert-file-contents' > is called, it clobbers the match-data. And why is that a bug? >From the ELisp manual (node "Match Data"): Notice that all functions are allowed to overwrite the match data unless they're explicitly documented not to do so. 'insert-file-contents' is not documented to preserve match data. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 15 21:26:45 2013 Received: (at 14207) by debbugs.gnu.org; 16 Apr 2013 01:26:45 +0000 Received: from localhost ([127.0.0.1]:53350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URufU-00030Z-59 for submit@debbugs.gnu.org; Mon, 15 Apr 2013 21:26:45 -0400 Received: from jersey.rurallink.co.nz ([114.134.15.197]:52139 helo=smtp.rurallink.co.nz) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1URufP-00030I-S2 for 14207@debbugs.gnu.org; Mon, 15 Apr 2013 21:26:42 -0400 Received: from [49.143.231.198] (helo=dimension8.tehua.net) by smtp.rurallink.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1URubD-0007Bl-H4; Tue, 16 Apr 2013 13:22:21 +1200 From: Aidan Gauland To: Eli Zaretskii Subject: Re: bug#14207: 24.2; insert-file-contents clobbers match data References: <87fvysbohx.fsf@dimension8.tehua.net> <83ehec74r0.fsf@gnu.org> Date: Tue, 16 Apr 2013 13:22:12 +1200 In-Reply-To: <83ehec74r0.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 15 Apr 2013 08:16:35 +0300") Message-ID: <87bo9fb77f.fsf@dimension8.tehua.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Rurallink-Authenticated-User: aidalgol@no8wireless.co.nz X-Spam-Scanned-By: smtp.rurallink.co.nz (90bbc8d1d1bc4045364437f36f5980b9cf1d1bb6) X-Spam-Score: -2.9 (--) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14207 Cc: 14207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Eli Zaretskii writes: >> From: Aidan Gauland >> Date: Mon, 15 Apr 2013 12:56:26 +1200 >> >> If (and only if) the match data is non-nil when `insert-file-contents' >> is called, it clobbers the match-data. > > And why is that a bug? > > From the ELisp manual (node "Match Data"): > > Notice that all functions are allowed to overwrite the match data > unless they're explicitly documented not to do so. > > 'insert-file-contents' is not documented to preserve match data. Oh, OK. I thought it was the other way around: functions are supposed to explicitly be documented as modifying the match data. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 16 13:14:45 2013 Received: (at control) by debbugs.gnu.org; 16 Apr 2013 17:14:45 +0000 Received: from localhost ([127.0.0.1]:54952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1US9Su-0004M3-Rm for submit@debbugs.gnu.org; Tue, 16 Apr 2013 13:14:45 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:48219) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1US9Ss-0004Lw-Ez for control@debbugs.gnu.org; Tue, 16 Apr 2013 13:14:42 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1US9Oi-0000Q2-1o for control@debbugs.gnu.org; Tue, 16 Apr 2013 13:10:24 -0400 Date: Tue, 16 Apr 2013 13:10:24 -0400 Message-Id: Subject: control message for bug 14207 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -4.9 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.7 (-----) tag 14207 notabug close 14207 From unknown Tue Aug 12 03:20:10 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 15 May 2013 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator