From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#13260: 24.3.50; save match data for core functions like `delete-char' and `delete-backward-char'? Date: Sun, 23 Dec 2012 19:54:00 -0500 Message-ID: References: <87zk143ihe.fsf@bzg.ath.cx> <87bodkbu2k.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1356310482 32491 80.91.229.3 (24 Dec 2012 00:54:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Dec 2012 00:54:42 +0000 (UTC) Cc: 13260@debbugs.gnu.org To: Bastien Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 24 01:54:56 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TmwJg-0000iK-TE for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 01:54:53 +0100 Original-Received: from localhost ([::1]:53893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmwJS-0002Wz-Sj for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Dec 2012 19:54:38 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmwJP-0002Wn-Mu for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:54:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TmwJO-0006G5-OO for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:54:35 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmwJO-0006G1-L1 for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:54:34 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TmwJp-0006vE-OT for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Dec 2012 00:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13260 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13260-submit@debbugs.gnu.org id=B13260.135631047126564 (code B ref 13260); Mon, 24 Dec 2012 00:55:01 +0000 Original-Received: (at 13260) by debbugs.gnu.org; 24 Dec 2012 00:54:31 +0000 Original-Received: from localhost ([127.0.0.1]:57181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TmwJK-0006uP-KM for submit@debbugs.gnu.org; Sun, 23 Dec 2012 19:54:30 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:18062) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TmwJJ-0006uI-6T for 13260@debbugs.gnu.org; Sun, 23 Dec 2012 19:54:29 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09FxLDj/2dsb2JhbABEsEiDSYEIghUBAQQBViMFCws0BwsUGA0kiBwFugmQRAOIQppxgViDBw X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="210616883" Original-Received: from 69-196-176-227.dsl.teksavvy.com (HELO pastel.home) ([69.196.176.227]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 23 Dec 2012 19:54:01 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 0EEDF59067; Sun, 23 Dec 2012 19:54:00 -0500 (EST) In-Reply-To: <87bodkbu2k.fsf@bzg.ath.cx> (Bastien's message of "Sun, 23 Dec 2012 17:40:35 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:68967 Archived-At: >>> I know the policy is to let any function assume the match data >>> are not saved, but I think an exception would be useful here. >> Why? > Because delete-char is very low-level and because it is hard to > guess why it would modify the match data -- hence very easy to > assume it will not, while it does. AFAIK delete-char does not modify the match-data any more than other buffer-modifying operations (such as delete-region, insert, ...). They all just modify the buffer, which is turn can modify the match-data because it runs various hooks which can do all kinds of things. > Principle of least surprise? The rule "expect the match-data to be destroyed all the time" is the one that leads to the least surprise. 99% of the functions can destroy the match-data, even though they may preserve it in 99% of the circumstances. And in 99% of the cases where they do destroy the match-data, nobody cares anyway, which is why we shouldn't always save-match-data. Stefan