# HG changeset patch # User Aidan Kehoe # Date 1403080014 -3600 # Node ID b94d6e89ea5b88a2e428575dac03d665ca21bf0b # Parent a1808d52a34a15175e99534534b4a3668135bbda Correct a couple of small things with my last change. src/ChangeLog addition: 2014-06-18 Aidan Kehoe 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. diff -r a1808d52a34a -r b94d6e89ea5b src/ChangeLog --- a/src/ChangeLog Tue Jun 17 20:55:45 2014 +0100 +++ b/src/ChangeLog Wed Jun 18 09:26:54 2014 +0100 @@ -1,3 +1,16 @@ +2014-06-18 Aidan Kehoe + + 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. + 2014-06-17 Aidan Kehoe * extents.h: diff -r a1808d52a34a -r b94d6e89ea5b src/extents.h --- a/src/extents.h Tue Jun 17 20:55:45 2014 +0100 +++ b/src/extents.h Wed Jun 18 09:26:54 2014 +0100 @@ -133,6 +133,7 @@ EXFUN (Fput_text_property, 5); EXFUN (Fextent_detached_p, 1); +EXFUN (Fdelete_extent, 1); EXFUN (Fdetach_extent, 1); EXFUN (Fextent_end_position, 1); EXFUN (Fextent_object, 1); diff -r a1808d52a34a -r b94d6e89ea5b src/window.c --- a/src/window.c Tue Jun 17 20:55:45 2014 +0100 +++ b/src/window.c Wed Jun 18 09:26:54 2014 +0100 @@ -2206,6 +2206,14 @@ return 0; } +static int +delete_saved_point (Lisp_Object UNUSED (buffer), Lisp_Object saved_point, + void *UNUSED (closure)) +{ + Fdelete_extent (saved_point); + return 0; +} + DEFUN ("delete-window", Fdelete_window, 0, 2, "", /* Remove WINDOW from the display. Default is selected window. If window is the only one on its frame, the frame is deleted as well. @@ -2319,6 +2327,11 @@ w->buffer = Qnil; } + /* Delete the saved point extents, since they will still be referenced + from the buffer and thus won't be garbage-collected until the buffer + is. */ + elisp_maphash_unsafe (delete_saved_point, w->saved_point_cache, NULL); + /* close up the hole in the sibling list */ if (!NILP (w->next)) XWINDOW (w->next)->prev = w->prev; @@ -3725,7 +3738,7 @@ { Lisp_Object saved_point = Fgethash (buffer, w->saved_point_cache, Qnil); Lisp_Object newpoint = - (EXTENTP (saved_point) && !NILP (Fextent_detached_p (saved_point))) + (EXTENTP (saved_point) && NILP (Fextent_detached_p (saved_point))) ? Fextent_start_position (saved_point) : make_fixnum (BUF_PT (XBUFFER (buffer))); Lisp_Object marker;