+2012-10-11 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * editfns.c (save_excursion_save): Use nil if mark points to nowhere.
+ (save_excursion_restore): Do not restore mark if it was not saved.
+
2012-10-11 Paul Eggert <eggert@cs.ucla.edu>
* marker.c (cached_modiff): EMACS_INT, not int.
{
bool visible = (XBUFFER (XWINDOW (selected_window)->buffer)
== current_buffer);
+ /* Do not copy the mark if it points to nowhere. */
+ Lisp_Object mark = (XMARKER (BVAR (current_buffer, mark))->buffer
+ ? Fcopy_marker (BVAR (current_buffer, mark), Qnil)
+ : Qnil);
return Fcons (Fpoint_marker (),
- Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil),
+ Fcons (mark,
Fcons (visible ? Qt : Qnil,
Fcons (BVAR (current_buffer, mark_active),
selected_window))));
info = XCDR (info);
tem = XCAR (info);
omark = Fmarker_position (BVAR (current_buffer, mark));
- Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ());
- nmark = Fmarker_position (tem);
- unchain_marker (XMARKER (tem));
+ if (NILP (tem))
+ unchain_marker (XMARKER (BVAR (current_buffer, mark)));
+ else
+ {
+ Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ());
+ nmark = Fmarker_position (tem);
+ unchain_marker (XMARKER (tem));
+ }
/* visible */
info = XCDR (info);