--- Begin Message ---
Subject: |
Undo fails to restore marker position correctly |
Date: |
Sat, 24 Oct 2009 17:18:48 -0700 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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@cantab.net
web: www.dr-qubit.org
--- End Message ---
--- Begin Message ---
Subject: |
Re: Undo fails to restore marker position correctly |
Date: |
Tue, 24 Nov 2009 16:33:39 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
> (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;
--- End Message ---