+2013-05-29 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * fileio.c (Finsert_file_contents): Preserve undo info when reverting
+ a buffer (bug#8447).
+
2013-05-27 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (pos_visible_p): When CHARPOS is displayed frrom a
(struct MonitorInfo): New struct.
(free_monitors, make_monitor_attribute_list): Declare.
- * frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): New
- Lisp_Object:s.
+ * frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource):
+ New Lisp_Object:s.
(free_monitors, make_monitor_attribute_list): New functions.
(syms_of_frame): DEFSYM Qgeometry, Qworkarea, Qmm_size, Qframes,
Qsource.
bool set_coding_system = 0;
Lisp_Object coding_system;
bool read_quit = 0;
+ /* If the undo log only contains the insertion, there's no point
+ keeping it. It's typically when we first fill a file-buffer. */
+ bool empty_undo_list_p
+ = (!NILP (visit) && NILP (BVAR (current_buffer, undo_list))
+ && BEG == Z);
Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark;
bool we_locked_file = 0;
bool deferred_remove_unwind_protect = 0;
{
del_range_byte (same_at_start, same_at_end, 0);
temp = GPT;
+ eassert (same_at_start == GPT_BYTE);
same_at_start = GPT_BYTE;
}
else
= buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
same_at_start - BEGV_BYTE
+ BUF_BEG_BYTE (XBUFFER (conversion_buffer)));
+ eassert (same_at_start_charpos == temp - (BEGV - BEG));
inserted_chars
= (buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
same_at_start + inserted - BEGV_BYTE
if (!NILP (visit))
{
- if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
+ if (empty_undo_list_p)
bset_undo_list (current_buffer, Qnil);
if (NILP (handler))
p = XCDR (p);
}
- if (NILP (visit))
+ if (!empty_undo_list_p)
{
bset_undo_list (current_buffer, old_undo);
if (CONSP (old_undo) && inserted != old_inserted)