comparison src/window.c @ 5798:b94d6e89ea5b

Correct a couple of small things with my last change. src/ChangeLog addition: 2014-06-18 Aidan Kehoe <kehoea@parhasard.net> Correct a couple of things in my last change. * extents.h: Make #'delete-extent available. * window.c: * window.c (delete_saved_point): New. * window.c (Fdelete_window): Delete the saved point extents on deletion of the window, since otherwise they will only be garbage-collected when the buffer is. * window.c (Fset_window_buffer): Correct a thinko here, use a saved point when it *hasn't* been detached.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 18 Jun 2014 09:26:54 +0100
parents a1808d52a34a
children
comparison
equal deleted inserted replaced
5797:a1808d52a34a 5798:b94d6e89ea5b
2204 pwindow = XWINDOW (pwindow)->parent; 2204 pwindow = XWINDOW (pwindow)->parent;
2205 } 2205 }
2206 return 0; 2206 return 0;
2207 } 2207 }
2208 2208
2209 static int
2210 delete_saved_point (Lisp_Object UNUSED (buffer), Lisp_Object saved_point,
2211 void *UNUSED (closure))
2212 {
2213 Fdelete_extent (saved_point);
2214 return 0;
2215 }
2216
2209 DEFUN ("delete-window", Fdelete_window, 0, 2, "", /* 2217 DEFUN ("delete-window", Fdelete_window, 0, 2, "", /*
2210 Remove WINDOW from the display. Default is selected window. 2218 Remove WINDOW from the display. Default is selected window.
2211 If window is the only one on its frame, the frame is deleted as well. 2219 If window is the only one on its frame, the frame is deleted as well.
2212 Normally, you cannot delete the last non-minibuffer-only frame (you must 2220 Normally, you cannot delete the last non-minibuffer-only frame (you must
2213 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional 2221 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
2316 unchain_marker (w->start[DESIRED_DISP]); 2324 unchain_marker (w->start[DESIRED_DISP]);
2317 unchain_marker (w->start[CMOTION_DISP]); 2325 unchain_marker (w->start[CMOTION_DISP]);
2318 unchain_marker (w->sb_point); 2326 unchain_marker (w->sb_point);
2319 w->buffer = Qnil; 2327 w->buffer = Qnil;
2320 } 2328 }
2329
2330 /* Delete the saved point extents, since they will still be referenced
2331 from the buffer and thus won't be garbage-collected until the buffer
2332 is. */
2333 elisp_maphash_unsafe (delete_saved_point, w->saved_point_cache, NULL);
2321 2334
2322 /* close up the hole in the sibling list */ 2335 /* close up the hole in the sibling list */
2323 if (!NILP (w->next)) 2336 if (!NILP (w->next))
2324 XWINDOW (w->next)->prev = w->prev; 2337 XWINDOW (w->next)->prev = w->prev;
2325 if (!NILP (w->prev)) 2338 if (!NILP (w->prev))
3723 buffer); 3736 buffer);
3724 #else 3737 #else
3725 { 3738 {
3726 Lisp_Object saved_point = Fgethash (buffer, w->saved_point_cache, Qnil); 3739 Lisp_Object saved_point = Fgethash (buffer, w->saved_point_cache, Qnil);
3727 Lisp_Object newpoint = 3740 Lisp_Object newpoint =
3728 (EXTENTP (saved_point) && !NILP (Fextent_detached_p (saved_point))) 3741 (EXTENTP (saved_point) && NILP (Fextent_detached_p (saved_point)))
3729 ? Fextent_start_position (saved_point) 3742 ? Fextent_start_position (saved_point)
3730 : make_fixnum (BUF_PT (XBUFFER (buffer))); 3743 : make_fixnum (BUF_PT (XBUFFER (buffer)));
3731 Lisp_Object marker; 3744 Lisp_Object marker;
3732 /* Previously, we had in here set-window-point, which did one of the 3745 /* Previously, we had in here set-window-point, which did one of the
3733 following two, but not both. However, that could result in pointm 3746 following two, but not both. However, that could result in pointm