diff options
Diffstat (limited to 'src/undo.c')
| -rw-r--r-- | src/undo.c | 18 |
1 files changed, 17 insertions, 1 deletions
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; | |||
| 53 | an undo-boundary. */ | 53 | an undo-boundary. */ |
| 54 | Lisp_Object pending_boundary; | 54 | Lisp_Object pending_boundary; |
| 55 | 55 | ||
| 56 | /* Nonzero means do not record point in record_point. */ | ||
| 57 | |||
| 58 | int undo_inhibit_record_point; | ||
| 59 | |||
| 56 | /* Record point as it was at beginning of this command (if necessary) | 60 | /* Record point as it was at beginning of this command (if necessary) |
| 57 | And prepare the undo info for recording a change. | 61 | and prepare the undo info for recording a change. |
| 58 | PT is the position of point that will naturally occur as a result of the | 62 | PT is the position of point that will naturally occur as a result of the |
| 59 | undo record that will be added just after this command terminates. */ | 63 | undo record that will be added just after this command terminates. */ |
| 60 | 64 | ||
| @@ -64,6 +68,14 @@ record_point (pt) | |||
| 64 | { | 68 | { |
| 65 | int at_boundary; | 69 | int at_boundary; |
| 66 | 70 | ||
| 71 | /* Don't record position of pt when undo_inhibit_record_point holds. | ||
| 72 | Needed to avoid inserting a position record in buffer-undo-list | ||
| 73 | when last_point_position has not been set up correctly by | ||
| 74 | command_loop_1, for example, when running a repeat-repeat-char | ||
| 75 | event. */ | ||
| 76 | if (undo_inhibit_record_point) | ||
| 77 | return; | ||
| 78 | |||
| 67 | /* Allocate a cons cell to be the undo boundary after this command. */ | 79 | /* Allocate a cons cell to be the undo boundary after this command. */ |
| 68 | if (NILP (pending_boundary)) | 80 | if (NILP (pending_boundary)) |
| 69 | pending_boundary = Fcons (Qnil, Qnil); | 81 | pending_boundary = Fcons (Qnil, Qnil); |
| @@ -719,6 +731,10 @@ If it returns nil, the other forms of truncation are done. | |||
| 719 | Garbage collection is inhibited around the call to this function, | 731 | Garbage collection is inhibited around the call to this function, |
| 720 | so it must make sure not to do a lot of consing. */); | 732 | so it must make sure not to do a lot of consing. */); |
| 721 | Vundo_outer_limit_function = Qnil; | 733 | Vundo_outer_limit_function = Qnil; |
| 734 | |||
| 735 | DEFVAR_BOOL ("undo-inhibit-record-point", &undo_inhibit_record_point, | ||
| 736 | doc: /* Non-nil means do not record `point' in `buffer-undo-list'. */); | ||
| 737 | undo_inhibit_record_point = 0; | ||
| 722 | } | 738 | } |
| 723 | 739 | ||
| 724 | /* arch-tag: d546ee01-4aed-4ffb-bb8b-eefaae50d38a | 740 | /* arch-tag: d546ee01-4aed-4ffb-bb8b-eefaae50d38a |