comparison src/window.c @ 5923:61d7d7bcbe76 cygwin

merged heads after pull -u
author Henry Thompson <ht@markup.co.uk>
date Thu, 05 Feb 2015 17:19:05 +0000
parents b94d6e89ea5b
children
comparison
equal deleted inserted replaced
5921:68639fb08af8 5923:61d7d7bcbe76
39 39
40 #include "buffer.h" 40 #include "buffer.h"
41 #include "commands.h" 41 #include "commands.h"
42 #include "device-impl.h" 42 #include "device-impl.h"
43 #include "elhash.h" 43 #include "elhash.h"
44 #include "extents.h"
44 #include "faces.h" 45 #include "faces.h"
45 #include "frame-impl.h" 46 #include "frame-impl.h"
46 #include "glyphs.h" 47 #include "glyphs.h"
47 #include "gutter.h" 48 #include "gutter.h"
48 #include "fontcolor.h" 49 #include "fontcolor.h"
2045 (BUF_BEGV (b), 2046 (BUF_BEGV (b),
2046 marker_position (w->pointm[CURRENT_DISP]), 2047 marker_position (w->pointm[CURRENT_DISP]),
2047 BUF_ZV (b))); 2048 BUF_ZV (b)));
2048 2049
2049 { 2050 {
2050 Lisp_Object marker = Fgethash (buf, w->saved_point_cache, Qnil); 2051 Lisp_Object marker;
2052 Lisp_Object saved_point = Fgethash (buf, w->saved_point_cache, Qnil);
2051 int selected = EQ (wrap_window (w), Fselected_window (Qnil)); 2053 int selected = EQ (wrap_window (w), Fselected_window (Qnil));
2052 2054
2053 if (NILP (marker)) 2055 if (NILP (saved_point))
2054 { 2056 {
2055 marker = Fmake_marker (); 2057 saved_point = Fmake_extent (Qnil, Qnil, buf);
2056 Fputhash (buf, marker, w->saved_point_cache); 2058 Fset_extent_property (saved_point, Qstart_open, Qt);
2059 Fputhash (buf, saved_point, w->saved_point_cache);
2057 } 2060 }
2058 Fset_marker (marker, 2061
2059 selected ? make_fixnum (BUF_PT (b)) : w->pointm[CURRENT_DISP], 2062 if (selected)
2060 buf); 2063 {
2064 set_extent_endpoints (XEXTENT (saved_point),
2065 BYTE_BUF_PT (b), BYTE_BUF_PT (b), buf);
2066 }
2067 else
2068 {
2069 set_extent_endpoints (XEXTENT (saved_point),
2070 byte_marker_position (w->pointm[CURRENT_DISP]),
2071 byte_marker_position (w->pointm[CURRENT_DISP]),
2072 buf);
2073 }
2061 2074
2062 marker = Fgethash (buf, w->saved_last_window_start_cache, Qnil); 2075 marker = Fgethash (buf, w->saved_last_window_start_cache, Qnil);
2063 2076
2064 if (NILP (marker)) 2077 if (NILP (marker))
2065 { 2078 {
2189 if (EQ (window, pwindow)) 2202 if (EQ (window, pwindow))
2190 return 1; 2203 return 1;
2191 pwindow = XWINDOW (pwindow)->parent; 2204 pwindow = XWINDOW (pwindow)->parent;
2192 } 2205 }
2193 return 0; 2206 return 0;
2207 }
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;
2194 } 2215 }
2195 2216
2196 DEFUN ("delete-window", Fdelete_window, 0, 2, "", /* 2217 DEFUN ("delete-window", Fdelete_window, 0, 2, "", /*
2197 Remove WINDOW from the display. Default is selected window. 2218 Remove WINDOW from the display. Default is selected window.
2198 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.
2303 unchain_marker (w->start[DESIRED_DISP]); 2324 unchain_marker (w->start[DESIRED_DISP]);
2304 unchain_marker (w->start[CMOTION_DISP]); 2325 unchain_marker (w->start[CMOTION_DISP]);
2305 unchain_marker (w->sb_point); 2326 unchain_marker (w->sb_point);
2306 w->buffer = Qnil; 2327 w->buffer = Qnil;
2307 } 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);
2308 2334
2309 /* close up the hole in the sibling list */ 2335 /* close up the hole in the sibling list */
2310 if (!NILP (w->next)) 2336 if (!NILP (w->next))
2311 XWINDOW (w->next)->prev = w->prev; 2337 XWINDOW (w->next)->prev = w->prev;
2312 if (!NILP (w->prev)) 2338 if (!NILP (w->prev))
3708 set_marker_restricted (w->start[CURRENT_DISP], 3734 set_marker_restricted (w->start[CURRENT_DISP],
3709 make_fixnum (XBUFFER (buffer)->last_window_start), 3735 make_fixnum (XBUFFER (buffer)->last_window_start),
3710 buffer); 3736 buffer);
3711 #else 3737 #else
3712 { 3738 {
3713 Lisp_Object marker = Fgethash (buffer, w->saved_point_cache, Qnil); 3739 Lisp_Object saved_point = Fgethash (buffer, w->saved_point_cache, Qnil);
3714 Lisp_Object newpoint = 3740 Lisp_Object newpoint =
3715 !NILP (marker) ? make_fixnum (marker_position (marker)) : 3741 (EXTENTP (saved_point) && NILP (Fextent_detached_p (saved_point)))
3716 make_fixnum (BUF_PT (XBUFFER (buffer))); 3742 ? Fextent_start_position (saved_point)
3743 : make_fixnum (BUF_PT (XBUFFER (buffer)));
3744 Lisp_Object marker;
3717 /* 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
3718 following two, but not both. However, that could result in pointm 3746 following two, but not both. However, that could result in pointm
3719 being in a different buffer from the window's buffer! Probably 3747 being in a different buffer from the window's buffer! Probably
3720 not a travesty since it always occurred when the window was 3748 not a travesty since it always occurred when the window was
3721 selected, meaning its value of point was ignored in favor of the 3749 selected, meaning its value of point was ignored in favor of the