Commit 0e1bfd38 authored by Paul Eggert's avatar Paul Eggert

Minor cleanup of save_excursion_restore

* src/editfns.c (save_excursion_restore): Use clearer names
for locals.  Free earlier, removing the need for a label and goto.
parent a0aa1d4e
......@@ -1016,37 +1016,30 @@ save_excursion_save (void)
void
save_excursion_restore (Lisp_Object info)
{
Lisp_Object tem, tem1;
tem = Fmarker_buffer (XSAVE_OBJECT (info, 0));
Lisp_Object marker = XSAVE_OBJECT (info, 0);
Lisp_Object window = XSAVE_OBJECT (info, 2);
free_misc (info);
Lisp_Object buffer = Fmarker_buffer (marker);
/* If we're unwinding to top level, saved buffer may be deleted. This
means that all of its markers are unchained and so tem is nil. */
if (NILP (tem))
goto out;
means that all of its markers are unchained and so BUFFER is nil. */
if (NILP (buffer))
return;
Fset_buffer (tem);
Fset_buffer (buffer);
/* Point marker. */
tem = XSAVE_OBJECT (info, 0);
Fgoto_char (tem);
unchain_marker (XMARKER (tem));
Fgoto_char (marker);
unchain_marker (XMARKER (marker));
/* If buffer was visible in a window, and a different window was
selected, and the old selected window is still showing this
buffer, restore point in that window. */
tem = XSAVE_OBJECT (info, 2);
if (WINDOWP (tem)
&& !EQ (tem, selected_window)
&& (tem1 = XWINDOW (tem)->contents,
(/* Window is live... */
BUFFERP (tem1)
/* ...and it shows the current buffer. */
&& XBUFFER (tem1) == current_buffer)))
Fset_window_point (tem, make_number (PT));
out:
free_misc (info);
if (WINDOWP (window) && !EQ (window, selected_window))
{
/* Set window point if WINDOW is live and shows the current buffer. */
Lisp_Object contents = XWINDOW (window)->contents;
if (BUFFERP (contents) && XBUFFER (contents) == current_buffer)
Fset_window_point (window, make_number (PT));
}
}
DEFUN ("save-excursion", Fsave_excursion, Ssave_excursion, 0, UNEVALLED, 0,
......
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