From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: question about markers, replace-match, and undo Date: Fri, 27 Apr 2007 09:44:10 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1177692288 30605 80.91.229.12 (27 Apr 2007 16:44:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2007 16:44:48 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 27 18:44:46 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HhTYn-0003RH-DT for ged-emacs-devel@m.gmane.org; Fri, 27 Apr 2007 18:44:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhTee-0002oI-O5 for ged-emacs-devel@m.gmane.org; Fri, 27 Apr 2007 12:50:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HhTec-0002o5-3b for emacs-devel@gnu.org; Fri, 27 Apr 2007 12:50:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HhTea-0002na-I2 for emacs-devel@gnu.org; Fri, 27 Apr 2007 12:50:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhTea-0002nW-FN for emacs-devel@gnu.org; Fri, 27 Apr 2007 12:50:40 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HhTYh-0005bD-Db for emacs-devel@gnu.org; Fri, 27 Apr 2007 12:44:36 -0400 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l3RGiW7i013349 for ; Fri, 27 Apr 2007 11:44:32 -0500 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l3RG42gR011804 for ; Fri, 27 Apr 2007 10:44:31 -0600 Original-Received: from dhcp-amer-whq-csvpn-gw3-141-144-82-83.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 2651535411177692254; Fri, 27 Apr 2007 09:44:14 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:70269 Archived-At: I have some text, with a marker before it and a marker after it. For instance, the first marker is at position 41, just before `m', and the second is at position 48, just after `s': 41 48 mnopqrs I match this text, and then call (replace-match "ABC"), with the result that the first marker is still at position 41 and the second marker is now at position 44, just after `C', which is what I would expect and what I want: 41 44 ABC I use `undo', and the result is that both markers are now at position 41: 41 41 mnopqrs I get the same behavior if I use various additional args to `replace-match'. I've also tried (progn (undo-boundary) (replace-match "ABC")), with no change. I'm not saying there is necessarily a bug here; I don't know. I'm asking how I can get `undo' to restore not only the text but the marker positions. If I use, for instance, `delete-region' and `insert', there is no problem, but I need to be able to use `replace-match' here. What also seems odd is that (buffer-has-markers-at 48) returns t, but `mark-ring' shows only two markers, both at position 41, and the mark itself is somewhere else altogether (e.g. 18). I also used a library `mark.el' from Emacs Wiki that lets you access the markers in a buffer, and it does not show any marker at 48. So perhaps `buffer-has-markers-at' is reporting erroneously here? [BTW, I also wonder why we have `buffer-has-markers-at', but we apparently have no function that returns the list of markers at a given position.] Can anyone help with my question of how to get `undo' to act as an inverse of `replace-match' wrt the markers? Thx.