Commit 549c3414 authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

* editfns.c (save_excursion_save): Use nil if mark points to nowhere.

(save_excursion_restore): Do not restore mark if it was not saved.
parent d3e42285
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> 2012-10-11 Paul Eggert <eggert@cs.ucla.edu>
   
* marker.c (cached_modiff): EMACS_INT, not int. * marker.c (cached_modiff): EMACS_INT, not int.
......
...@@ -819,9 +819,13 @@ save_excursion_save (void) ...@@ -819,9 +819,13 @@ save_excursion_save (void)
{ {
bool visible = (XBUFFER (XWINDOW (selected_window)->buffer) bool visible = (XBUFFER (XWINDOW (selected_window)->buffer)
== current_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 (), return Fcons (Fpoint_marker (),
Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil), Fcons (mark,
Fcons (visible ? Qt : Qnil, Fcons (visible ? Qt : Qnil,
Fcons (BVAR (current_buffer, mark_active), Fcons (BVAR (current_buffer, mark_active),
selected_window)))); selected_window))));
...@@ -856,9 +860,14 @@ save_excursion_restore (Lisp_Object info) ...@@ -856,9 +860,14 @@ save_excursion_restore (Lisp_Object info)
info = XCDR (info); info = XCDR (info);
tem = XCAR (info); tem = XCAR (info);
omark = Fmarker_position (BVAR (current_buffer, mark)); omark = Fmarker_position (BVAR (current_buffer, mark));
Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ()); if (NILP (tem))
nmark = Fmarker_position (tem); unchain_marker (XMARKER (BVAR (current_buffer, mark)));
unchain_marker (XMARKER (tem)); else
{
Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ());
nmark = Fmarker_position (tem);
unchain_marker (XMARKER (tem));
}
/* visible */ /* visible */
info = XCDR (info); info = XCDR (info);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment