diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/fileio.c | 11 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b1f13e62b40..4b1281c17e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-05-29 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * fileio.c (Finsert_file_contents): Preserve undo info when reverting | ||
| 4 | a buffer (bug#8447). | ||
| 5 | |||
| 1 | 2013-05-27 Eli Zaretskii <eliz@gnu.org> | 6 | 2013-05-27 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * xdisp.c (pos_visible_p): When CHARPOS is displayed frrom a | 8 | * xdisp.c (pos_visible_p): When CHARPOS is displayed frrom a |
| @@ -25,8 +30,8 @@ | |||
| 25 | (struct MonitorInfo): New struct. | 30 | (struct MonitorInfo): New struct. |
| 26 | (free_monitors, make_monitor_attribute_list): Declare. | 31 | (free_monitors, make_monitor_attribute_list): Declare. |
| 27 | 32 | ||
| 28 | * frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): New | 33 | * frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): |
| 29 | Lisp_Object:s. | 34 | New Lisp_Object:s. |
| 30 | (free_monitors, make_monitor_attribute_list): New functions. | 35 | (free_monitors, make_monitor_attribute_list): New functions. |
| 31 | (syms_of_frame): DEFSYM Qgeometry, Qworkarea, Qmm_size, Qframes, | 36 | (syms_of_frame): DEFSYM Qgeometry, Qworkarea, Qmm_size, Qframes, |
| 32 | Qsource. | 37 | Qsource. |
diff --git a/src/fileio.c b/src/fileio.c index f20721251e6..e2b1007fb0b 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3506,6 +3506,11 @@ by calling `format-decode', which see. */) | |||
| 3506 | bool set_coding_system = 0; | 3506 | bool set_coding_system = 0; |
| 3507 | Lisp_Object coding_system; | 3507 | Lisp_Object coding_system; |
| 3508 | bool read_quit = 0; | 3508 | bool read_quit = 0; |
| 3509 | /* If the undo log only contains the insertion, there's no point | ||
| 3510 | keeping it. It's typically when we first fill a file-buffer. */ | ||
| 3511 | bool empty_undo_list_p | ||
| 3512 | = (!NILP (visit) && NILP (BVAR (current_buffer, undo_list)) | ||
| 3513 | && BEG == Z); | ||
| 3509 | Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark; | 3514 | Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark; |
| 3510 | bool we_locked_file = 0; | 3515 | bool we_locked_file = 0; |
| 3511 | bool deferred_remove_unwind_protect = 0; | 3516 | bool deferred_remove_unwind_protect = 0; |
| @@ -4108,6 +4113,7 @@ by calling `format-decode', which see. */) | |||
| 4108 | { | 4113 | { |
| 4109 | del_range_byte (same_at_start, same_at_end, 0); | 4114 | del_range_byte (same_at_start, same_at_end, 0); |
| 4110 | temp = GPT; | 4115 | temp = GPT; |
| 4116 | eassert (same_at_start == GPT_BYTE); | ||
| 4111 | same_at_start = GPT_BYTE; | 4117 | same_at_start = GPT_BYTE; |
| 4112 | } | 4118 | } |
| 4113 | else | 4119 | else |
| @@ -4120,6 +4126,7 @@ by calling `format-decode', which see. */) | |||
| 4120 | = buf_bytepos_to_charpos (XBUFFER (conversion_buffer), | 4126 | = buf_bytepos_to_charpos (XBUFFER (conversion_buffer), |
| 4121 | same_at_start - BEGV_BYTE | 4127 | same_at_start - BEGV_BYTE |
| 4122 | + BUF_BEG_BYTE (XBUFFER (conversion_buffer))); | 4128 | + BUF_BEG_BYTE (XBUFFER (conversion_buffer))); |
| 4129 | eassert (same_at_start_charpos == temp - (BEGV - BEG)); | ||
| 4123 | inserted_chars | 4130 | inserted_chars |
| 4124 | = (buf_bytepos_to_charpos (XBUFFER (conversion_buffer), | 4131 | = (buf_bytepos_to_charpos (XBUFFER (conversion_buffer), |
| 4125 | same_at_start + inserted - BEGV_BYTE | 4132 | same_at_start + inserted - BEGV_BYTE |
| @@ -4404,7 +4411,7 @@ by calling `format-decode', which see. */) | |||
| 4404 | 4411 | ||
| 4405 | if (!NILP (visit)) | 4412 | if (!NILP (visit)) |
| 4406 | { | 4413 | { |
| 4407 | if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) | 4414 | if (empty_undo_list_p) |
| 4408 | bset_undo_list (current_buffer, Qnil); | 4415 | bset_undo_list (current_buffer, Qnil); |
| 4409 | 4416 | ||
| 4410 | if (NILP (handler)) | 4417 | if (NILP (handler)) |
| @@ -4546,7 +4553,7 @@ by calling `format-decode', which see. */) | |||
| 4546 | p = XCDR (p); | 4553 | p = XCDR (p); |
| 4547 | } | 4554 | } |
| 4548 | 4555 | ||
| 4549 | if (NILP (visit)) | 4556 | if (!empty_undo_list_p) |
| 4550 | { | 4557 | { |
| 4551 | bset_undo_list (current_buffer, old_undo); | 4558 | bset_undo_list (current_buffer, old_undo); |
| 4552 | if (CONSP (old_undo) && inserted != old_inserted) | 4559 | if (CONSP (old_undo) && inserted != old_inserted) |