GNU bug report logs - #4803
Undo fails to restore marker position correctly

Previous Next

Package: emacs;

Reported by: Toby Cubitt <toby-dated-1256861956.bb6a54 <at> dr-qubit.org>

Date: Sun, 25 Oct 2009 00:20:04 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4803 in the body.
You can then email your comments to 4803 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4803; Package emacs. (Sun, 25 Oct 2009 00:20:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Toby Cubitt <toby-dated-1256861956.bb6a54 <at> dr-qubit.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 25 Oct 2009 00:20:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Toby Cubitt <tsc25 <at> cantab.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Undo fails to restore marker position correctly
Date: Sat, 24 Oct 2009 17:18:48 -0700
In GNU Emacs 23.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.16.6)
  of 2009-10-17


Steps to reproduce:
-------------------
(switch-to-buffer "*scratch*")  ; any buffer containing some text will do
(setq mrk (make-marker))
(move-marker mrk 5)             ; any position within text will do
(set-marker-insertion-type mrk t)
(delete-region 1 10)
(undo)

Marker mrk is now at position 15 in *scratch* instead of 5.


Toby
--
Dr T. S. Cubitt
Quantum Information Theory group
Department of Mathematics
University of Bristol
United Kingdom

email: tsc25 <at> cantab.net
web: www.dr-qubit.org




Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Tue, 24 Nov 2009 21:40:04 GMT) Full text and rfc822 format available.

Notification sent to Toby Cubitt <toby-dated-1256861956.bb6a54 <at> dr-qubit.org>:
bug acknowledged by developer. (Tue, 24 Nov 2009 21:40:05 GMT) Full text and rfc822 format available.

Message #10 received at 4803-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Toby Cubitt <toby-dated-1256861956.bb6a54 <at> dr-qubit.org>
Subject: Re: Undo fails to restore marker position correctly
Date: Tue, 24 Nov 2009 16:33:39 -0500
> (switch-to-buffer "*scratch*")  ; any buffer containing some text will do
> (setq mrk (make-marker))
> (move-marker mrk 5)             ; any position within text will do
> (set-marker-insertion-type mrk t)
> (delete-region 1 10)
> (undo)

> Marker mrk is now at position 15 in *scratch* instead of 5.

I've just installed the patch below should should fix it.
Thanks for catching it!


        Stefan


=== modified file 'src/insdel.c'
--- src/insdel.c	2009-11-24 15:30:54 +0000
+++ src/insdel.c	2009-11-24 21:28:22 +0000
@@ -377,7 +377,7 @@
 	       upon re-inserting the deleted text, so we have to arrange
 	       for them to move backward to the correct position.  */
 	      XSETMISC (marker, m);
-	    record_marker_adjustment (marker, charpos - to);
+	      record_marker_adjustment (marker, to - charpos);
 	    }
 	  m->charpos = from;
 	  m->bytepos = from_byte;




bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Dec 2009 12:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 176 days ago.

Previous Next


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