aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorBarry O'Reilly2014-03-24 22:47:39 -0400
committerBarry O'Reilly2014-03-24 22:47:39 -0400
commit37ea8275f7faad1192ddaba9f4a0789580675e17 (patch)
treecb6242b0298180f32d8c253c1b3aa8af3c6572fa /doc
parent3e2377ce2f4eeb141ffbd000723c55813f78b08f (diff)
downloademacs-37ea8275f7faad1192ddaba9f4a0789580675e17.tar.gz
emacs-37ea8275f7faad1192ddaba9f4a0789580675e17.zip
Undo in region after markers in undo history relocated
* simple.el (primitive-undo): Only process marker adjustments validated against their corresponding (TEXT . POS). Issue warning for lone marker adjustments in undo history. (Bug#16818) (undo-make-selective-list): Add marker adjustments to selective undo list based on whether their corresponding (TEXT . POS) is in the region. Remove variable adjusted-markers, which was unused and only non nil during undo-make-selective-list. (undo-elt-in-region): Return nil when passed a marker adjustment and explain in function doc. Have (MARKER . ADJUSTMENT) undo records always be immediately after their corresponding (TEXT . POS) record in undo list. (Bug#16818) * lisp.h (record-delete): New arg record_markers. (record_marker_adjustment): No longer needed outside undo.c. * insdel.c (adjust_markers_for_delete): Move calculation of marker adjustments to undo.c's record_marker_adjustments. Note that fileio.c's decide_coding_unwind is another caller to adjust_markers_for_delete. Because it has undo list bound to t, it does not rely on adjust_markers_for_delete to record marker adjustments. (del_range_2): Swap call to record_delete and adjust_markers_for_delete so as undo marker adjustments are recorded before current deletion's adjustments, as before. (adjust_after_replace): (replace_range): Pass value for new record_markers arg to delete_record. * undo.c (record_marker_adjustment): Renamed to record_marker_adjustments and made static. (record_delete): Check record_markers arg and call record_marker_adjustments. (record_change): Pass value for new record_markers arg to delete_record. (record_point): at_boundary calculation no longer needs to account for marker adjustments. * undo-tests.el (undo-test-marker-adjustment-nominal): (undo-test-region-t-marker): New tests of marker adjustments. (undo-test-marker-adjustment-moved): (undo-test-region-mark-adjustment): New tests to demonstrate bug#16818, which fail without the fix. * markers.texi (Moving Marker Positions): The 2014-03-02 doc change mentioning undo's inability to handle relocated markers no longer applies. See bug#16818. * text.texi (Undo): Expand documentation of (TEXT . POS) and (MARKER . ADJUSTMENT) undo elements.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog8
-rw-r--r--doc/lispref/markers.texi10
-rw-r--r--doc/lispref/text.texi9
3 files changed, 18 insertions, 9 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 1e57d4f0db2..3dfc0dffd76 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,11 @@
12014-03-24 Barry O'Reilly <gundaetiapo@gmail.com>
2
3 * markers.texi (Moving Marker Positions): The 2014-03-02 doc
4 change mentioning undo's inability to handle relocated markers no
5 longer applies. See bug#16818.
6 * text.texi (Undo): Expand documentation of (TEXT . POS) and
7 (MARKER . ADJUSTMENT) undo elements.
8
12014-03-22 Glenn Morris <rgm@gnu.org> 92014-03-22 Glenn Morris <rgm@gnu.org>
2 10
3 * commands.texi (Defining Commands): List interactive-only values. 11 * commands.texi (Defining Commands): List interactive-only values.
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi
index 19386d638fe..51b87ab1e5b 100644
--- a/doc/lispref/markers.texi
+++ b/doc/lispref/markers.texi
@@ -344,12 +344,10 @@ specify the insertion type, create them with insertion type
344@section Moving Marker Positions 344@section Moving Marker Positions
345 345
346 This section describes how to change the position of an existing 346 This section describes how to change the position of an existing
347marker. When you do this, be sure you know how the marker is used 347marker. When you do this, be sure you know whether the marker is used
348outside of your program. For example, moving a marker to an unrelated 348outside of your program, and, if so, what effects will result from
349new position can cause undo to later adjust the marker incorrectly. 349moving it---otherwise, confusing things may happen in other parts of
350Often when you wish to relocate a marker to an unrelated position, it 350Emacs.
351is preferable to make a new marker and set the prior one to point
352nowhere.
353 351
354@defun set-marker marker position &optional buffer 352@defun set-marker marker position &optional buffer
355This function moves @var{marker} to @var{position} 353This function moves @var{marker} to @var{position}
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index f8a3e873449..7c5603fd645 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -1270,7 +1270,8 @@ This kind of element indicates how to reinsert text that was deleted.
1270The deleted text itself is the string @var{text}. The place to 1270The deleted text itself is the string @var{text}. The place to
1271reinsert it is @code{(abs @var{position})}. If @var{position} is 1271reinsert it is @code{(abs @var{position})}. If @var{position} is
1272positive, point was at the beginning of the deleted text, otherwise it 1272positive, point was at the beginning of the deleted text, otherwise it
1273was at the end. 1273was at the end. Zero or more (@var{marker} . @var{adjustment})
1274elements follow immediately after this element.
1274 1275
1275@item (t . @var{time-flag}) 1276@item (t . @var{time-flag})
1276This kind of element indicates that an unmodified buffer became 1277This kind of element indicates that an unmodified buffer became
@@ -1296,8 +1297,10 @@ Here's how you might undo the change:
1296@item (@var{marker} . @var{adjustment}) 1297@item (@var{marker} . @var{adjustment})
1297This kind of element records the fact that the marker @var{marker} was 1298This kind of element records the fact that the marker @var{marker} was
1298relocated due to deletion of surrounding text, and that it moved 1299relocated due to deletion of surrounding text, and that it moved
1299@var{adjustment} character positions. Undoing this element moves 1300@var{adjustment} character positions. If the marker's location is
1300@var{marker} @minus{} @var{adjustment} characters. 1301consistent with the (@var{text} . @var{position}) element preceding it
1302in the undo list, then undoing this element moves @var{marker}
1303@minus{} @var{adjustment} characters.
1301 1304
1302@item (apply @var{funname} . @var{args}) 1305@item (apply @var{funname} . @var{args})
1303This is an extensible undo item, which is undone by calling 1306This is an extensible undo item, which is undone by calling