aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorPaul Eggert2011-06-13 01:00:15 -0700
committerPaul Eggert2011-06-13 01:00:15 -0700
commit01103c441a5c97c734c087fa074a941082fd0adb (patch)
tree697132e71abee8762913d4c58015945439cd2c3c /src/window.c
parent5efd304be978e2c0b3b1ac0c39b303b8d094ab66 (diff)
parent873e858a931f3af4b318473e052fb7acd35f7b53 (diff)
downloademacs-01103c441a5c97c734c087fa074a941082fd0adb.tar.gz
emacs-01103c441a5c97c734c087fa074a941082fd0adb.zip
Merge from trunk.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c795
1 files changed, 302 insertions, 493 deletions
diff --git a/src/window.c b/src/window.c
index 7a026b3a1c7..65df9f26e64 100644
--- a/src/window.c
+++ b/src/window.c
@@ -50,9 +50,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#include "nsterm.h" 50#include "nsterm.h"
51#endif 51#endif
52 52
53Lisp_Object Qwindowp, Qwindow_live_p, Qdelete_window; 53Lisp_Object Qwindowp, Qwindow_live_p;
54static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; 54static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer;
55static Lisp_Object Qwindow_deletable_p, Qdisplay_buffer; 55static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
56static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; 56static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
57static Lisp_Object Qresize_root_window, Qresize_root_window_vertically; 57static Lisp_Object Qresize_root_window, Qresize_root_window_vertically;
58static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 58static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
@@ -310,6 +310,8 @@ selected windows appears and to which many commands apply. */)
310 return selected_window; 310 return selected_window;
311} 311}
312 312
313int window_select_count;
314
313/* If select_window is called with inhibit_point_swap non-zero it will 315/* If select_window is called with inhibit_point_swap non-zero it will
314 not store point of the old selected window's buffer back into that 316 not store point of the old selected window's buffer back into that
315 window's pointm slot. This is needed by Fset_window_configuration to 317 window's pointm slot. This is needed by Fset_window_configuration to
@@ -1972,6 +1974,14 @@ recombine_windows (Lisp_Object window)
1972 } 1974 }
1973 } 1975 }
1974} 1976}
1977
1978/* If WINDOW can be deleted, delete it. */
1979static void
1980delete_deletable_window (Lisp_Object window)
1981{
1982 if (!NILP (call1 (Qwindow_deletable_p, window)))
1983 call1 (Qdelete_window, window);
1984}
1975 1985
1976/*********************************************************************** 1986/***********************************************************************
1977 Window List 1987 Window List
@@ -2210,35 +2220,32 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, in
2210 2220
2211DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0, 2221DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
2212 doc: /* Return window following WINDOW in cyclic ordering of windows. 2222 doc: /* Return window following WINDOW in cyclic ordering of windows.
2213WINDOW defaults to the selected window. The optional arguments 2223WINDOW must be a live window and defaults to the selected one. The
2214MINIBUF and ALL-FRAMES specify the set of windows to consider. 2224optional arguments MINIBUF and ALL-FRAMES specify the set of windows to
2215 2225consider.
2216MINIBUF t means consider the minibuffer window even if the 2226
2217minibuffer is not active. MINIBUF nil or omitted means consider 2227MINIBUF nil or omitted means consider the minibuffer window only if the
2218the minibuffer window only if the minibuffer is active. Any 2228minibuffer is active. MINIBUF t means consider the minibuffer window
2219other value means do not consider the minibuffer window even if 2229even if the minibuffer is not active. Any other value means do not
2220the minibuffer is active. 2230consider the minibuffer window even if the minibuffer is active.
2221 2231
2222Several frames may share a single minibuffer; if the minibuffer 2232ALL-FRAMES nil or omitted means consider all windows on WINDOW's frame,
2223is active, all windows on all frames that share that minibuffer 2233plus the minibuffer window if specified by the MINIBUF argument. If the
2224are considered too. Therefore, if you are using a separate 2234minibuffer counts, consider all windows on all frames that share that
2225minibuffer frame and the minibuffer is active and MINIBUF says it 2235minibuffer too. The following non-nil values of ALL-FRAMES have special
2226counts, `next-window' considers the windows in the frame from 2236meanings:
2227which you entered the minibuffer, as well as the minibuffer 2237
2228window. 2238- t means consider all windows on all existing frames.
2239
2240- `visible' means consider all windows on all visible frames.
2241
2242- 0 (the number zero) means consider all windows on all visible and
2243 iconified frames.
2244
2245- A frame means consider all windows on that frame only.
2229 2246
2230ALL-FRAMES nil or omitted means consider all windows on WINDOW's
2231 frame, plus the minibuffer window if specified by the MINIBUF
2232 argument, see above. If the minibuffer counts, consider all
2233 windows on all frames that share that minibuffer too.
2234ALL-FRAMES t means consider all windows on all existing frames.
2235ALL-FRAMES `visible' means consider all windows on all visible
2236 frames on the current terminal.
2237ALL-FRAMES 0 means consider all windows on all visible and
2238 iconified frames on the current terminal.
2239ALL-FRAMES a frame means consider all windows on that frame only.
2240Anything else means consider all windows on WINDOW's frame and no 2247Anything else means consider all windows on WINDOW's frame and no
2241 others. 2248others.
2242 2249
2243If you use consistent values for MINIBUF and ALL-FRAMES, you can use 2250If you use consistent values for MINIBUF and ALL-FRAMES, you can use
2244`next-window' to iterate through the entire cycle of acceptable 2251`next-window' to iterate through the entire cycle of acceptable
@@ -2252,9 +2259,32 @@ windows, eventually ending up back at the window you started with.
2252 2259
2253DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0, 2260DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0,
2254 doc: /* Return window preceding WINDOW in cyclic ordering of windows. 2261 doc: /* Return window preceding WINDOW in cyclic ordering of windows.
2255WINDOW defaults to the selected window. The optional arguments 2262WINDOW must be a live window and defaults to the selected one. The
2256MINIBUF and ALL-FRAMES specify the set of windows to consider. 2263optional arguments MINIBUF and ALL-FRAMES specify the set of windows to
2257For the precise meaning of these arguments see `next-window'. 2264consider.
2265
2266MINIBUF nil or omitted means consider the minibuffer window only if the
2267minibuffer is active. MINIBUF t means consider the minibuffer window
2268even if the minibuffer is not active. Any other value means do not
2269consider the minibuffer window even if the minibuffer is active.
2270
2271ALL-FRAMES nil or omitted means consider all windows on WINDOW's frame,
2272plus the minibuffer window if specified by the MINIBUF argument. If the
2273minibuffer counts, consider all windows on all frames that share that
2274minibuffer too. The following non-nil values of ALL-FRAMES have special
2275meanings:
2276
2277- t means consider all windows on all existing frames.
2278
2279- `visible' means consider all windows on all visible frames.
2280
2281- 0 (the number zero) means consider all windows on all visible and
2282 iconified frames.
2283
2284- A frame means consider all windows on that frame only.
2285
2286Anything else means consider all windows on WINDOW's frame and no
2287others.
2258 2288
2259If you use consistent values for MINIBUF and ALL-FRAMES, you can 2289If you use consistent values for MINIBUF and ALL-FRAMES, you can
2260use `previous-window' to iterate through the entire cycle of 2290use `previous-window' to iterate through the entire cycle of
@@ -2267,37 +2297,6 @@ reverse order. */)
2267} 2297}
2268 2298
2269 2299
2270DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p",
2271 doc: /* Select another window in cyclic ordering of windows.
2272COUNT specifies the number of windows to skip, starting with the
2273selected window, before making the selection. If COUNT is
2274positive, skip COUNT windows forwards. If COUNT is negative,
2275skip -COUNT windows backwards. COUNT zero means do not skip any
2276window, so select the selected window. In an interactive call,
2277COUNT is the numeric prefix argument. Return nil.
2278
2279This function uses `next-window' for finding the window to select.
2280The argument ALL-FRAMES has the same meaning as in `next-window',
2281but the MINIBUF argument of `next-window' is always effectively
2282nil. */)
2283 (Lisp_Object count, Lisp_Object all_frames)
2284{
2285 Lisp_Object window;
2286 int i;
2287
2288 CHECK_NUMBER (count);
2289 window = selected_window;
2290
2291 for (i = XINT (count); i > 0; --i)
2292 window = Fnext_window (window, Qnil, all_frames);
2293 for (; i < 0; ++i)
2294 window = Fprevious_window (window, Qnil, all_frames);
2295
2296 Fselect_window (window, Qnil);
2297 return Qnil;
2298}
2299
2300
2301/* Return a list of windows in cyclic ordering. Arguments are like 2300/* Return a list of windows in cyclic ordering. Arguments are like
2302 for `next-window'. */ 2301 for `next-window'. */
2303 2302
@@ -2397,10 +2396,9 @@ be listed first but no error is signalled. */)
2397enum window_loop 2396enum window_loop
2398{ 2397{
2399 WINDOW_LOOP_UNUSED, 2398 WINDOW_LOOP_UNUSED,
2400 GET_BUFFER_WINDOW, /* Arg is buffer */ 2399 GET_BUFFER_WINDOW, /* Arg is buffer */
2401 DELETE_BUFFER_WINDOWS, /* Arg is buffer */ 2400 REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */
2402 UNSHOW_BUFFER, /* Arg is buffer */ 2401 REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */
2403 REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */
2404 CHECK_ALL_WINDOWS 2402 CHECK_ALL_WINDOWS
2405}; 2403};
2406 2404
@@ -2408,6 +2406,7 @@ static Lisp_Object
2408window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frames) 2406window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frames)
2409{ 2407{
2410 Lisp_Object window, windows, best_window, frame_arg; 2408 Lisp_Object window, windows, best_window, frame_arg;
2409 int frame_best_window_flag = 0;
2411 struct frame *f; 2410 struct frame *f;
2412 struct gcpro gcpro1; 2411 struct gcpro gcpro1;
2413 2412
@@ -2457,110 +2456,51 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2457 is visible, since Fwindow_list skips non-visible frames if 2456 is visible, since Fwindow_list skips non-visible frames if
2458 that is desired, under the control of frame_arg. */ 2457 that is desired, under the control of frame_arg. */
2459 if (!MINI_WINDOW_P (w) 2458 if (!MINI_WINDOW_P (w)
2460 /* For UNSHOW_BUFFER, we must always consider all windows. */ 2459 /* For REPLACE_BUFFER_IN_WINDOWS_SAFELY, we must always
2461 || type == UNSHOW_BUFFER 2460 consider all windows. */
2461 || type == REPLACE_BUFFER_IN_WINDOWS_SAFELY
2462 || (mini && minibuf_level > 0)) 2462 || (mini && minibuf_level > 0))
2463 switch (type) 2463 switch (type)
2464 { 2464 {
2465 case GET_BUFFER_WINDOW: 2465 case GET_BUFFER_WINDOW:
2466 if (EQ (w->buffer, obj) 2466 if (EQ (w->buffer, obj)
2467 /* Don't find any minibuffer window 2467 /* Don't find any minibuffer window except the one that
2468 except the one that is currently in use. */ 2468 is currently in use. */
2469 && (MINI_WINDOW_P (w) 2469 && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1))
2470 ? EQ (window, minibuf_window)
2471 : 1))
2472 { 2470 {
2473 if (NILP (best_window)) 2471 if (EQ (window, selected_window))
2474 best_window = window; 2472 /* Preferably return the selected window. */
2475 else if (EQ (window, selected_window))
2476 /* Prefer to return selected-window. */
2477 RETURN_UNGCPRO (window); 2473 RETURN_UNGCPRO (window);
2478 else if (EQ (Fwindow_frame (window), selected_frame)) 2474 else if (EQ (XWINDOW (window)->frame, selected_frame)
2479 /* Prefer windows on the current frame. */ 2475 && !frame_best_window_flag)
2480 best_window = window; 2476 /* Prefer windows on the current frame (but don't
2481 } 2477 choose another one if we have one already). */
2482 break;
2483
2484 case DELETE_BUFFER_WINDOWS:
2485 if (EQ (w->buffer, obj))
2486 {
2487 struct frame *fr = XFRAME (WINDOW_FRAME (w));
2488
2489 /* If this window is dedicated, and in a frame of its own,
2490 kill the frame. */
2491 if (EQ (window, FRAME_ROOT_WINDOW (fr))
2492 && !NILP (w->dedicated)
2493 && other_visible_frames (fr))
2494 {
2495 /* Skip the other windows on this frame.
2496 There might be one, the minibuffer! */
2497 while (CONSP (XCDR (windows))
2498 && EQ (XWINDOW (XCAR (windows))->frame,
2499 XWINDOW (XCAR (XCDR (windows)))->frame))
2500 windows = XCDR (windows);
2501
2502 /* Now we can safely delete the frame. */
2503 delete_frame (w->frame, Qnil);
2504 }
2505 else if (NILP (w->parent))
2506 { 2478 {
2507 /* If we're deleting the buffer displayed in the 2479 best_window = window;
2508 only window on the frame, find a new buffer to 2480 frame_best_window_flag = 1;
2509 display there. */
2510 Lisp_Object buffer;
2511 buffer = Fother_buffer (obj, Qnil, w->frame);
2512 /* Reset dedicated state of window. */
2513 w->dedicated = Qnil;
2514 Fset_window_buffer (window, buffer, Qnil);
2515 if (EQ (window, selected_window))
2516 Fset_buffer (w->buffer);
2517 } 2481 }
2518 else 2482 else if (NILP (best_window))
2519 call1 (Qdelete_window, window); 2483 best_window = window;
2520 } 2484 }
2521 break; 2485 break;
2522 2486
2523 case UNSHOW_BUFFER: 2487 case REPLACE_BUFFER_IN_WINDOWS_SAFELY:
2488 /* We could simply check whether the buffer shown by window
2489 is live, and show another buffer in case it isn't. */
2524 if (EQ (w->buffer, obj)) 2490 if (EQ (w->buffer, obj))
2525 { 2491 {
2526 Lisp_Object buffer; 2492 /* Undedicate WINDOW. */
2527 struct frame *fr = XFRAME (w->frame); 2493 w->dedicated = Qnil;
2528 2494 /* Make WINDOW show the buffer returned by
2529 /* Find another buffer to show in this window. */ 2495 other_buffer_safely, don't run any hooks. */
2530 buffer = Fother_buffer (obj, Qnil, w->frame); 2496 set_window_buffer
2531 2497 (window, other_buffer_safely (w->buffer), 0, 0);
2532 /* If this window is dedicated, and in a frame of its own, 2498 /* If WINDOW is the selected window, make its buffer
2533 kill the frame. */ 2499 current. But do so only if the window shows the
2534 if (EQ (window, FRAME_ROOT_WINDOW (fr)) 2500 current buffer (Bug#6454). */
2535 && !NILP (w->dedicated) 2501 if (EQ (window, selected_window)
2536 && other_visible_frames (fr)) 2502 && XBUFFER (w->buffer) == current_buffer)
2537 { 2503 Fset_buffer (w->buffer);
2538 /* Skip the other windows on this frame.
2539 There might be one, the minibuffer! */
2540 while (CONSP (XCDR (windows))
2541 && EQ (XWINDOW (XCAR (windows))->frame,
2542 XWINDOW (XCAR (XCDR (windows)))->frame))
2543 windows = XCDR (windows);
2544
2545 /* Now we can safely delete the frame. */
2546 delete_frame (w->frame, Qnil);
2547 }
2548 else if (!NILP (w->dedicated) && !NILP (w->parent))
2549 {
2550 Lisp_Object window_to_delete;
2551 XSETWINDOW (window_to_delete, w);
2552 /* If this window is dedicated and not the only window
2553 in its frame, then kill it. */
2554 call1 (Qdelete_window, window_to_delete);
2555 }
2556 else
2557 {
2558 /* Otherwise show a different buffer in the window. */
2559 w->dedicated = Qnil;
2560 Fset_window_buffer (window, buffer, Qnil);
2561 if (EQ (window, selected_window))
2562 Fset_buffer (w->buffer);
2563 }
2564 } 2504 }
2565 break; 2505 break;
2566 2506
@@ -2875,85 +2815,26 @@ window-start value is reasonable when this function is called. */)
2875} 2815}
2876 2816
2877 2817
2878DEFUN ("delete-windows-on", Fdelete_windows_on, Sdelete_windows_on, 2818void
2879 0, 2, "bDelete windows on (buffer): ", 2819replace_buffer_in_windows (Lisp_Object buffer)
2880 doc: /* Delete all windows showing BUFFER-OR-NAME.
2881BUFFER-OR-NAME may be a buffer or the name of an existing buffer and
2882defaults to the current buffer.
2883
2884Optional second argument FRAME controls which frames are affected.
2885If optional argument FRAME is `visible', search all visible frames.
2886If FRAME is 0, search all visible and iconified frames.
2887If FRAME is nil, search all frames.
2888If FRAME is t, search only the selected frame.
2889If FRAME is a frame, search only that frame.
2890When a window showing BUFFER-OR-NAME is dedicated and the only window of
2891its frame, that frame is deleted when there are other frames left. */)
2892 (Lisp_Object buffer_or_name, Lisp_Object frame)
2893{ 2820{
2894 Lisp_Object buffer; 2821 call1 (Qreplace_buffer_in_windows, buffer);
2895
2896 /* FRAME uses t and nil to mean the opposite of what window_loop
2897 expects. */
2898 if (NILP (frame))
2899 frame = Qt;
2900 else if (EQ (frame, Qt))
2901 frame = Qnil;
2902
2903 if (NILP (buffer_or_name))
2904 buffer = Fcurrent_buffer ();
2905 else
2906 {
2907 buffer = Fget_buffer (buffer_or_name);
2908 CHECK_BUFFER (buffer);
2909 }
2910
2911 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame);
2912
2913 return Qnil;
2914} 2822}
2915 2823
2916DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows,
2917 Sreplace_buffer_in_windows,
2918 0, 1, "bReplace buffer in windows: ",
2919 doc: /* Replace BUFFER-OR-NAME with some other buffer in all windows showing it.
2920BUFFER-OR-NAME may be a buffer or the name of an existing buffer and
2921defaults to the current buffer.
2922
2923When a window showing BUFFER-OR-NAME is dedicated that window is
2924deleted. If that window is the only window on its frame, that frame is
2925deleted too when there are other frames left. If there are no other
2926frames left, some other buffer is displayed in that window. */)
2927 (Lisp_Object buffer_or_name)
2928{
2929 Lisp_Object buffer;
2930
2931 if (NILP (buffer_or_name))
2932 buffer = Fcurrent_buffer ();
2933 else
2934 {
2935 buffer = Fget_buffer (buffer_or_name);
2936 CHECK_BUFFER (buffer);
2937 }
2938
2939 window_loop (UNSHOW_BUFFER, buffer, 0, Qt);
2940
2941 return Qnil;
2942}
2943 2824
2944/* Replace BUFFER with some other buffer in all windows 2825/* Safely replace BUFFER with some other buffer in all windows of all
2945 of all frames, even those on other keyboards. */ 2826 frames, even those on other keyboards. */
2946 2827
2947void 2828void
2948replace_buffer_in_all_windows (Lisp_Object buffer) 2829replace_buffer_in_windows_safely (Lisp_Object buffer)
2949{ 2830{
2950 Lisp_Object tail, frame; 2831 Lisp_Object tail, frame;
2951 2832
2952 /* A single call to window_loop won't do the job 2833 /* A single call to window_loop won't do the job because it only
2953 because it only considers frames on the current keyboard. 2834 considers frames on the current keyboard. So loop manually over
2954 So loop manually over frames, and handle each one. */ 2835 frames, and handle each one. */
2955 FOR_EACH_FRAME (tail, frame) 2836 FOR_EACH_FRAME (tail, frame)
2956 window_loop (UNSHOW_BUFFER, buffer, 1, frame); 2837 window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, 1, frame);
2957} 2838}
2958 2839
2959/* If *ROWS or *COLS are too small a size for FRAME, set them to the 2840/* If *ROWS or *COLS are too small a size for FRAME, set them to the
@@ -3014,8 +2895,6 @@ adjust_window_margins (struct window *w)
3014 return 1; 2895 return 1;
3015} 2896}
3016 2897
3017int window_select_count;
3018
3019static Lisp_Object Fset_window_margins (Lisp_Object, Lisp_Object, Lisp_Object); 2898static Lisp_Object Fset_window_margins (Lisp_Object, Lisp_Object, Lisp_Object);
3020static Lisp_Object Fset_window_fringes (Lisp_Object, Lisp_Object, Lisp_Object, 2899static Lisp_Object Fset_window_fringes (Lisp_Object, Lisp_Object, Lisp_Object,
3021 Lisp_Object); 2900 Lisp_Object);
@@ -3023,6 +2902,8 @@ static Lisp_Object Fset_window_scroll_bars (Lisp_Object, Lisp_Object,
3023 Lisp_Object, Lisp_Object); 2902 Lisp_Object, Lisp_Object);
3024static Lisp_Object Fset_window_vscroll (Lisp_Object, Lisp_Object, Lisp_Object); 2903static Lisp_Object Fset_window_vscroll (Lisp_Object, Lisp_Object, Lisp_Object);
3025 2904
2905/* The following three routines are needed for running a window's
2906 configuration change hook. */
3026static void 2907static void
3027run_funs (Lisp_Object funs) 2908run_funs (Lisp_Object funs)
3028{ 2909{
@@ -3031,8 +2912,19 @@ run_funs (Lisp_Object funs)
3031 call0 (XCAR (funs)); 2912 call0 (XCAR (funs));
3032} 2913}
3033 2914
3034static Lisp_Object select_window_norecord (Lisp_Object window); 2915static Lisp_Object
3035static Lisp_Object select_frame_norecord (Lisp_Object frame); 2916select_window_norecord (Lisp_Object window)
2917{
2918 return WINDOW_LIVE_P (window)
2919 ? Fselect_window (window, Qt) : selected_window;
2920}
2921
2922static Lisp_Object
2923select_frame_norecord (Lisp_Object frame)
2924{
2925 return FRAME_LIVE_P (XFRAME (frame))
2926 ? Fselect_frame (frame, Qt) : selected_frame;
2927}
3036 2928
3037void 2929void
3038run_window_configuration_change_hook (struct frame *f) 2930run_window_configuration_change_hook (struct frame *f)
@@ -3209,11 +3101,13 @@ WINDOW can be any window and defaults to the selected one. */)
3209 3101
3210DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, 3102DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0,
3211 doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. 3103 doc: /* Make WINDOW display BUFFER-OR-NAME as its contents.
3212WINDOW defaults to the selected window. BUFFER-OR-NAME must be a buffer 3104WINDOW has to be a live window and defaults to the selected one.
3213or the name of an existing buffer. Optional third argument KEEP-MARGINS 3105BUFFER-OR-NAME must be a buffer or the name of an existing buffer.
3214non-nil means that WINDOW's current display margins, fringe widths, and 3106
3215scroll bar settings are preserved; the default is to reset these from 3107Optional third argument KEEP-MARGINS non-nil means that WINDOW's current
3216the local settings for BUFFER-OR-NAME or the frame defaults. Return nil. 3108display margins, fringe widths, and scroll bar settings are preserved;
3109the default is to reset these from the local settings for BUFFER-OR-NAME
3110or the frame defaults. Return nil.
3217 3111
3218This function throws an error when WINDOW is strongly dedicated to its 3112This function throws an error when WINDOW is strongly dedicated to its
3219buffer (that is `window-dedicated-p' returns t for WINDOW) and does not 3113buffer (that is `window-dedicated-p' returns t for WINDOW) and does not
@@ -3238,32 +3132,26 @@ This function runs `window-scroll-functions' before running
3238 else if (!EQ (tem, Qt)) 3132 else if (!EQ (tem, Qt))
3239 /* w->buffer is t when the window is first being set up. */ 3133 /* w->buffer is t when the window is first being set up. */
3240 { 3134 {
3241 if (EQ (tem, buffer)) 3135 if (!EQ (tem, buffer))
3242 return Qnil; 3136 {
3243 else if (EQ (w->dedicated, Qt)) 3137 if (EQ (w->dedicated, Qt))
3244 error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name))); 3138 /* WINDOW is strongly dedicated to its buffer, signal an
3245 else 3139 error. */
3246 w->dedicated = Qnil; 3140 error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name)));
3141 else
3142 /* WINDOW is weakly dedicated to its buffer, reset
3143 dedicatedness. */
3144 w->dedicated = Qnil;
3145
3146 call1 (Qrecord_window_buffer, window);
3147 }
3247 3148
3248 unshow_buffer (w); 3149 unshow_buffer (w);
3249 } 3150 }
3250 3151
3251 set_window_buffer (window, buffer, 1, !NILP (keep_margins)); 3152 set_window_buffer (window, buffer, 1, !NILP (keep_margins));
3252 return Qnil;
3253}
3254 3153
3255static Lisp_Object 3154 return Qnil;
3256select_window_norecord (Lisp_Object window)
3257{
3258 return WINDOW_LIVE_P (window)
3259 ? Fselect_window (window, Qt) : selected_window;
3260}
3261
3262static Lisp_Object
3263select_frame_norecord (Lisp_Object frame)
3264{
3265 return FRAME_LIVE_P (XFRAME (frame))
3266 ? Fselect_frame (frame, Qt) : selected_frame;
3267} 3155}
3268 3156
3269static Lisp_Object 3157static Lisp_Object
@@ -3336,7 +3224,10 @@ temp_output_buffer_show (register Lisp_Object buf)
3336 call1 (Vtemp_buffer_show_function, buf); 3224 call1 (Vtemp_buffer_show_function, buf);
3337 else 3225 else
3338 { 3226 {
3339 window = display_buffer (buf, Qnil, Qnil); 3227 window = display_buffer (buf, Vtemp_buffer_show_specifiers, Qnil);
3228 /* Reset Vtemp_buffer_show_specifiers immediately so it won't
3229 affect subsequent calls. */
3230 Vtemp_buffer_show_specifiers = Qnil;
3340 3231
3341 if (!EQ (XWINDOW (window)->frame, selected_frame)) 3232 if (!EQ (XWINDOW (window)->frame, selected_frame))
3342 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 3233 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
@@ -3799,7 +3690,7 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3799DEFUN ("split-window-internal", Fsplit_window_internal, Ssplit_window_internal, 4, 4, 0, 3690DEFUN ("split-window-internal", Fsplit_window_internal, Ssplit_window_internal, 4, 4, 0,
3800 doc: /* Split window OLD. 3691 doc: /* Split window OLD.
3801Second argument TOTAL-SIZE specifies the number of lines or columns of the 3692Second argument TOTAL-SIZE specifies the number of lines or columns of the
3802new window. In any case TOTAL-SIZE must be a positive integer 3693new window. In any case TOTAL-SIZE must be a positive integer.
3803 3694
3804Third argument SIDE nil (or `below') specifies that the new window shall 3695Third argument SIDE nil (or `below') specifies that the new window shall
3805be located below WINDOW. SIDE `above' means the new window shall be 3696be located below WINDOW. SIDE `above' means the new window shall be
@@ -4280,7 +4171,6 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4280 else error ("Failed to resize minibuffer window"); 4171 else error ("Failed to resize minibuffer window");
4281} 4172}
4282 4173
4283
4284/* Mark window cursors off for all windows in the window tree rooted 4174/* Mark window cursors off for all windows in the window tree rooted
4285 at W by setting their phys_cursor_on_p flag to zero. Called from 4175 at W by setting their phys_cursor_on_p flag to zero. Called from
4286 xterm.c, e.g. when a frame is cleared and thereby all cursors on 4176 xterm.c, e.g. when a frame is cleared and thereby all cursors on
@@ -5337,7 +5227,6 @@ and redisplay normally--don't erase and redraw the frame. */)
5337 return Qnil; 5227 return Qnil;
5338} 5228}
5339 5229
5340
5341DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, 5230DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
5342 0, 1, 0, 5231 0, 1, 0,
5343 doc: /* Return the height in lines of the text display area of WINDOW. 5232 doc: /* Return the height in lines of the text display area of WINDOW.
@@ -5510,6 +5399,7 @@ the return value is nil. Otherwise the value is t. */)
5510 struct Lisp_Vector *saved_windows; 5399 struct Lisp_Vector *saved_windows;
5511 Lisp_Object new_current_buffer; 5400 Lisp_Object new_current_buffer;
5512 Lisp_Object frame; 5401 Lisp_Object frame;
5402 Lisp_Object auto_buffer_name;
5513 FRAME_PTR f; 5403 FRAME_PTR f;
5514 EMACS_INT old_point = -1; 5404 EMACS_INT old_point = -1;
5515 5405
@@ -5565,6 +5455,8 @@ the return value is nil. Otherwise the value is t. */)
5565 However, there is other stuff we should still try to do below. */ 5455 However, there is other stuff we should still try to do below. */
5566 if (FRAME_LIVE_P (f)) 5456 if (FRAME_LIVE_P (f))
5567 { 5457 {
5458 Lisp_Object window;
5459 Lisp_Object dead_windows = Qnil;
5568 register struct window *w; 5460 register struct window *w;
5569 register struct saved_window *p; 5461 register struct saved_window *p;
5570 struct window *root_window; 5462 struct window *root_window;
@@ -5641,7 +5533,8 @@ the return value is nil. Otherwise the value is t. */)
5641 for (k = 0; k < saved_windows->header.size; k++) 5533 for (k = 0; k < saved_windows->header.size; k++)
5642 { 5534 {
5643 p = SAVED_WINDOW_N (saved_windows, k); 5535 p = SAVED_WINDOW_N (saved_windows, k);
5644 w = XWINDOW (p->window); 5536 window = p->window;
5537 w = XWINDOW (window);
5645 w->next = Qnil; 5538 w->next = Qnil;
5646 5539
5647 if (!NILP (p->parent)) 5540 if (!NILP (p->parent))
@@ -5704,55 +5597,70 @@ the return value is nil. Otherwise the value is t. */)
5704 5597
5705 /* Reinstall the saved buffer and pointers into it. */ 5598 /* Reinstall the saved buffer and pointers into it. */
5706 if (NILP (p->buffer)) 5599 if (NILP (p->buffer))
5600 /* An internal window. */
5707 w->buffer = p->buffer; 5601 w->buffer = p->buffer;
5602 else if (!NILP (BVAR (XBUFFER (p->buffer), name)))
5603 /* If saved buffer is alive, install it. */
5604 {
5605 w->buffer = p->buffer;
5606 w->start_at_line_beg = p->start_at_line_beg;
5607 set_marker_restricted (w->start, p->start, w->buffer);
5608 set_marker_restricted (w->pointm, p->pointm, w->buffer);
5609 Fset_marker (BVAR (XBUFFER (w->buffer), mark),
5610 p->mark, w->buffer);
5611
5612 /* As documented in Fcurrent_window_configuration, don't
5613 restore the location of point in the buffer which was
5614 current when the window configuration was recorded. */
5615 if (!EQ (p->buffer, new_current_buffer)
5616 && XBUFFER (p->buffer) == current_buffer)
5617 Fgoto_char (w->pointm);
5618 }
5619 else if (!NILP (w->buffer) && !NILP (BVAR (XBUFFER (w->buffer), name)))
5620 /* Keep window's old buffer; make sure the markers are
5621 real. */
5622 {
5623 /* Set window markers at start of visible range. */
5624 if (XMARKER (w->start)->buffer == 0)
5625 set_marker_restricted (w->start, make_number (0),
5626 w->buffer);
5627 if (XMARKER (w->pointm)->buffer == 0)
5628 set_marker_restricted_both (w->pointm, w->buffer,
5629 BUF_PT (XBUFFER (w->buffer)),
5630 BUF_PT_BYTE (XBUFFER (w->buffer)));
5631 w->start_at_line_beg = Qt;
5632 }
5633 else if (STRINGP (auto_buffer_name =
5634 Fwindow_parameter (window, Qauto_buffer_name))
5635 && SCHARS (auto_buffer_name) != 0
5636 && !NILP (w->buffer = Fget_buffer_create (auto_buffer_name)))
5637 {
5638 set_marker_restricted (w->start, make_number (0), w->buffer);
5639 set_marker_restricted (w->pointm, make_number (0), w->buffer);
5640 w->start_at_line_beg = Qt;
5641 }
5708 else 5642 else
5643 /* Window has no live buffer, get one. */
5709 { 5644 {
5710 if (!NILP (BVAR (XBUFFER (p->buffer), name))) 5645 /* Get the buffer via other_buffer_safely in order to
5711 /* If saved buffer is alive, install it. */ 5646 avoid showing an unimportant buffer and, if necessary, to
5712 { 5647 recreate *scratch* in the course (part of Juanma's bs-show
5713 w->buffer = p->buffer; 5648 scenario from March 2011). */
5714 w->start_at_line_beg = p->start_at_line_beg; 5649 w->buffer = other_buffer_safely (Fcurrent_buffer ());
5715 set_marker_restricted (w->start, p->start, w->buffer); 5650 /* This will set the markers to beginning of visible
5716 set_marker_restricted (w->pointm, p->pointm, w->buffer); 5651 range. */
5717 Fset_marker (BVAR (XBUFFER (w->buffer), mark), 5652 set_marker_restricted (w->start, make_number (0), w->buffer);
5718 p->mark, w->buffer); 5653 set_marker_restricted (w->pointm, make_number (0), w->buffer);
5719 5654 w->start_at_line_beg = Qt;
5720 /* As documented in Fcurrent_window_configuration, don't 5655 if (!NILP (w->dedicated))
5721 restore the location of point in the buffer which was 5656 /* Record this window as dead. */
5722 current when the window configuration was recorded. */ 5657 dead_windows = Fcons (window, dead_windows);
5723 if (!EQ (p->buffer, new_current_buffer) 5658 /* Make sure window is no more dedicated. */
5724 && XBUFFER (p->buffer) == current_buffer) 5659 w->dedicated = Qnil;
5725 Fgoto_char (w->pointm);
5726 }
5727 else if (NILP (w->buffer) || NILP (BVAR (XBUFFER (w->buffer), name)))
5728 /* Else unless window has a live buffer, get one. */
5729 {
5730 w->buffer = Fcdr (Fcar (Vbuffer_alist));
5731 /* This will set the markers to beginning of visible
5732 range. */
5733 set_marker_restricted (w->start, make_number (0), w->buffer);
5734 set_marker_restricted (w->pointm, make_number (0),w->buffer);
5735 w->start_at_line_beg = Qt;
5736 }
5737 else
5738 /* Keeping window's old buffer; make sure the markers
5739 are real. */
5740 {
5741 /* Set window markers at start of visible range. */
5742 if (XMARKER (w->start)->buffer == 0)
5743 set_marker_restricted (w->start, make_number (0),
5744 w->buffer);
5745 if (XMARKER (w->pointm)->buffer == 0)
5746 set_marker_restricted_both (w->pointm, w->buffer,
5747 BUF_PT (XBUFFER (w->buffer)),
5748 BUF_PT_BYTE (XBUFFER (w->buffer)));
5749 w->start_at_line_beg = Qt;
5750 }
5751 } 5660 }
5752 } 5661 }
5753 5662
5754 FRAME_ROOT_WINDOW (f) = data->root_window; 5663 FRAME_ROOT_WINDOW (f) = data->root_window;
5755
5756 /* Arrange *not* to restore point in the buffer that was 5664 /* Arrange *not* to restore point in the buffer that was
5757 current when the window configuration was saved. */ 5665 current when the window configuration was saved. */
5758 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) 5666 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer))
@@ -5760,10 +5668,10 @@ the return value is nil. Otherwise the value is t. */)
5760 make_number (old_point), 5668 make_number (old_point),
5761 XWINDOW (data->current_window)->buffer); 5669 XWINDOW (data->current_window)->buffer);
5762 5670
5763 /* In the following call to `select-window, prevent "swapping 5671 /* In the following call to `select-window', prevent "swapping out
5764 out point" in the old selected window using the buffer that 5672 point" in the old selected window using the buffer that has
5765 has been restored into it. We already swapped out that point 5673 been restored into it. We already swapped out that point from
5766 from that window's old buffer. */ 5674 that window's old buffer. */
5767 select_window (data->current_window, Qnil, 1); 5675 select_window (data->current_window, Qnil, 1);
5768 BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) 5676 BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window)
5769 = selected_window; 5677 = selected_window;
@@ -5804,9 +5712,16 @@ the return value is nil. Otherwise the value is t. */)
5804 } 5712 }
5805 5713
5806 adjust_glyphs (f); 5714 adjust_glyphs (f);
5807
5808 UNBLOCK_INPUT; 5715 UNBLOCK_INPUT;
5809 5716
5717 /* Scan dead buffer windows. */
5718 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows))
5719 {
5720 window = XCAR (dead_windows);
5721 if (WINDOW_LIVE_P (window) && !EQ (window, FRAME_ROOT_WINDOW (f)))
5722 delete_deletable_window (window);
5723 }
5724
5810 /* Fselect_window will have made f the selected frame, so we 5725 /* Fselect_window will have made f the selected frame, so we
5811 reselect the proper frame here. Fhandle_switch_frame will change the 5726 reselect the proper frame here. Fhandle_switch_frame will change the
5812 selected window too, but that doesn't make the call to 5727 selected window too, but that doesn't make the call to
@@ -6052,82 +5967,6 @@ redirection (see `redirect-frame-focus'). */)
6052 XSETWINDOW_CONFIGURATION (tem, data); 5967 XSETWINDOW_CONFIGURATION (tem, data);
6053 return (tem); 5968 return (tem);
6054} 5969}
6055
6056
6057/***********************************************************************
6058 Window Split Tree
6059 ***********************************************************************/
6060
6061static Lisp_Object
6062window_tree (struct window *w)
6063{
6064 Lisp_Object tail = Qnil;
6065 Lisp_Object result = Qnil;
6066
6067 while (w)
6068 {
6069 Lisp_Object wn;
6070
6071 XSETWINDOW (wn, w);
6072 if (!NILP (w->hchild))
6073 wn = Fcons (Qnil, Fcons (Fwindow_edges (wn),
6074 window_tree (XWINDOW (w->hchild))));
6075 else if (!NILP (w->vchild))
6076 wn = Fcons (Qt, Fcons (Fwindow_edges (wn),
6077 window_tree (XWINDOW (w->vchild))));
6078
6079 if (NILP (result))
6080 {
6081 result = tail = Fcons (wn, Qnil);
6082 }
6083 else
6084 {
6085 XSETCDR (tail, Fcons (wn, Qnil));
6086 tail = XCDR (tail);
6087 }
6088
6089 w = NILP (w->next) ? 0 : XWINDOW (w->next);
6090 }
6091
6092 return result;
6093}
6094
6095
6096
6097DEFUN ("window-tree", Fwindow_tree, Swindow_tree,
6098 0, 1, 0,
6099 doc: /* Return the window tree for frame FRAME.
6100
6101The return value is a list of the form (ROOT MINI), where ROOT
6102represents the window tree of the frame's root window, and MINI
6103is the frame's minibuffer window.
6104
6105If the root window is not split, ROOT is the root window itself.
6106Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil for a
6107horizontal split, and t for a vertical split, EDGES gives the combined
6108size and position of the subwindows in the split, and the rest of the
6109elements are the subwindows in the split. Each of the subwindows may
6110again be a window or a list representing a window split, and so on.
6111EDGES is a list \(LEFT TOP RIGHT BOTTOM) as returned by `window-edges'.
6112
6113If FRAME is nil or omitted, return information on the currently
6114selected frame. */)
6115 (Lisp_Object frame)
6116{
6117 FRAME_PTR f;
6118
6119 if (NILP (frame))
6120 frame = selected_frame;
6121
6122 CHECK_FRAME (frame);
6123 f = XFRAME (frame);
6124
6125 if (!FRAME_LIVE_P (f))
6126 return Qnil;
6127
6128 return window_tree (XWINDOW (FRAME_ROOT_WINDOW (f)));
6129}
6130
6131 5970
6132/*********************************************************************** 5971/***********************************************************************
6133 Marginal Areas 5972 Marginal Areas
@@ -6487,116 +6326,81 @@ freeze_window_starts (struct frame *f, int freeze_p)
6487 Initialization 6326 Initialization
6488 ***********************************************************************/ 6327 ***********************************************************************/
6489 6328
6490/* Return 1 if window configurations C1 and C2 6329/* Return 1 if window configurations CONFIGURATION1 and CONFIGURATION2
6491 describe the same state of affairs. This is used by Fequal. */ 6330 describe the same state of affairs. This is used by Fequal.
6331
6332 ignore_positions non-zero means ignore non-matching scroll positions
6333 and the like.
6334
6335 This ignores a couple of things like the dedicatedness status of
6336 window, splits, nest and the like. This might have to be fixed. */
6492 6337
6493int 6338int
6494compare_window_configurations (Lisp_Object c1, Lisp_Object c2, int ignore_positions) 6339compare_window_configurations (Lisp_Object configuration1, Lisp_Object configuration2, int ignore_positions)
6495{ 6340{
6496 register struct save_window_data *d1, *d2; 6341 register struct save_window_data *d1, *d2;
6497 struct Lisp_Vector *sw1, *sw2; 6342 struct Lisp_Vector *sws1, *sws2;
6498 int i; 6343 int i;
6499 6344
6500 CHECK_WINDOW_CONFIGURATION (c1); 6345 CHECK_WINDOW_CONFIGURATION (configuration1);
6501 CHECK_WINDOW_CONFIGURATION (c2); 6346 CHECK_WINDOW_CONFIGURATION (configuration2);
6502 6347
6503 d1 = (struct save_window_data *) XVECTOR (c1); 6348 d1 = (struct save_window_data *) XVECTOR (configuration1);
6504 d2 = (struct save_window_data *) XVECTOR (c2); 6349 d2 = (struct save_window_data *) XVECTOR (configuration2);
6505 sw1 = XVECTOR (d1->saved_windows); 6350 sws1 = XVECTOR (d1->saved_windows);
6506 sw2 = XVECTOR (d2->saved_windows); 6351 sws2 = XVECTOR (d2->saved_windows);
6507 6352
6508 if (d1->frame_cols != d2->frame_cols) 6353 /* Frame settings must match. */
6509 return 0; 6354 if (d1->frame_cols != d2->frame_cols
6510 if (d1->frame_lines != d2->frame_lines) 6355 || d1->frame_lines != d2->frame_lines
6511 return 0; 6356 || d1->frame_menu_bar_lines != d2->frame_menu_bar_lines
6512 if (d1->frame_menu_bar_lines != d2->frame_menu_bar_lines) 6357 || !EQ (d1->selected_frame, d2->selected_frame)
6513 return 0; 6358 || !EQ (d1->current_buffer, d2->current_buffer)
6514 if (! EQ (d1->selected_frame, d2->selected_frame)) 6359 || (!ignore_positions
6515 return 0; 6360 && (!EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window)
6516 /* Don't compare the current_window field directly. 6361 || !EQ (d1->minibuf_selected_window, d2->minibuf_selected_window)))
6517 Instead see w1_is_current and w2_is_current, below. */ 6362 || !EQ (d1->focus_frame, d2->focus_frame)
6518 if (! EQ (d1->current_buffer, d2->current_buffer)) 6363 /* Verify that the two configurations have the same number of windows. */
6519 return 0; 6364 || sws1->header.size != sws2->header.size)
6520 if (! ignore_positions)
6521 {
6522 if (! EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window))
6523 return 0;
6524 if (! EQ (d1->minibuf_selected_window, d2->minibuf_selected_window))
6525 return 0;
6526 }
6527 /* Don't compare the root_window field.
6528 We don't require the two configurations
6529 to use the same window object,
6530 and the two root windows must be equivalent
6531 if everything else compares equal. */
6532 if (! EQ (d1->focus_frame, d2->focus_frame))
6533 return 0;
6534
6535 /* Verify that the two confis have the same number of windows. */
6536 if (sw1->header.size != sw2->header.size)
6537 return 0; 6365 return 0;
6538 6366
6539 for (i = 0; i < sw1->header.size; i++) 6367 for (i = 0; i < sws1->header.size; i++)
6540 { 6368 {
6541 struct saved_window *p1, *p2; 6369 struct saved_window *sw1, *sw2;
6542 int w1_is_current, w2_is_current; 6370
6543 6371 sw1 = SAVED_WINDOW_N (sws1, i);
6544 p1 = SAVED_WINDOW_N (sw1, i); 6372 sw2 = SAVED_WINDOW_N (sws2, i);
6545 p2 = SAVED_WINDOW_N (sw2, i); 6373
6546 6374 if (
6547 /* Verify that the current windows in the two 6375 /* The "current" windows in the two configurations must
6548 configurations correspond to each other. */ 6376 correspond to each other. */
6549 w1_is_current = EQ (d1->current_window, p1->window); 6377 EQ (d1->current_window, sw1->window)
6550 w2_is_current = EQ (d2->current_window, p2->window); 6378 != EQ (d2->current_window, sw2->window)
6551 6379 /* Windows' buffers must match. */
6552 if (w1_is_current != w2_is_current) 6380 || !EQ (sw1->buffer, sw2->buffer)
6553 return 0; 6381 || !EQ (sw1->left_col, sw2->left_col)
6554 6382 || !EQ (sw1->top_line, sw2->top_line)
6555 /* Verify that the corresponding windows do match. */ 6383 || !EQ (sw1->total_cols, sw2->total_cols)
6556 if (! EQ (p1->buffer, p2->buffer)) 6384 || !EQ (sw1->total_lines, sw2->total_lines)
6557 return 0; 6385 || !EQ (sw1->display_table, sw2->display_table)
6558 if (! EQ (p1->left_col, p2->left_col)) 6386 /* The next two disjuncts check the window structure for
6559 return 0; 6387 equality. */
6560 if (! EQ (p1->top_line, p2->top_line)) 6388 || !EQ (sw1->parent, sw2->parent)
6561 return 0; 6389 || !EQ (sw1->prev, sw2->prev)
6562 if (! EQ (p1->total_cols, p2->total_cols)) 6390 || (!ignore_positions
6563 return 0; 6391 && (!EQ (sw1->hscroll, sw2->hscroll)
6564 if (! EQ (p1->total_lines, p2->total_lines)) 6392 || !EQ (sw1->min_hscroll, sw2->min_hscroll)
6565 return 0; 6393 || !EQ (sw1->start_at_line_beg, sw2->start_at_line_beg)
6566 if (! EQ (p1->display_table, p2->display_table)) 6394 || NILP (Fequal (sw1->start, sw2->start))
6567 return 0; 6395 || NILP (Fequal (sw1->pointm, sw2->pointm))
6568 if (! EQ (p1->parent, p2->parent)) 6396 || NILP (Fequal (sw1->mark, sw2->mark))))
6569 return 0; 6397 || !EQ (sw1->left_margin_cols, sw2->left_margin_cols)
6570 if (! EQ (p1->prev, p2->prev)) 6398 || !EQ (sw1->right_margin_cols, sw2->right_margin_cols)
6571 return 0; 6399 || !EQ (sw1->left_fringe_width, sw2->left_fringe_width)
6572 if (! ignore_positions) 6400 || !EQ (sw1->right_fringe_width, sw2->right_fringe_width)
6573 { 6401 || !EQ (sw1->fringes_outside_margins, sw2->fringes_outside_margins)
6574 if (! EQ (p1->hscroll, p2->hscroll)) 6402 || !EQ (sw1->scroll_bar_width, sw2->scroll_bar_width)
6575 return 0; 6403 || !EQ (sw1->vertical_scroll_bar_type, sw2->vertical_scroll_bar_type))
6576 if (!EQ (p1->min_hscroll, p2->min_hscroll))
6577 return 0;
6578 if (! EQ (p1->start_at_line_beg, p2->start_at_line_beg))
6579 return 0;
6580 if (NILP (Fequal (p1->start, p2->start)))
6581 return 0;
6582 if (NILP (Fequal (p1->pointm, p2->pointm)))
6583 return 0;
6584 if (NILP (Fequal (p1->mark, p2->mark)))
6585 return 0;
6586 }
6587 if (! EQ (p1->left_margin_cols, p2->left_margin_cols))
6588 return 0;
6589 if (! EQ (p1->right_margin_cols, p2->right_margin_cols))
6590 return 0;
6591 if (! EQ (p1->left_fringe_width, p2->left_fringe_width))
6592 return 0;
6593 if (! EQ (p1->right_fringe_width, p2->right_fringe_width))
6594 return 0;
6595 if (! EQ (p1->fringes_outside_margins, p2->fringes_outside_margins))
6596 return 0;
6597 if (! EQ (p1->scroll_bar_width, p2->scroll_bar_width))
6598 return 0;
6599 if (! EQ (p1->vertical_scroll_bar_type, p2->vertical_scroll_bar_type))
6600 return 0; 6404 return 0;
6601 } 6405 }
6602 6406
@@ -6719,6 +6523,16 @@ If this function is used, then it must do the entire job of showing
6719the buffer; `temp-buffer-show-hook' is not run unless this function runs it. */); 6523the buffer; `temp-buffer-show-hook' is not run unless this function runs it. */);
6720 Vtemp_buffer_show_function = Qnil; 6524 Vtemp_buffer_show_function = Qnil;
6721 6525
6526 DEFVAR_LISP ("temp-buffer-show-specifiers", Vtemp_buffer_show_specifiers,
6527 doc: /* Buffer display specifiers used by `with-output-to-temp-buffer'.
6528These specifiers are passed by `with-output-to-temp-buffer' as second
6529argument to `display-buffer'. Applications should only let-bind this
6530around a call to `with-output-to-temp-buffer'.
6531
6532For a description of buffer display specifiers see the variable
6533`display-buffer-alist'. */);
6534 Vtemp_buffer_show_specifiers = Qnil;
6535
6722 DEFVAR_LISP ("minibuffer-scroll-window", Vminibuf_scroll_window, 6536 DEFVAR_LISP ("minibuffer-scroll-window", Vminibuf_scroll_window,
6723 doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll. */); 6537 doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll. */);
6724 Vminibuf_scroll_window = Qnil; 6538 Vminibuf_scroll_window = Qnil;
@@ -6734,16 +6548,16 @@ is displayed in the `mode-line' face. */);
6734 Vother_window_scroll_buffer = Qnil; 6548 Vother_window_scroll_buffer = Qnil;
6735 6549
6736 DEFVAR_BOOL ("auto-window-vscroll", auto_window_vscroll_p, 6550 DEFVAR_BOOL ("auto-window-vscroll", auto_window_vscroll_p,
6737 doc: /* *Non-nil means to automatically adjust `window-vscroll' to view tall lines. */); 6551 doc: /* Non-nil means to automatically adjust `window-vscroll' to view tall lines. */);
6738 auto_window_vscroll_p = 1; 6552 auto_window_vscroll_p = 1;
6739 6553
6740 DEFVAR_INT ("next-screen-context-lines", next_screen_context_lines, 6554 DEFVAR_INT ("next-screen-context-lines", next_screen_context_lines,
6741 doc: /* *Number of lines of continuity when scrolling by screenfuls. */); 6555 doc: /* Number of lines of continuity when scrolling by screenfuls. */);
6742 next_screen_context_lines = 2; 6556 next_screen_context_lines = 2;
6743 6557
6744 DEFVAR_LISP ("scroll-preserve-screen-position", 6558 DEFVAR_LISP ("scroll-preserve-screen-position",
6745 Vscroll_preserve_screen_position, 6559 Vscroll_preserve_screen_position,
6746 doc: /* *Controls if scroll commands move point to keep its screen position unchanged. 6560 doc: /* Controls if scroll commands move point to keep its screen position unchanged.
6747A value of nil means point does not keep its screen position except 6561A value of nil means point does not keep its screen position except
6748at the scroll margin or window boundary respectively. 6562at the scroll margin or window boundary respectively.
6749A value of t means point keeps its screen position if the scroll 6563A value of t means point keeps its screen position if the scroll
@@ -6865,10 +6679,7 @@ function `window-nest' and altered by the function `set-window-nest'. */);
6865 defsubr (&Sset_window_display_table); 6679 defsubr (&Sset_window_display_table);
6866 defsubr (&Snext_window); 6680 defsubr (&Snext_window);
6867 defsubr (&Sprevious_window); 6681 defsubr (&Sprevious_window);
6868 defsubr (&Sother_window);
6869 defsubr (&Sget_buffer_window); 6682 defsubr (&Sget_buffer_window);
6870 defsubr (&Sdelete_windows_on);
6871 defsubr (&Sreplace_buffer_in_windows);
6872 defsubr (&Sdelete_other_windows_internal); 6683 defsubr (&Sdelete_other_windows_internal);
6873 defsubr (&Sdelete_window_internal); 6684 defsubr (&Sdelete_window_internal);
6874 defsubr (&Sresize_mini_window_internal); 6685 defsubr (&Sresize_mini_window_internal);
@@ -6893,7 +6704,6 @@ function `window-nest' and altered by the function `set-window-nest'. */);
6893 defsubr (&Swindow_configuration_frame); 6704 defsubr (&Swindow_configuration_frame);
6894 defsubr (&Sset_window_configuration); 6705 defsubr (&Sset_window_configuration);
6895 defsubr (&Scurrent_window_configuration); 6706 defsubr (&Scurrent_window_configuration);
6896 defsubr (&Swindow_tree);
6897 defsubr (&Sset_window_margins); 6707 defsubr (&Sset_window_margins);
6898 defsubr (&Swindow_margins); 6708 defsubr (&Swindow_margins);
6899 defsubr (&Sset_window_fringes); 6709 defsubr (&Sset_window_fringes);
@@ -6917,7 +6727,6 @@ function `window-nest' and altered by the function `set-window-nest'. */);
6917void 6727void
6918keys_of_window (void) 6728keys_of_window (void)
6919{ 6729{
6920 initial_define_key (control_x_map, 'o', "other-window");
6921 initial_define_key (control_x_map, '<', "scroll-left"); 6730 initial_define_key (control_x_map, '<', "scroll-left");
6922 initial_define_key (control_x_map, '>', "scroll-right"); 6731 initial_define_key (control_x_map, '>', "scroll-right");
6923 6732