Mercurial > hg > xemacs-beta
comparison src/window.c @ 371:cc15677e0335 r21-2b1
Import from CVS: tag r21-2b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:03:08 +0200 |
parents | a4f53d9b3154 |
children | 6240c7796c7a |
comparison
equal
deleted
inserted
replaced
370:bd866891f083 | 371:cc15677e0335 |
---|---|
78 Lisp_Object Vvertical_divider_shadow_thickness; | 78 Lisp_Object Vvertical_divider_shadow_thickness; |
79 | 79 |
80 /* Divider surface width (not counting 3-d borders) */ | 80 /* Divider surface width (not counting 3-d borders) */ |
81 Lisp_Object Vvertical_divider_line_width; | 81 Lisp_Object Vvertical_divider_line_width; |
82 | 82 |
83 /* Spacing between outer edge of divider border and window edge */ | 83 /* Spacing between outer egde of divider border and window edge */ |
84 Lisp_Object Vvertical_divider_spacing; | 84 Lisp_Object Vvertical_divider_spacing; |
85 | 85 |
86 /* Scroll if point lands on the bottom line and that line is partially | 86 /* Scroll if point lands on the bottom line and that line is partially |
87 clipped. */ | 87 clipped. */ |
88 int scroll_on_clipped_lines; | 88 int scroll_on_clipped_lines; |
699 #endif | 699 #endif |
700 | 700 |
701 int | 701 int |
702 window_truncation_on (struct window *w) | 702 window_truncation_on (struct window *w) |
703 { | 703 { |
704 /* Minibuffer windows are never truncated. | |
705 ### is this the right way ? */ | |
706 if (EQ (w->mini_p, Qt)) | |
707 return 0; | |
708 | |
709 /* Horizontally scrolled windows are truncated. */ | 704 /* Horizontally scrolled windows are truncated. */ |
710 if (w->hscroll) | 705 if (w->hscroll) |
711 return 1; | 706 return 1; |
712 | 707 |
713 /* If truncate_partial_width_windows is true and the window is not | 708 /* If truncate_partial_width_windows is true and the window is not |
721 if (!NILP (XBUFFER (w->buffer)->truncate_lines)) | 716 if (!NILP (XBUFFER (w->buffer)->truncate_lines)) |
722 return 1; | 717 return 1; |
723 | 718 |
724 return 0; | 719 return 0; |
725 } | 720 } |
726 | |
727 DEFUN ("window-truncated-p", Fwindow_truncated_p, 0, 1, 0, /* | |
728 Returns Non-Nil iff the window is truncated. | |
729 */ | |
730 (window)) | |
731 { | |
732 struct window *w = decode_window (window); | |
733 | |
734 return window_truncation_on (w) ? Qt : Qnil; | |
735 } | |
736 | |
737 | 721 |
738 static int | 722 static int |
739 have_undivided_common_edge (struct window *w_right, void *closure) | 723 have_undivided_common_edge (struct window *w_right, void *closure) |
740 { | 724 { |
741 struct window *w_left = (struct window *) closure; | 725 struct window *w_left = (struct window *) closure; |
1355 line_start_cache_dynarr *cache; | 1339 line_start_cache_dynarr *cache; |
1356 | 1340 |
1357 if (NILP (window)) | 1341 if (NILP (window)) |
1358 window = Fselected_window (Qnil); | 1342 window = Fselected_window (Qnil); |
1359 | 1343 |
1360 CHECK_LIVE_WINDOW (window); | 1344 CHECK_WINDOW (window); |
1361 w = XWINDOW (window); | 1345 w = XWINDOW (window); |
1362 | 1346 |
1363 start = marker_position (w->start[CURRENT_DISP]); | 1347 start = marker_position (w->start[CURRENT_DISP]); |
1364 hlimit = WINDOW_TEXT_HEIGHT (w); | 1348 hlimit = WINDOW_TEXT_HEIGHT (w); |
1365 eobuf = BUF_ZV (XBUFFER (w->buffer)); | 1349 eobuf = BUF_ZV (XBUFFER (w->buffer)); |
1560 make_int (bottom)); | 1544 make_int (bottom)); |
1561 } | 1545 } |
1562 | 1546 |
1563 DEFUN ("window-point", Fwindow_point, 0, 1, 0, /* | 1547 DEFUN ("window-point", Fwindow_point, 0, 1, 0, /* |
1564 Return current value of point in WINDOW. | 1548 Return current value of point in WINDOW. |
1565 For a non-selected window, this is the value point would have | 1549 For a nonselected window, this is the value point would have |
1566 if that window were selected. | 1550 if that window were selected. |
1567 | 1551 |
1568 Note that, when WINDOW is the selected window and its buffer | 1552 Note that, when WINDOW is the selected window and its buffer |
1569 is also currently selected, the value returned is the same as (point). | 1553 is also currently selected, the value returned is the same as (point). |
1570 It would be more strictly correct to return the `top-level' value | 1554 It would be more strictly correct to return the `top-level' value |
1647 struct window *w = decode_window (window); | 1631 struct window *w = decode_window (window); |
1648 | 1632 |
1649 CHECK_INT_COERCE_MARKER (pos); | 1633 CHECK_INT_COERCE_MARKER (pos); |
1650 set_marker_restricted (w->start[CURRENT_DISP], pos, w->buffer); | 1634 set_marker_restricted (w->start[CURRENT_DISP], pos, w->buffer); |
1651 /* this is not right, but much easier than doing what is right. */ | 1635 /* this is not right, but much easier than doing what is right. */ |
1652 /* w->start_at_line_beg = 0; */ | 1636 w->start_at_line_beg = 0; |
1653 /* WTF is the above supposed to mean? GE */ | |
1654 w->start_at_line_beg = beginning_of_line_p (XBUFFER (w->buffer), | |
1655 marker_position (w->start[CURRENT_DISP])); | |
1656 if (NILP (noforce)) | 1637 if (NILP (noforce)) |
1657 w->force_start = 1; | 1638 w->force_start = 1; |
1658 w->redo_modeline = 1; | 1639 w->redo_modeline = 1; |
1659 SET_LAST_MODIFIED (w, 0); | 1640 SET_LAST_MODIFIED (w, 0); |
1660 SET_LAST_FACECHANGE (w); | 1641 SET_LAST_FACECHANGE (w); |
1978 return Qnil; | 1959 return Qnil; |
1979 } | 1960 } |
1980 | 1961 |
1981 | 1962 |
1982 DEFUN ("next-window", Fnext_window, 0, 4, 0, /* | 1963 DEFUN ("next-window", Fnext_window, 0, 4, 0, /* |
1983 Return the next window after WINDOW in the canonical ordering of windows. | 1964 Return next window after WINDOW in canonical ordering of windows. |
1984 If omitted, WINDOW defaults to the selected window. | 1965 If omitted, WINDOW defaults to the selected window. |
1985 | 1966 |
1986 Optional second arg MINIBUF t means count the minibuffer window even | 1967 Optional second arg MINIBUF t means count the minibuffer window even |
1987 if not active. MINIBUF nil or omitted means count the minibuffer iff | 1968 if not active. MINIBUF nil or omitted means count the minibuffer iff |
1988 it is active. MINIBUF neither t nor nil means not to count the | 1969 it is active. MINIBUF neither t nor nil means not to count the |
1999 above. ALL-FRAMES = `visible' means include windows on all visible frames. | 1980 above. ALL-FRAMES = `visible' means include windows on all visible frames. |
2000 ALL-FRAMES = 0 means include windows on all visible and iconified frames. | 1981 ALL-FRAMES = 0 means include windows on all visible and iconified frames. |
2001 If ALL-FRAMES is a frame, restrict search to windows on that frame. | 1982 If ALL-FRAMES is a frame, restrict search to windows on that frame. |
2002 Anything else means restrict to WINDOW's frame. | 1983 Anything else means restrict to WINDOW's frame. |
2003 | 1984 |
2004 Optional fourth arg CONSOLE controls which consoles or devices the | 1985 Optional fourth argument CONSOLE controls which consoles or devices the |
2005 returned window may be on. If CONSOLE is a console, return windows only | 1986 returned window may be on. If CONSOLE is a console, return windows only |
2006 on that console. If CONSOLE is a device, return windows only on that | 1987 on that console. If CONSOLE is a device, return windows only on that |
2007 device. If CONSOLE is a console type, return windows only on consoles | 1988 device. If CONSOLE is a console type, return windows only on consoles |
2008 of that type. If CONSOLE is 'window-system, return any windows on any | 1989 of that type. If CONSOLE is 'window-system, return any windows on any |
2009 window-system consoles. If CONSOLE is nil or omitted, return windows only | 1990 window-system consoles. If CONSOLE is nil or omitted, return windows only |
2030 Decide if it does. */ | 2011 Decide if it does. */ |
2031 if (NILP (minibuf)) | 2012 if (NILP (minibuf)) |
2032 minibuf = (minibuf_level ? minibuf_window : Qlambda); | 2013 minibuf = (minibuf_level ? minibuf_window : Qlambda); |
2033 else if (! EQ (minibuf, Qt)) | 2014 else if (! EQ (minibuf, Qt)) |
2034 minibuf = Qlambda; | 2015 minibuf = Qlambda; |
2035 /* Now `minibuf' is one of: | 2016 /* Now minibuf can be t => count all minibuffer windows, |
2036 t => count all minibuffer windows | 2017 lambda => count none of them, |
2037 lambda => count none of them | |
2038 or a specific minibuffer window (the active one) to count. */ | 2018 or a specific minibuffer window (the active one) to count. */ |
2039 | 2019 |
2040 /* all_frames == nil doesn't specify which frames to include. */ | 2020 /* all_frames == nil doesn't specify which frames to include. */ |
2041 if (NILP (all_frames)) | 2021 if (NILP (all_frames)) |
2042 all_frames = (! EQ (minibuf, Qlambda) | 2022 all_frames = (! EQ (minibuf, Qlambda) |
2053 /* If all_frames is a frame and window arg isn't on that frame, just | 2033 /* If all_frames is a frame and window arg isn't on that frame, just |
2054 return the first window on the frame. */ | 2034 return the first window on the frame. */ |
2055 return frame_first_window (XFRAME (all_frames)); | 2035 return frame_first_window (XFRAME (all_frames)); |
2056 else if (! EQ (all_frames, Qt)) | 2036 else if (! EQ (all_frames, Qt)) |
2057 all_frames = Qnil; | 2037 all_frames = Qnil; |
2058 /* Now `all_frames' is one of: | 2038 /* Now all_frames is t meaning search all frames, |
2059 t => search all frames | 2039 nil meaning search just current frame, |
2060 nil => search just the current frame | 2040 visible meaning search just visible frames, |
2061 visible => search just visible frames | 2041 0 meaning search visible and iconified frames, |
2062 0 => search visible and iconified frames | 2042 or a window, meaning search the frame that window belongs to. */ |
2063 a window => search the frame that window belongs to. */ | |
2064 | 2043 |
2065 /* Do this loop at least once, to get the next window, and perhaps | 2044 /* Do this loop at least once, to get the next window, and perhaps |
2066 again, if we hit the minibuffer and that is not acceptable. */ | 2045 again, if we hit the minibuffer and that is not acceptable. */ |
2067 do | 2046 do |
2068 { | 2047 { |
2077 Which other frames are acceptable? */ | 2056 Which other frames are acceptable? */ |
2078 tem = WINDOW_FRAME (XWINDOW (window)); | 2057 tem = WINDOW_FRAME (XWINDOW (window)); |
2079 | 2058 |
2080 if (! NILP (all_frames)) | 2059 if (! NILP (all_frames)) |
2081 { | 2060 { |
2082 Lisp_Object tem1 = tem; | 2061 Lisp_Object tem1; |
2062 | |
2063 tem1 = tem; | |
2083 tem = next_frame (tem, all_frames, console); | 2064 tem = next_frame (tem, all_frames, console); |
2084 | |
2085 /* In the case where the minibuffer is active, | 2065 /* In the case where the minibuffer is active, |
2086 and we include its frame as well as the selected one, | 2066 and we include its frame as well as the selected one, |
2087 next_frame may get stuck in that frame. | 2067 next_frame may get stuck in that frame. |
2088 If that happens, go back to the selected frame | 2068 If that happens, go back to the selected frame |
2089 so we can complete the cycle. */ | 2069 so we can complete the cycle. */ |
2106 else if (!NILP (XWINDOW (window)->vchild)) | 2086 else if (!NILP (XWINDOW (window)->vchild)) |
2107 window = XWINDOW (window)->vchild; | 2087 window = XWINDOW (window)->vchild; |
2108 else break; | 2088 else break; |
2109 } | 2089 } |
2110 } | 2090 } |
2091 /* "acceptable" is the correct spelling. */ | |
2111 /* Which windows are acceptable? | 2092 /* Which windows are acceptable? |
2112 Exit the loop and accept this window if | 2093 Exit the loop and accept this window if |
2113 this isn't a minibuffer window, | 2094 this isn't a minibuffer window, |
2114 or we're accepting all minibuffer windows, | 2095 or we're accepting all minibuffer windows, |
2115 or this is the active minibuffer and we are accepting that one, or | 2096 or this is the active minibuffer and we are accepting that one, or |
2121 | 2102 |
2122 return window; | 2103 return window; |
2123 } | 2104 } |
2124 | 2105 |
2125 DEFUN ("previous-window", Fprevious_window, 0, 4, 0, /* | 2106 DEFUN ("previous-window", Fprevious_window, 0, 4, 0, /* |
2126 Return the window preceding WINDOW in the canonical ordering of windows. | 2107 Return the window preceding WINDOW in canonical ordering of windows. |
2127 If omitted, WINDOW defaults to the selected window. | 2108 If omitted, WINDOW defaults to the selected window. |
2128 | 2109 |
2129 Optional second arg MINIBUF t means count the minibuffer window even | 2110 Optional second arg MINIBUF t means count the minibuffer window even |
2130 if not active. MINIBUF nil or omitted means count the minibuffer iff | 2111 if not active. MINIBUF nil or omitted means count the minibuffer iff |
2131 it is active. MINIBUF neither t nor nil means not to count the | 2112 it is active. MINIBUF neither t nor nil means not to count the |
2133 | 2114 |
2134 Several frames may share a single minibuffer; if the minibuffer | 2115 Several frames may share a single minibuffer; if the minibuffer |
2135 counts, all windows on all frames that share that minibuffer count | 2116 counts, all windows on all frames that share that minibuffer count |
2136 too. Therefore, `previous-window' can be used to iterate through | 2117 too. Therefore, `previous-window' can be used to iterate through |
2137 the set of windows even when the minibuffer is on another frame. If | 2118 the set of windows even when the minibuffer is on another frame. If |
2138 the minibuffer does not count, only windows from WINDOW's frame count. | 2119 the minibuffer does not count, only windows from WINDOW's frame count |
2139 | 2120 |
2140 Optional third arg ALL-FRAMES t means include windows on all frames. | 2121 If optional third arg ALL-FRAMES t means include windows on all frames. |
2141 ALL-FRAMES nil or omitted means cycle within the frames as specified | 2122 ALL-FRAMES nil or omitted means cycle within the frames as specified |
2142 above. ALL-FRAMES = `visible' means include windows on all visible frames. | 2123 above. ALL-FRAMES = `visible' means include windows on all visible frames. |
2143 ALL-FRAMES = 0 means include windows on all visible and iconified frames. | 2124 ALL-FRAMES = 0 means include windows on all visible and iconified frames. |
2144 If ALL-FRAMES is a frame, restrict search to windows on that frame. | 2125 If ALL-FRAMES is a frame, restrict search to windows on that frame. |
2145 Anything else means restrict to WINDOW's frame. | 2126 Anything else means restrict to WINDOW's frame. |
2146 | 2127 |
2147 Optional fourth arg CONSOLE controls which consoles or devices the | 2128 Optional fourth argument CONSOLE controls which consoles or devices the |
2148 returned window may be on. If CONSOLE is a console, return windows only | 2129 returned window may be on. If CONSOLE is a console, return windows only |
2149 on that console. If CONSOLE is a device, return windows only on that | 2130 on that console. If CONSOLE is a device, return windows only on that |
2150 device. If CONSOLE is a console type, return windows only on consoles | 2131 device. If CONSOLE is a console type, return windows only on consoles |
2151 of that type. If CONSOLE is 'window-system, return any windows on any | 2132 of that type. If CONSOLE is 'window-system, return any windows on any |
2152 window-system consoles. If CONSOLE is nil or omitted, return windows only | 2133 window-system consoles. If CONSOLE is nil or omitted, return windows only |
2173 Decide if it does. */ | 2154 Decide if it does. */ |
2174 if (NILP (minibuf)) | 2155 if (NILP (minibuf)) |
2175 minibuf = (minibuf_level ? minibuf_window : Qlambda); | 2156 minibuf = (minibuf_level ? minibuf_window : Qlambda); |
2176 else if (! EQ (minibuf, Qt)) | 2157 else if (! EQ (minibuf, Qt)) |
2177 minibuf = Qlambda; | 2158 minibuf = Qlambda; |
2178 /* Now `minibuf' is one of: | 2159 /* Now minibuf can be t => count all minibuffer windows, |
2179 t => count all minibuffer windows | 2160 lambda => count none of them, |
2180 lambda => count none of them | |
2181 or a specific minibuffer window (the active one) to count. */ | 2161 or a specific minibuffer window (the active one) to count. */ |
2182 | 2162 |
2183 /* all_frames == nil doesn't specify which frames to include. | 2163 /* all_frames == nil doesn't specify which frames to include. |
2184 Decide which frames it includes. */ | 2164 Decide which frames it includes. */ |
2185 if (NILP (all_frames)) | 2165 if (NILP (all_frames)) |
2197 /* If all_frames is a frame and window arg isn't on that frame, just | 2177 /* If all_frames is a frame and window arg isn't on that frame, just |
2198 return the first window on the frame. */ | 2178 return the first window on the frame. */ |
2199 return frame_first_window (XFRAME (all_frames)); | 2179 return frame_first_window (XFRAME (all_frames)); |
2200 else if (! EQ (all_frames, Qt)) | 2180 else if (! EQ (all_frames, Qt)) |
2201 all_frames = Qnil; | 2181 all_frames = Qnil; |
2202 /* Now `all_frames' is one of: | 2182 /* Now all_frames is t meaning search all frames, |
2203 t => search all frames | 2183 nil meaning search just current frame, |
2204 nil => search just the current frame | 2184 visible meaning search just visible frames, |
2205 visible => search just visible frames | 2185 0 meaning search visible and iconified frames, |
2206 0 => search visible and iconified frames | 2186 or a window, meaning search the frame that window belongs to. */ |
2207 a window => search the frame that window belongs to. */ | |
2208 | 2187 |
2209 /* Do this loop at least once, to get the next window, and perhaps | 2188 /* Do this loop at least once, to get the next window, and perhaps |
2210 again, if we hit the minibuffer and that is not acceptable. */ | 2189 again, if we hit the minibuffer and that is not acceptable. */ |
2211 do | 2190 do |
2212 { | 2191 { |
2220 /* We have found the top window on the frame. | 2199 /* We have found the top window on the frame. |
2221 Which frames are acceptable? */ | 2200 Which frames are acceptable? */ |
2222 tem = WINDOW_FRAME (XWINDOW (window)); | 2201 tem = WINDOW_FRAME (XWINDOW (window)); |
2223 | 2202 |
2224 if (! NILP (all_frames)) | 2203 if (! NILP (all_frames)) |
2225 /* It's actually important that we use previous_frame here, | 2204 /* It's actually important that we use prev_frame here, |
2226 rather than next_frame. All the windows acceptable | 2205 rather than next_frame. All the windows acceptable |
2227 according to the given parameters should form a ring; | 2206 according to the given parameters should form a ring; |
2228 Fnext_window and Fprevious_window should go back and | 2207 Fnext_window and Fprevious_window should go back and |
2229 forth around the ring. If we use next_frame here, | 2208 forth around the ring. If we use next_frame here, |
2230 then Fnext_window and Fprevious_window take different | 2209 then Fnext_window and Fprevious_window take different |
2231 paths through the set of acceptable windows. | 2210 paths through the set of acceptable windows. |
2232 window_loop assumes that these `ring' requirement are | 2211 window_loop assumes that these `ring' requirement are |
2233 met. */ | 2212 met. */ |
2234 { | 2213 { |
2235 Lisp_Object tem1 = tem; | 2214 Lisp_Object tem1; |
2236 tem = previous_frame (tem, all_frames, console); | 2215 |
2216 tem1 = tem; | |
2217 tem = prev_frame (tem, all_frames, console); | |
2237 /* In the case where the minibuffer is active, | 2218 /* In the case where the minibuffer is active, |
2238 and we include its frame as well as the selected one, | 2219 and we include its frame as well as the selected one, |
2239 next_frame may get stuck in that frame. | 2220 next_frame may get stuck in that frame. |
2240 If that happens, go back to the selected frame | 2221 If that happens, go back to the selected frame |
2241 so we can complete the cycle. */ | 2222 so we can complete the cycle. */ |
2417 * #### catch the lossage this is meant(?) to punt on... | 2398 * #### catch the lossage this is meant(?) to punt on... |
2418 */ | 2399 */ |
2419 int lose_lose = 0; | 2400 int lose_lose = 0; |
2420 Lisp_Object devcons, concons; | 2401 Lisp_Object devcons, concons; |
2421 | 2402 |
2403 /* FRAME_ARG is Qlambda to stick to one frame, | |
2404 Qvisible to consider all visible frames, | |
2405 or Qt otherwise. */ | |
2406 | |
2422 /* If we're only looping through windows on a particular frame, | 2407 /* If we're only looping through windows on a particular frame, |
2423 FRAME points to that frame. If we're looping through windows | 2408 FRAME points to that frame. If we're looping through windows |
2424 on all frames, FRAME is 0. */ | 2409 on all frames, FRAME is 0. */ |
2410 | |
2425 if (FRAMEP (frames)) | 2411 if (FRAMEP (frames)) |
2426 frame = XFRAME (frames); | 2412 frame = XFRAME (frames); |
2427 else if (NILP (frames)) | 2413 else if (NILP (frames)) |
2428 frame = selected_frame (); | 2414 frame = selected_frame (); |
2429 else | 2415 else |
2430 frame = 0; | 2416 frame = 0; |
2431 | |
2432 /* FRAME_ARG is Qlambda to stick to one frame, | |
2433 Qvisible to consider all visible frames, | |
2434 or Qt otherwise. */ | |
2435 if (frame) | 2417 if (frame) |
2436 frame_arg = Qlambda; | 2418 frame_arg = Qlambda; |
2437 else if (ZEROP (frames)) | 2419 else if (ZEROP (frames)) |
2438 frame_arg = frames; | 2420 frame_arg = frames; |
2439 else if (EQ (frames, Qvisible)) | 2421 else if (EQ (frames, Qvisible)) |
2450 the_frame = DEVICE_SELECTED_FRAME (XDEVICE (device)); | 2432 the_frame = DEVICE_SELECTED_FRAME (XDEVICE (device)); |
2451 | 2433 |
2452 if (NILP (the_frame)) | 2434 if (NILP (the_frame)) |
2453 continue; | 2435 continue; |
2454 | 2436 |
2455 if (!device_matches_console_spec (device, | 2437 if (!device_matches_console_spec (the_frame, device, console)) |
2456 NILP (console) ? | |
2457 FRAME_CONSOLE (XFRAME (the_frame)) : | |
2458 console)) | |
2459 continue; | 2438 continue; |
2460 | 2439 |
2461 /* Pick a window to start with. */ | 2440 /* Pick a window to start with. */ |
2462 if (WINDOWP (obj)) | 2441 if (WINDOWP (obj)) |
2463 w = obj; | 2442 w = obj; |
2479 struct window *p = XWINDOW (w); | 2458 struct window *p = XWINDOW (w); |
2480 struct frame *w_frame = XFRAME (WINDOW_FRAME (p)); | 2459 struct frame *w_frame = XFRAME (WINDOW_FRAME (p)); |
2481 | 2460 |
2482 /* Pick the next window now, since some operations will delete | 2461 /* Pick the next window now, since some operations will delete |
2483 the current window. */ | 2462 the current window. */ |
2484 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg, device); | 2463 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg, Qt); |
2485 | 2464 |
2486 /* #### Still needed ?? */ | 2465 /* #### Still needed ?? */ |
2487 /* Given the outstanding quality of the rest of this code, | 2466 /* Given the outstanding quality of the rest of this code, |
2488 I feel no shame about putting this piece of shit in. */ | 2467 I feel no shame about putting this piece of shit in. */ |
2489 if (++lose_lose >= 500) | 2468 if (++lose_lose >= 500) |
3182 buffer); | 3161 buffer); |
3183 set_marker_restricted (w->start[CURRENT_DISP], | 3162 set_marker_restricted (w->start[CURRENT_DISP], |
3184 make_int (XBUFFER (buffer)->last_window_start), | 3163 make_int (XBUFFER (buffer)->last_window_start), |
3185 buffer); | 3164 buffer); |
3186 Fset_marker (w->sb_point, w->start[CURRENT_DISP], buffer); | 3165 Fset_marker (w->sb_point, w->start[CURRENT_DISP], buffer); |
3187 /* set start_at_line_beg correctly. GE */ | 3166 w->start_at_line_beg = 0; |
3188 w->start_at_line_beg = beginning_of_line_p (XBUFFER (buffer), | |
3189 marker_position (w->start[CURRENT_DISP])); | |
3190 w->force_start = 0; /* Lucid fix */ | 3167 w->force_start = 0; /* Lucid fix */ |
3191 SET_LAST_MODIFIED (w, 1); | 3168 SET_LAST_MODIFIED (w, 1); |
3192 SET_LAST_FACECHANGE (w); | 3169 SET_LAST_FACECHANGE (w); |
3193 MARK_WINDOWS_CHANGED (w); | 3170 MARK_WINDOWS_CHANGED (w); |
3194 recompute_all_cached_specifiers_in_window (w); | 3171 recompute_all_cached_specifiers_in_window (w); |
3202 DEFUN ("select-window", Fselect_window, 1, 2, 0, /* | 3179 DEFUN ("select-window", Fselect_window, 1, 2, 0, /* |
3203 Select WINDOW. Most editing will apply to WINDOW's buffer. | 3180 Select WINDOW. Most editing will apply to WINDOW's buffer. |
3204 The main editor command loop selects the buffer of the selected window | 3181 The main editor command loop selects the buffer of the selected window |
3205 before each command. | 3182 before each command. |
3206 | 3183 |
3207 With non-nil optional argument NORECORD, do not modify the | 3184 With non-nil optional argument `norecord', do not modify the |
3208 global or per-frame buffer ordering. | 3185 global or per-frame buffer ordering. |
3209 */ | 3186 */ |
3210 (window, norecord)) | 3187 (window, norecord)) |
3211 { | 3188 { |
3212 struct window *w; | 3189 struct window *w; |
3364 } | 3341 } |
3365 | 3342 |
3366 DEFUN ("split-window", Fsplit_window, 0, 3, "", /* | 3343 DEFUN ("split-window", Fsplit_window, 0, 3, "", /* |
3367 Split WINDOW, putting SIZE lines in the first of the pair. | 3344 Split WINDOW, putting SIZE lines in the first of the pair. |
3368 WINDOW defaults to selected one and SIZE to half its size. | 3345 WINDOW defaults to selected one and SIZE to half its size. |
3369 If optional third arg HORFLAG is non-nil, split side by side | 3346 If optional third arg HOR-FLAG is non-nil, split side by side |
3370 and put SIZE columns in the first of the pair. | 3347 and put SIZE columns in the first of the pair. |
3371 */ | 3348 */ |
3372 (window, chsize, horflag)) | 3349 (window, chsize, horflag)) |
3373 { | 3350 { |
3374 Lisp_Object new; | 3351 Lisp_Object new; |
3378 int psize; | 3355 int psize; |
3379 | 3356 |
3380 if (NILP (window)) | 3357 if (NILP (window)) |
3381 window = Fselected_window (Qnil); | 3358 window = Fselected_window (Qnil); |
3382 else | 3359 else |
3383 CHECK_LIVE_WINDOW (window); | 3360 CHECK_WINDOW (window); |
3384 | 3361 |
3385 o = XWINDOW (window); | 3362 o = XWINDOW (window); |
3386 f = XFRAME (WINDOW_FRAME (o)); | 3363 f = XFRAME (WINDOW_FRAME (o)); |
3387 | 3364 |
3388 if (NILP (chsize)) | 3365 if (NILP (chsize)) |
4320 /* Don't use decode_window() because we need the new value of | 4297 /* Don't use decode_window() because we need the new value of |
4321 WINDOW. */ | 4298 WINDOW. */ |
4322 if (NILP (window)) | 4299 if (NILP (window)) |
4323 window = Fselected_window (Qnil); | 4300 window = Fselected_window (Qnil); |
4324 else | 4301 else |
4325 CHECK_LIVE_WINDOW (window); | 4302 CHECK_WINDOW (window); |
4326 w = XWINDOW (window); | 4303 w = XWINDOW (window); |
4327 b = XBUFFER (w->buffer); | 4304 b = XBUFFER (w->buffer); |
4328 | 4305 |
4329 height = window_displayed_height (w); | 4306 height = window_displayed_height (w); |
4330 selected = EQ (window, Fselected_window (w->frame)); | 4307 selected = EQ (window, Fselected_window (w->frame)); |
4447 /* Map MAPFUN over the windows in F. CLOSURE is passed to each | 4424 /* Map MAPFUN over the windows in F. CLOSURE is passed to each |
4448 invocation of MAPFUN. If any invocation of MAPFUN returns | 4425 invocation of MAPFUN. If any invocation of MAPFUN returns |
4449 non-zero, the mapping is halted. Otherwise, map_windows() maps | 4426 non-zero, the mapping is halted. Otherwise, map_windows() maps |
4450 over all windows in F. | 4427 over all windows in F. |
4451 | 4428 |
4452 If MAPFUN creates or deletes windows, the behavior is undefined. */ | 4429 If MAPFUN creates or deletes windows, the behaviour is undefined. */ |
4453 | 4430 |
4454 int | 4431 int |
4455 map_windows (struct frame *f, int (*mapfun) (struct window *w, void *closure), | 4432 map_windows (struct frame *f, int (*mapfun) (struct window *w, void *closure), |
4456 void *closure) | 4433 void *closure) |
4457 { | 4434 { |
4637 /* If you add anything to this structure make sure window_config_equal | 4614 /* If you add anything to this structure make sure window_config_equal |
4638 knows about it. */ | 4615 knows about it. */ |
4639 struct window_config | 4616 struct window_config |
4640 { | 4617 { |
4641 struct lcrecord_header header; | 4618 struct lcrecord_header header; |
4642 /* int frame_width; No longer needed, JV | 4619 int frame_width; |
4643 int frame_height; */ | 4620 int frame_height; |
4644 #if 0 /* FSFmacs */ | 4621 #if 0 /* FSFmacs */ |
4645 Lisp_Object selected_frame; | 4622 Lisp_Object selected_frame; |
4646 #endif | 4623 #endif |
4647 Lisp_Object current_window; | 4624 Lisp_Object current_window; |
4648 Lisp_Object current_buffer; | 4625 Lisp_Object current_buffer; |
4649 Lisp_Object minibuffer_scroll_window; | 4626 Lisp_Object minibuffer_scroll_window; |
4650 Lisp_Object root_window; | 4627 Lisp_Object root_window; |
4651 int minibuf_height; /* 0 = no minibuffer, <0, size in lines, >0 in pixels */ | |
4652 /* Record the values of window-min-width and window-min-height | 4628 /* Record the values of window-min-width and window-min-height |
4653 so that window sizes remain consistent with them. */ | 4629 so that window sizes remain consistent with them. */ |
4654 int min_width, min_height; | 4630 int min_width, min_height; |
4655 int saved_windows_count; | 4631 int saved_windows_count; |
4656 /* Zero-sized arrays aren't ANSI C */ | 4632 /* Zero-sized arrays aren't ANSI C */ |
4778 | 4754 |
4779 if (!((fig1->saved_windows_count == fig2->saved_windows_count) && | 4755 if (!((fig1->saved_windows_count == fig2->saved_windows_count) && |
4780 EQ (fig1->current_window, fig2->current_window) && | 4756 EQ (fig1->current_window, fig2->current_window) && |
4781 EQ (fig1->current_buffer, fig2->current_buffer) && | 4757 EQ (fig1->current_buffer, fig2->current_buffer) && |
4782 EQ (fig1->root_window, fig2->root_window) && | 4758 EQ (fig1->root_window, fig2->root_window) && |
4783 EQ (fig1->minibuffer_scroll_window, fig2->minibuffer_scroll_window))) | 4759 EQ (fig1->minibuffer_scroll_window, fig2->minibuffer_scroll_window) && |
4784 /* && | |
4785 fig1->frame_width == fig2->frame_width && | 4760 fig1->frame_width == fig2->frame_width && |
4786 fig1->frame_height == fig2->frame_height)) */ | 4761 fig1->frame_height == fig2->frame_height)) |
4787 return 0; | 4762 return 0; |
4788 | 4763 |
4789 for (i = 0; i < fig1->saved_windows_count; i++) | 4764 for (i = 0; i < fig1->saved_windows_count; i++) |
4790 { | 4765 { |
4791 if (!saved_window_equal (SAVED_WINDOW_N (fig1, i), | 4766 if (!saved_window_equal (SAVED_WINDOW_N (fig1, i), |
4877 int k; | 4852 int k; |
4878 Lisp_Object frame; | 4853 Lisp_Object frame; |
4879 struct frame *f; | 4854 struct frame *f; |
4880 struct gcpro gcpro1; | 4855 struct gcpro gcpro1; |
4881 Lisp_Object old_window_config; | 4856 Lisp_Object old_window_config; |
4882 /* int previous_frame_height; | 4857 int previous_frame_height; |
4883 int previous_frame_width;*/ | 4858 int previous_frame_width; |
4884 int previous_pixel_top; | |
4885 int previous_pixel_height; | |
4886 int previous_pixel_left; | |
4887 int previous_pixel_width; | |
4888 int previous_minibuf_height, previous_minibuf_top,previous_minibuf_width; | |
4889 int real_font_height; | |
4890 int converted_minibuf_height,target_minibuf_height; | |
4891 int specpdl_count = specpdl_depth (); | 4859 int specpdl_count = specpdl_depth (); |
4892 | 4860 |
4893 GCPRO1 (configuration); | 4861 GCPRO1 (configuration); |
4894 | 4862 |
4895 CHECK_WINDOW_CONFIGURATION (configuration); | 4863 CHECK_WINDOW_CONFIGURATION (configuration); |
4950 begin_dont_check_for_quit (); | 4918 begin_dont_check_for_quit (); |
4951 record_unwind_protect (free_window_configuration, old_window_config); | 4919 record_unwind_protect (free_window_configuration, old_window_config); |
4952 | 4920 |
4953 mark_windows_in_use (f, 1); | 4921 mark_windows_in_use (f, 1); |
4954 | 4922 |
4955 #if 0 | |
4956 /* JV: This is bogus, | |
4957 First of all, the units are inconsistent. The frame sizes are measured | |
4958 in characters but the window sizes are stored in pixels. So if a | |
4959 font size change happened between saving and restoring, the | |
4960 frame "sizes" maybe equal but the windows still should be | |
4961 resized. This is tickled alot by the new "character size | |
4962 stays constant" policy in 21.0. It leads to very weird | |
4963 glitches (and possibly craches when asserts are tickled). | |
4964 | |
4965 Just changing the units doesn't help because changing the | |
4966 toolbar configuration can also change the pixel positions. | |
4967 Luckily there is a much simpler way of doing this, see below. | |
4968 */ | |
4969 previous_frame_width = FRAME_WIDTH (f); | 4923 previous_frame_width = FRAME_WIDTH (f); |
4970 previous_frame_height = FRAME_HEIGHT (f); | 4924 previous_frame_height = FRAME_HEIGHT (f); |
4971 /* If the frame has been resized since this window configuration was | 4925 /* If the frame has been resized since this window configuration was |
4972 made, we change the frame to the size specified in the | 4926 made, we change the frame to the size specified in the |
4973 configuration, restore the configuration, and then resize it | 4927 configuration, restore the configuration, and then resize it |
4974 back. We keep track of the prevailing height in these variables. */ | 4928 back. We keep track of the prevailing height in these variables. */ |
4975 if (config->frame_height != FRAME_HEIGHT (f) | 4929 if (config->frame_height != FRAME_HEIGHT (f) |
4976 || config->frame_width != FRAME_WIDTH (f)) | 4930 || config->frame_width != FRAME_WIDTH (f)) |
4977 change_frame_size (f, config->frame_height, config->frame_width, 0); | 4931 change_frame_size (f, config->frame_height, config->frame_width, 0); |
4978 #endif | 4932 |
4979 | |
4980 previous_pixel_top = XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top; | |
4981 previous_pixel_height = XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_height; | |
4982 previous_pixel_left = XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_left; | |
4983 previous_pixel_width = XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_width; | |
4984 | |
4985 /* remember some properties of the minibuffer */ | |
4986 | |
4987 default_face_height_and_width (frame, &real_font_height, 0); | |
4988 assert(real_font_height > 0); | |
4989 | |
4990 if (FRAME_HAS_MINIBUF_P (f) && ! FRAME_MINIBUF_ONLY_P (f)) | |
4991 { | |
4992 previous_minibuf_height | |
4993 = XWINDOW(FRAME_MINIBUF_WINDOW(f))->pixel_height; | |
4994 previous_minibuf_top | |
4995 = XWINDOW(FRAME_MINIBUF_WINDOW(f))->pixel_top; | |
4996 previous_minibuf_width | |
4997 = XWINDOW(FRAME_MINIBUF_WINDOW(f))->pixel_width; | |
4998 } | |
4999 else | |
5000 { | |
5001 previous_minibuf_height = 0; | |
5002 previous_minibuf_width = 0; | |
5003 } | |
5004 converted_minibuf_height = | |
5005 (previous_minibuf_height % real_font_height) == 0 ? | |
5006 - (previous_minibuf_height / real_font_height ) : /* lines */ | |
5007 previous_minibuf_height; /* pixels */ | |
5008 | |
5009 /* Temporarily avoid any problems with windows that are smaller | 4933 /* Temporarily avoid any problems with windows that are smaller |
5010 than they are supposed to be. */ | 4934 than they are supposed to be. */ |
5011 window_min_height = 1; | 4935 window_min_height = 1; |
5012 window_min_width = 1; | 4936 window_min_width = 1; |
5013 | 4937 |
5169 Instead, we don't ever change the selected frame, and either | 5093 Instead, we don't ever change the selected frame, and either |
5170 call Fselect_window() below if the window config's frame is | 5094 call Fselect_window() below if the window config's frame is |
5171 currently selected, or just set the selected window of the | 5095 currently selected, or just set the selected window of the |
5172 window config's frame. */ | 5096 window config's frame. */ |
5173 | 5097 |
5174 #if 0 | |
5175 /* Set the frame height to the value it had before this function. */ | 5098 /* Set the frame height to the value it had before this function. */ |
5176 if (previous_frame_height != FRAME_HEIGHT (f) | 5099 if (previous_frame_height != FRAME_HEIGHT (f) |
5177 || previous_frame_width != FRAME_WIDTH (f)) | 5100 || previous_frame_width != FRAME_WIDTH (f)) |
5178 change_frame_size (f, previous_frame_height, previous_frame_width, 0); | 5101 change_frame_size (f, previous_frame_height, previous_frame_width, 0); |
5179 #endif | 5102 |
5180 /* We just reset the size and position of the minibuffer, to its old | |
5181 value, which needn't be valid. So we do some magic to see which value | |
5182 to actually take. Then we set it. | |
5183 | |
5184 The magic: | |
5185 We take the old value if is in the same units but differs from the | |
5186 current value. | |
5187 | |
5188 #### Now we get more cases correct then ever before, but | |
5189 are we treating all? For instance what if the frames minibuf window | |
5190 is no longer the same one? | |
5191 */ | |
5192 target_minibuf_height = previous_minibuf_height; | |
5193 if (converted_minibuf_height && | |
5194 (converted_minibuf_height * config->minibuf_height) > 0 && | |
5195 (converted_minibuf_height != config->minibuf_height)) | |
5196 { | |
5197 target_minibuf_height = config->minibuf_height < 0 ? | |
5198 - (config->minibuf_height * real_font_height) : | |
5199 config->minibuf_height; | |
5200 target_minibuf_height = | |
5201 max(target_minibuf_height,real_font_height); | |
5202 } | |
5203 if (previous_minibuf_height) | |
5204 { | |
5205 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_top | |
5206 = previous_minibuf_top - | |
5207 (target_minibuf_height - previous_minibuf_height); | |
5208 set_window_pixheight (FRAME_MINIBUF_WINDOW (f), | |
5209 target_minibuf_height, 0); | |
5210 set_window_pixwidth (FRAME_MINIBUF_WINDOW (f), | |
5211 previous_minibuf_width, 0); | |
5212 } | |
5213 | |
5214 /* This is a better way to deal with frame resizing, etc. | |
5215 What we _actually_ want is for the old (just restored) | |
5216 root window to fit | |
5217 into the place of the new one. So we just do that. Simple! */ | |
5218 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top = previous_pixel_top; | |
5219 /* Note that this function also updates the subwindow | |
5220 "pixel_top"s */ | |
5221 set_window_pixheight (FRAME_ROOT_WINDOW (f), | |
5222 previous_pixel_height - | |
5223 (target_minibuf_height - previous_minibuf_height), 0); | |
5224 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_left = previous_pixel_left; | |
5225 /* Note that this function also updates the subwindow | |
5226 "pixel_left"s */ | |
5227 set_window_pixwidth (FRAME_ROOT_WINDOW (f), previous_pixel_width, 0); | |
5228 | |
5229 /* If restoring in the current frame make the window current, | 5103 /* If restoring in the current frame make the window current, |
5230 otherwise just update the frame selected_window slot to be | 5104 otherwise just update the frame selected_window slot to be |
5231 the restored current_window. */ | 5105 the restored current_window. */ |
5232 if (f == selected_frame ()) | 5106 if (f == selected_frame ()) |
5233 { | 5107 { |
5438 { | 5312 { |
5439 Lisp_Object result; | 5313 Lisp_Object result; |
5440 struct frame *f = decode_frame (frame); | 5314 struct frame *f = decode_frame (frame); |
5441 struct window_config *config; | 5315 struct window_config *config; |
5442 int n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); | 5316 int n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
5443 int minibuf_height; | |
5444 int real_font_height; | |
5445 | 5317 |
5446 if (n_windows <= countof (Vwindow_configuration_free_list)) | 5318 if (n_windows <= countof (Vwindow_configuration_free_list)) |
5447 config = XWINDOW_CONFIGURATION (allocate_managed_lcrecord | 5319 config = XWINDOW_CONFIGURATION (allocate_managed_lcrecord |
5448 (Vwindow_configuration_free_list | 5320 (Vwindow_configuration_free_list |
5449 [n_windows - 1])); | 5321 [n_windows - 1])); |
5451 /* More than ten windows; just allocate directly */ | 5323 /* More than ten windows; just allocate directly */ |
5452 config = (struct window_config *) | 5324 config = (struct window_config *) |
5453 alloc_lcrecord (sizeof_window_config_for_n_windows (n_windows), | 5325 alloc_lcrecord (sizeof_window_config_for_n_windows (n_windows), |
5454 lrecord_window_configuration); | 5326 lrecord_window_configuration); |
5455 XSETWINDOW_CONFIGURATION (result, config); | 5327 XSETWINDOW_CONFIGURATION (result, config); |
5456 /* | 5328 |
5457 config->frame_width = FRAME_WIDTH (f); | 5329 config->frame_width = FRAME_WIDTH (f); |
5458 config->frame_height = FRAME_HEIGHT (f); */ | 5330 config->frame_height = FRAME_HEIGHT (f); |
5459 config->current_window = FRAME_SELECTED_WINDOW (f); | 5331 config->current_window = FRAME_SELECTED_WINDOW (f); |
5460 XSETBUFFER (config->current_buffer, current_buffer); | 5332 XSETBUFFER (config->current_buffer, current_buffer); |
5461 config->minibuffer_scroll_window = Vminibuffer_scroll_window; | 5333 config->minibuffer_scroll_window = Vminibuffer_scroll_window; |
5462 config->root_window = FRAME_ROOT_WINDOW (f); | 5334 config->root_window = FRAME_ROOT_WINDOW (f); |
5463 config->min_height = window_min_height; | 5335 config->min_height = window_min_height; |
5464 config->min_width = window_min_width; | 5336 config->min_width = window_min_width; |
5465 config->saved_windows_count = n_windows; | 5337 config->saved_windows_count = n_windows; |
5466 save_window_save (FRAME_ROOT_WINDOW (f), config, 0); | 5338 save_window_save (FRAME_ROOT_WINDOW (f), config, 0); |
5467 | |
5468 /* save the minibuffer height using the heuristics from | |
5469 change_frame_size_1 */ | |
5470 | |
5471 XSETFRAME (frame, f); /* frame could have been nil ! */ | |
5472 default_face_height_and_width (frame, &real_font_height, 0); | |
5473 assert(real_font_height > 0); | |
5474 | |
5475 if (FRAME_HAS_MINIBUF_P (f) && ! FRAME_MINIBUF_ONLY_P (f)) | |
5476 minibuf_height = XWINDOW(FRAME_MINIBUF_WINDOW(f))->pixel_height; | |
5477 else | |
5478 minibuf_height = 0; | |
5479 config->minibuf_height = (minibuf_height % real_font_height) == 0 ? | |
5480 - (minibuf_height / real_font_height ) : /* lines */ | |
5481 minibuf_height; /* pixels */ | |
5482 | |
5483 return result; | 5339 return result; |
5484 } | 5340 } |
5485 | 5341 |
5486 Lisp_Object | 5342 Lisp_Object |
5487 save_window_excursion_unwind (Lisp_Object window_config) | 5343 save_window_excursion_unwind (Lisp_Object window_config) |
5586 DEFSUBR (Fwindow_first_vchild); | 5442 DEFSUBR (Fwindow_first_vchild); |
5587 DEFSUBR (Fwindow_next_child); | 5443 DEFSUBR (Fwindow_next_child); |
5588 DEFSUBR (Fwindow_previous_child); | 5444 DEFSUBR (Fwindow_previous_child); |
5589 DEFSUBR (Fwindow_parent); | 5445 DEFSUBR (Fwindow_parent); |
5590 DEFSUBR (Fwindow_lowest_p); | 5446 DEFSUBR (Fwindow_lowest_p); |
5591 DEFSUBR (Fwindow_truncated_p); | |
5592 DEFSUBR (Fwindow_highest_p); | 5447 DEFSUBR (Fwindow_highest_p); |
5593 DEFSUBR (Fwindow_leftmost_p); | 5448 DEFSUBR (Fwindow_leftmost_p); |
5594 DEFSUBR (Fwindow_rightmost_p); | 5449 DEFSUBR (Fwindow_rightmost_p); |
5595 DEFSUBR (Fpos_visible_in_window_p); | 5450 DEFSUBR (Fpos_visible_in_window_p); |
5596 DEFSUBR (Fwindow_buffer); | 5451 DEFSUBR (Fwindow_buffer); |
5809 | 5664 |
5810 Vvertical_divider_line_width = Fmake_specifier (Qnatnum); | 5665 Vvertical_divider_line_width = Fmake_specifier (Qnatnum); |
5811 { | 5666 { |
5812 Lisp_Object fb = Qnil; | 5667 Lisp_Object fb = Qnil; |
5813 #ifdef HAVE_TTY | 5668 #ifdef HAVE_TTY |
5814 fb = Fcons (Fcons (list1 (Qtty), make_int (1)), fb); | 5669 fb = Fcons (Fcons (list1 (Qtty), Qzero), fb); |
5815 #endif | 5670 #endif |
5816 #ifdef HAVE_X_WINDOWS | 5671 #ifdef HAVE_X_WINDOWS |
5817 fb = Fcons (Fcons (list1 (Qx), make_int (3)), fb); | 5672 fb = Fcons (Fcons (list1 (Qx), make_int (3)), fb); |
5818 #endif | 5673 #endif |
5819 #ifdef HAVE_MS_WINDOWS | 5674 #ifdef HAVE_MS_WINDOWS |