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#14281: 24.3; replace-match leaves point at wrong place Date: Fri, 10 May 2013 16:56:31 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1368219417 13748 80.91.229.3 (10 May 2013 20:56:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 May 2013 20:56:57 +0000 (UTC) Cc: 14281@debbugs.gnu.org To: Barry OReilly Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 10 22:56:56 2013 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 1UauN5-0004lQ-TJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 May 2013 22:56:56 +0200 Original-Received: from localhost ([::1]:41688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UauN5-0005ND-KJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 May 2013 16:56:55 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UauN1-0005N4-Mi for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 16:56:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UauN0-0001U0-EG for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 16:56:51 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UauN0-0001Tu-BC for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 16:56:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UauNB-0008R8-HM for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 16:57:01 -0400 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: Fri, 10 May 2013 20:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14281 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14281-submit@debbugs.gnu.org id=B14281.136821941032411 (code B ref 14281); Fri, 10 May 2013 20:57:01 +0000 Original-Received: (at 14281) by debbugs.gnu.org; 10 May 2013 20:56:50 +0000 Original-Received: from localhost ([127.0.0.1]:35956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UauMw-0008Qd-JU for submit@debbugs.gnu.org; Fri, 10 May 2013 16:56:49 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:48429) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UauMu-0008QW-9p for 14281@debbugs.gnu.org; Fri, 10 May 2013 16:56:45 -0400 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r4AKuWV0014114; Fri, 10 May 2013 16:56:32 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id DF71CB4161; Fri, 10 May 2013 16:56:31 -0400 (EDT) In-Reply-To: (Barry OReilly's message of "Fri, 10 May 2013 14:19:24 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4575=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4575> : streams <958180> : uri <1416875> 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:74145 Archived-At: >> Maybe we could add code that saves just the (match-beginning 0) and >> signals an error if it was not properly preserved. This would still >> require change-functions to save the match-data if they use it, but it >> might catch the offenders earlier. > I made a crack at it. Cool. > It was necessary to use save-match-data in a couple of around advices > and disable undo-tree to get some basic commands to work. I imagine > there would be more cases to resolve. Can you show us the offenders? > Are the changes in the .diff what you had in mind roughly? Pretty much, yes (tho with spaces before open parens, staying with 80 columns, and maybe not using match_limit since it seems like it can signal errors in corner cases). Also I wouldn't bother defining a new kind of error: it should always correspond to a coding mistake, so not something which you might like to catch in a condition-case. If there are "many offenders" (as you saw) or in case (worse) there are legitimate cases where the test signals an error, we could introduce a debug-match-data variable so only masochists help us debug. Stefan