summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2008-01-20 10:34:18 +0000
committerMartin Rudalics <rudalics@gmx.at>2008-01-20 10:34:18 +0000
commit8abe0f97764a932f9e15863a93014fefff484ed6 (patch)
tree1e9083eddcf7aa3bb69863aaa2f3142511205892
parent0b6799c345f8b7ffd5295fce000c615928ab7cde (diff)
downloademacs-8abe0f97764a932f9e15863a93014fefff484ed6.tar.gz
(undo_inhibit_record_point): New variable.
(syms_of_undo): Initialize it. (record_point): Don't record point when undo_inhibit_record_point is set.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/undo.c18
2 files changed, 24 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0667c484acb..73a1164915e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-20 Martin Rudalics <rudalics@gmx.at>
+
+ * undo.c (undo_inhibit_record_point): New variable.
+ (syms_of_undo): Initialize it.
+ (record_point): Don't record point when undo_inhibit_record_point
+ is set.
+
2008-01-19 Stefan Monnier <monnier@iro.umontreal.ca>
* process.c (list_processes_1): Don't use SCHARS on a nil buffer name.
diff --git a/src/undo.c b/src/undo.c
index bf528e23935..77590e4ace8 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -53,8 +53,12 @@ Lisp_Object Qapply;
an undo-boundary. */
Lisp_Object pending_boundary;
+/* Nonzero means do not record point in record_point. */
+
+int undo_inhibit_record_point;
+
/* Record point as it was at beginning of this command (if necessary)
- And prepare the undo info for recording a change.
+ and prepare the undo info for recording a change.
PT is the position of point that will naturally occur as a result of the
undo record that will be added just after this command terminates. */
@@ -64,6 +68,14 @@ record_point (pt)
{
int at_boundary;
+ /* Don't record position of pt when undo_inhibit_record_point holds.
+ Needed to avoid inserting a position record in buffer-undo-list
+ when last_point_position has not been set up correctly by
+ command_loop_1, for example, when running a repeat-repeat-char
+ event. */
+ if (undo_inhibit_record_point)
+ return;
+
/* Allocate a cons cell to be the undo boundary after this command. */
if (NILP (pending_boundary))
pending_boundary = Fcons (Qnil, Qnil);
@@ -719,6 +731,10 @@ If it returns nil, the other forms of truncation are done.
Garbage collection is inhibited around the call to this function,
so it must make sure not to do a lot of consing. */);
Vundo_outer_limit_function = Qnil;
+
+ DEFVAR_BOOL ("undo-inhibit-record-point", &undo_inhibit_record_point,
+ doc: /* Non-nil means do not record `point' in `buffer-undo-list'. */);
+ undo_inhibit_record_point = 0;
}
/* arch-tag: d546ee01-4aed-4ffb-bb8b-eefaae50d38a