Mercurial > emacs
annotate src/window.c @ 30045:ff2db81c11c1
(delete_all_subwindows): Reset Vwindow_list.
| author | Gerd Moellmann <gerd@gnu.org> |
|---|---|
| date | Wed, 05 Jul 2000 11:53:35 +0000 |
| parents | 07f23448b6e5 |
| children | 22f8fc642575 |
| rev | line source |
|---|---|
| 265 | 1 /* Window creation, deletion and examination for GNU Emacs. |
| 2 Does not include redisplay. | |
| 20708 | 3 Copyright (C) 1985,86,87,93,94,95,96,97,1998 Free Software Foundation, Inc. |
| 265 | 4 |
| 5 This file is part of GNU Emacs. | |
| 6 | |
| 7 GNU Emacs is free software; you can redistribute it and/or modify | |
| 8 it under the terms of the GNU General Public License as published by | |
| 708 | 9 the Free Software Foundation; either version 2, or (at your option) |
| 265 | 10 any later version. |
| 11 | |
| 12 GNU Emacs is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
| 18 along with GNU Emacs; see the file COPYING. If not, write to | |
|
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14175
diff
changeset
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14175
diff
changeset
|
20 Boston, MA 02111-1307, USA. */ |
| 265 | 21 |
|
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4570
diff
changeset
|
22 #include <config.h> |
| 265 | 23 #include "lisp.h" |
| 24 #include "buffer.h" | |
| 769 | 25 #include "frame.h" |
| 265 | 26 #include "window.h" |
| 27 #include "commands.h" | |
| 28 #include "indent.h" | |
| 29 #include "termchar.h" | |
| 30 #include "disptab.h" | |
| 522 | 31 #include "keyboard.h" |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
32 #include "dispextern.h" |
| 18657 | 33 #include "blockinput.h" |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
34 #include "intervals.h" |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
35 |
|
21825
697991d2a2c4
Conditionally include xterm.h using HAVE_X_WINDOWS.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21533
diff
changeset
|
36 #ifdef HAVE_X_WINDOWS |
| 21514 | 37 #include "xterm.h" |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
38 #endif /* HAVE_X_WINDOWS */ |
|
27633
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
39 #ifdef WINDOWSNT |
|
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
40 #include "w32term.h" |
|
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
41 #endif |
|
27956
8d38dbe58989
[MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents:
27869
diff
changeset
|
42 #ifdef MSDOS |
|
8d38dbe58989
[MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents:
27869
diff
changeset
|
43 #include "msdos.h" |
|
8d38dbe58989
[MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents:
27869
diff
changeset
|
44 #endif |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
45 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
46 #ifndef max |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
47 #define max(a, b) ((a) < (b) ? (b) : (a)) |
| 21514 | 48 #endif |
| 265 | 49 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
50 |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
51 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; |
|
25540
2b4bdd114899
(Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents:
25517
diff
changeset
|
52 Lisp_Object Qwindow_size_fixed, Qleft_bitmap_area, Qright_bitmap_area; |
| 25268 | 53 extern Lisp_Object Qheight, Qwidth; |
| 265 | 54 |
| 20351 | 55 static struct window *decode_window P_ ((Lisp_Object)); |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
56 static Lisp_Object select_window_1 P_ ((Lisp_Object, int)); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
57 static int count_windows P_ ((struct window *)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
58 static int get_leaf_windows P_ ((struct window *, struct window **, int)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
59 static void window_scroll P_ ((Lisp_Object, int, int, int)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
60 static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
61 static void window_scroll_line_based P_ ((Lisp_Object, int, int, int)); |
| 25268 | 62 static int window_min_size_1 P_ ((struct window *, int)); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
63 static int window_min_size P_ ((struct window *, int, int, int *)); |
| 25268 | 64 static void size_window P_ ((Lisp_Object, int, int, int)); |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
65 static int foreach_window_1 P_ ((struct window *, int (*fn) (), int, int, |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
66 int, int, int, int, int, int, int)); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
67 static int freeze_window_start P_ ((struct window *, int)); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
68 static int window_fixed_size_p P_ ((struct window *, int, int)); |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
69 static void enlarge_window P_ ((Lisp_Object, int, int)); |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
70 static Lisp_Object window_list P_ ((void)); |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
71 static int add_window_to_list P_ ((struct window *, Lisp_Object *)); |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
72 static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
73 static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object, |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
74 Lisp_Object, int)); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
75 static void decode_next_window_args P_ ((Lisp_Object *, Lisp_Object *, |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
76 Lisp_Object *)); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
77 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
78 |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
79 |
| 265 | 80 /* This is the window in which the terminal's cursor should |
| 81 be left when nothing is being done with it. This must | |
| 82 always be a leaf window, and its buffer is selected by | |
| 83 the top level editing loop at the end of each command. | |
| 84 | |
| 85 This value is always the same as | |
| 769 | 86 FRAME_SELECTED_WINDOW (selected_frame). */ |
| 265 | 87 |
| 88 Lisp_Object selected_window; | |
| 89 | |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
90 /* A list of all windows for use by next_window and Fwindow_list. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
91 Functions creating or deleting windows should invalidate this cache |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
92 by setting it to nil. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
93 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
94 Lisp_Object Vwindow_list; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
95 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
96 /* The mini-buffer window of the selected frame. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
97 Note that you cannot test for mini-bufferness of an arbitrary window |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
98 by comparing against this; but you can test for mini-bufferness of |
| 265 | 99 the selected window. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
100 |
| 265 | 101 Lisp_Object minibuf_window; |
| 102 | |
| 103 /* Non-nil means it is the window for C-M-v to scroll | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
104 when the mini-buffer is selected. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
105 |
| 265 | 106 Lisp_Object Vminibuf_scroll_window; |
| 107 | |
| 108 /* Non-nil means this is the buffer whose window C-M-v should scroll. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
109 |
| 265 | 110 Lisp_Object Vother_window_scroll_buffer; |
| 111 | |
| 112 /* Non-nil means it's function to call to display temp buffers. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
113 |
| 265 | 114 Lisp_Object Vtemp_buffer_show_function; |
| 115 | |
| 116 /* If a window gets smaller than either of these, it is removed. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
117 |
| 265 | 118 int window_min_height; |
| 119 int window_min_width; | |
| 120 | |
| 121 /* Nonzero implies Fdisplay_buffer should create windows. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
122 |
| 265 | 123 int pop_up_windows; |
| 124 | |
| 769 | 125 /* Nonzero implies make new frames for Fdisplay_buffer. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
126 |
| 769 | 127 int pop_up_frames; |
| 265 | 128 |
| 129 /* Non-nil means use this function instead of default */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
130 |
| 769 | 131 Lisp_Object Vpop_up_frame_function; |
| 265 | 132 |
| 133 /* Function to call to handle Fdisplay_buffer. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
134 |
| 265 | 135 Lisp_Object Vdisplay_buffer_function; |
| 136 | |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
137 /* List of buffer *names* for buffers that should have their own frames. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
138 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
139 Lisp_Object Vspecial_display_buffer_names; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
140 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
141 /* List of regexps for buffer names that should have their own frames. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
142 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
143 Lisp_Object Vspecial_display_regexps; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
144 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
145 /* Function to pop up a special frame. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
146 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
147 Lisp_Object Vspecial_display_function; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
148 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
149 /* List of buffer *names* for buffers to appear in selected window. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
150 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
151 Lisp_Object Vsame_window_buffer_names; |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
152 |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
153 /* List of regexps for buffer names to appear in selected window. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
154 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
155 Lisp_Object Vsame_window_regexps; |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
156 |
|
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
157 /* Hook run at end of temp_output_buffer_show. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
158 |
|
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
159 Lisp_Object Qtemp_buffer_show_hook; |
|
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
160 |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
161 /* Fdisplay_buffer always splits the largest window |
| 265 | 162 if that window is more than this high. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
163 |
| 265 | 164 int split_height_threshold; |
| 165 | |
| 166 /* Number of lines of continuity in scrolling by screenfuls. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
167 |
| 265 | 168 int next_screen_context_lines; |
| 169 | |
| 170 /* Incremented for each window created. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
171 |
| 265 | 172 static int sequence_number; |
| 173 | |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
174 /* Nonzero after init_window_once has finished. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
175 |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
176 static int window_initialized; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
177 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
178 /* Hook to run when window config changes. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
179 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
180 Lisp_Object Qwindow_configuration_change_hook; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
181 Lisp_Object Vwindow_configuration_change_hook; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
182 |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
183 /* Nonzero means scroll commands try to put point |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
184 at the same screen height as previously. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
185 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
186 Lisp_Object Vscroll_preserve_screen_position; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
187 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
188 #if 0 /* This isn't used anywhere. */ |
|
17962
8621a73a8890
(syms_of_window): Initialize inhibit_frame_unsplittable.
Richard M. Stallman <rms@gnu.org>
parents:
17955
diff
changeset
|
189 /* Nonzero means we can split a frame even if it is "unsplittable". */ |
|
17955
3140e48262f9
frame-override-unsplittable/inhibit-frame-unsplittable name change.
Simon Marshall <simon@gnu.org>
parents:
17952
diff
changeset
|
190 static int inhibit_frame_unsplittable; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
191 #endif /* 0 */ |
|
17540
eb82c4de9dea
(frame_allow_splitting): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17365
diff
changeset
|
192 |
| 265 | 193 #define min(a, b) ((a) < (b) ? (a) : (b)) |
|
14149
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
194 |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
195 extern int scroll_margin; |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
196 |
|
14149
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
197 extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; |
| 265 | 198 |
| 199 DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
200 "Returns t if OBJECT is a window.") |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
201 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
202 Lisp_Object object; |
| 265 | 203 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
204 return WINDOWP (object) ? Qt : Qnil; |
| 265 | 205 } |
| 206 | |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
207 DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
208 "Returns t if OBJECT is a window which is currently visible.") |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
209 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
210 Lisp_Object object; |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
211 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
212 return (WINDOWP (object) && ! NILP (XWINDOW (object)->buffer) ? Qt : Qnil); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
213 } |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
214 |
| 265 | 215 Lisp_Object |
| 216 make_window () | |
| 217 { | |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
218 Lisp_Object val; |
| 265 | 219 register struct window *p; |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
220 register struct Lisp_Vector *vec; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
221 int i; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
222 |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
223 vec = allocate_vectorlike ((EMACS_INT) VECSIZE (struct window)); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
224 for (i = 0; i < VECSIZE (struct window); i++) |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
225 vec->contents[i] = Qnil; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
226 vec->size = VECSIZE (struct window); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
227 p = (struct window *) vec; |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
228 XSETFASTINT (p->sequence_number, ++sequence_number); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
229 XSETFASTINT (p->left, 0); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
230 XSETFASTINT (p->top, 0); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
231 XSETFASTINT (p->height, 0); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
232 XSETFASTINT (p->width, 0); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
233 XSETFASTINT (p->hscroll, 0); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
234 p->orig_top = p->orig_height = Qnil; |
| 265 | 235 p->start = Fmake_marker (); |
| 236 p->pointm = Fmake_marker (); | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
237 XSETFASTINT (p->use_time, 0); |
| 769 | 238 p->frame = Qnil; |
| 265 | 239 p->display_table = Qnil; |
| 240 p->dedicated = Qnil; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
241 p->pseudo_window_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
242 bzero (&p->cursor, sizeof (p->cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
243 bzero (&p->last_cursor, sizeof (p->last_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
244 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
245 p->desired_matrix = p->current_matrix = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
246 p->phys_cursor_type = -1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
247 p->must_be_updated_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
248 XSETFASTINT (p->window_end_vpos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
249 XSETFASTINT (p->window_end_pos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
250 p->window_end_valid = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
251 p->vscroll = 0; |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
252 XSETWINDOW (val, p); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
253 XSETFASTINT (p->last_point, 0); |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
254 p->frozen_window_start_p = 0; |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
255 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
256 Vwindow_list = Qnil; |
| 265 | 257 return val; |
| 258 } | |
| 259 | |
| 260 DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, | |
| 261 "Return the window that the cursor now appears in and commands apply to.") | |
| 262 () | |
| 263 { | |
| 264 return selected_window; | |
| 265 } | |
| 266 | |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
267 DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0, |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
268 "Return the window used now for minibuffers.\n\ |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
269 If the optional argument FRAME is specified, return the minibuffer window\n\ |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
270 used by that frame.") |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
271 (frame) |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
272 Lisp_Object frame; |
| 265 | 273 { |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
274 if (NILP (frame)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
275 frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
276 CHECK_LIVE_FRAME (frame, 0); |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
277 return FRAME_MINIBUF_WINDOW (XFRAME (frame)); |
| 265 | 278 } |
| 279 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
280 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, |
| 265 | 281 "Returns non-nil if WINDOW is a minibuffer window.") |
| 282 (window) | |
| 283 Lisp_Object window; | |
| 284 { | |
| 285 struct window *w = decode_window (window); | |
| 286 return (MINI_WINDOW_P (w) ? Qt : Qnil); | |
| 287 } | |
| 288 | |
| 289 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | |
| 290 Spos_visible_in_window_p, 0, 2, 0, | |
| 769 | 291 "Return t if position POS is currently on the frame in WINDOW.\n\ |
| 265 | 292 Returns nil if that position is scrolled vertically out of view.\n\ |
| 293 POS defaults to point; WINDOW, to the selected window.") | |
| 294 (pos, window) | |
| 295 Lisp_Object pos, window; | |
| 296 { | |
| 297 register struct window *w; | |
| 298 register int posint; | |
| 299 register struct buffer *buf; | |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
300 struct text_pos top; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
301 Lisp_Object in_window; |
| 265 | 302 |
| 485 | 303 if (NILP (pos)) |
| 7347 | 304 posint = PT; |
| 265 | 305 else |
| 306 { | |
| 307 CHECK_NUMBER_COERCE_MARKER (pos, 0); | |
| 308 posint = XINT (pos); | |
| 309 } | |
| 310 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
311 w = decode_window (window); |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
312 buf = XBUFFER (w->buffer); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
313 SET_TEXT_POS_FROM_MARKER (top, w->start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
314 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
315 /* If position above window, it's not visible. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
316 if (posint < CHARPOS (top)) |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
317 in_window = Qnil; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
318 else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
319 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
320 && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
321 /* If frame is up to date, and POSINT is < window end pos, use |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
322 that info. This doesn't work for POSINT == end pos, because |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
323 the window end pos is actually the position _after_ the last |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
324 char in the window. */ |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
325 in_window = Qt; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
326 else if (posint > BUF_ZV (buf)) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
327 in_window = Qnil; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
328 else if (CHARPOS (top) < BUF_BEGV (buf) || CHARPOS (top) > BUF_ZV (buf)) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
329 /* If window start is out of range, do something reasonable. */ |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
330 in_window = Qnil; |
| 265 | 331 else |
| 332 { | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
333 struct it it; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
334 start_display (&it, w, top); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
335 move_it_to (&it, posint, 0, it.last_visible_y, -1, |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
336 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
337 in_window = IT_CHARPOS (it) == posint ? Qt : Qnil; |
| 265 | 338 } |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
339 |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
340 return in_window; |
| 265 | 341 } |
| 342 | |
| 343 static struct window * | |
| 344 decode_window (window) | |
| 345 register Lisp_Object window; | |
| 346 { | |
| 485 | 347 if (NILP (window)) |
| 265 | 348 return XWINDOW (selected_window); |
| 349 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
350 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 351 return XWINDOW (window); |
| 352 } | |
| 353 | |
| 354 DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, | |
| 355 "Return the buffer that WINDOW is displaying.") | |
| 356 (window) | |
| 357 Lisp_Object window; | |
| 358 { | |
| 359 return decode_window (window)->buffer; | |
| 360 } | |
| 361 | |
| 362 DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, | |
| 363 "Return the number of lines in WINDOW (including its mode line).") | |
| 364 (window) | |
| 365 Lisp_Object window; | |
| 366 { | |
| 367 return decode_window (window)->height; | |
| 368 } | |
| 369 | |
| 370 DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0, | |
|
6242
ed4b06e1975b
(Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6232
diff
changeset
|
371 "Return the number of display columns in WINDOW.\n\ |
|
ed4b06e1975b
(Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6232
diff
changeset
|
372 This is the width that is usable columns available for text in WINDOW.\n\ |
|
ed4b06e1975b
(Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6232
diff
changeset
|
373 If you want to find out how many columns WINDOW takes up,\n\ |
|
ed4b06e1975b
(Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6232
diff
changeset
|
374 use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))).") |
| 265 | 375 (window) |
| 376 Lisp_Object window; | |
| 377 { | |
|
6576
851ee89bae86
(Fwindow_width): Delete unnecessary variable declarations.
Karl Heuer <kwzh@gnu.org>
parents:
6517
diff
changeset
|
378 return make_number (window_internal_width (decode_window (window))); |
| 265 | 379 } |
| 380 | |
| 381 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |
| 382 "Return the number of columns by which WINDOW is scrolled from left margin.") | |
| 383 (window) | |
| 384 Lisp_Object window; | |
| 385 { | |
| 386 return decode_window (window)->hscroll; | |
| 387 } | |
| 388 | |
| 389 DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | |
| 390 "Set number of columns WINDOW is scrolled from left margin to NCOL.\n\ | |
| 391 NCOL should be zero or positive.") | |
| 392 (window, ncol) | |
| 393 register Lisp_Object window, ncol; | |
| 394 { | |
| 395 register struct window *w; | |
| 396 | |
| 397 CHECK_NUMBER (ncol, 1); | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
398 if (XINT (ncol) < 0) XSETFASTINT (ncol, 0); |
| 265 | 399 w = decode_window (window); |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
400 if (XINT (w->hscroll) != XINT (ncol)) |
| 25375 | 401 /* Prevent redisplay shortcuts */ |
| 402 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | |
| 265 | 403 w->hscroll = ncol; |
| 404 return ncol; | |
| 405 } | |
| 406 | |
|
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
407 DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
408 Swindow_redisplay_end_trigger, 0, 1, 0, |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
409 "Return WINDOW's redisplay end trigger value.\n\ |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
410 See `set-window-redisplay-end-trigger' for more information.") |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
411 (window) |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
412 Lisp_Object window; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
413 { |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
414 return decode_window (window)->redisplay_end_trigger; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
415 } |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
416 |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
417 DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
418 Sset_window_redisplay_end_trigger, 2, 2, 0, |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
419 "Set WINDOW's redisplay end trigger value to VALUE.\n\ |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
420 VALUE should be a buffer position (typically a marker) or nil.\n\ |
|
13583
8ee401a7aeec
(Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
13457
diff
changeset
|
421 If it is a buffer position, then if redisplay in WINDOW reaches a position\n\ |
|
8ee401a7aeec
(Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
13457
diff
changeset
|
422 beyond VALUE, the functions in `redisplay-end-trigger-functions' are called\n\ |
|
8ee401a7aeec
(Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
13457
diff
changeset
|
423 with two arguments: WINDOW, and the end trigger value.\n\ |
|
8ee401a7aeec
(Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
13457
diff
changeset
|
424 Afterwards the end-trigger value is reset to nil.") |
|
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
425 (window, value) |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
426 register Lisp_Object window, value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
427 { |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
428 register struct window *w; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
429 |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
430 w = decode_window (window); |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
431 w->redisplay_end_trigger = value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
432 return value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
433 } |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
434 |
| 265 | 435 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, |
| 436 "Return a list of the edge coordinates of WINDOW.\n\ | |
| 769 | 437 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame.\n\ |
| 265 | 438 RIGHT is one more than the rightmost column used by WINDOW,\n\ |
| 439 and BOTTOM is one more than the bottommost row used by WINDOW\n\ | |
| 440 and its mode-line.") | |
| 441 (window) | |
| 442 Lisp_Object window; | |
| 443 { | |
| 444 register struct window *w = decode_window (window); | |
| 445 | |
| 446 return Fcons (w->left, Fcons (w->top, | |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
447 Fcons (make_number (WINDOW_RIGHT_EDGE (w)), |
| 265 | 448 Fcons (make_number (XFASTINT (w->top) |
| 449 + XFASTINT (w->height)), | |
| 450 Qnil)))); | |
| 451 } | |
| 452 | |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
453 /* Test if the character at column *X, row *Y is within window W. |
| 432 | 454 If it is not, return 0; |
| 455 if it is in the window's text area, | |
| 456 set *x and *y to its location relative to the upper left corner | |
| 457 of the window, and | |
| 458 return 1; | |
| 459 if it is on the window's modeline, return 2; | |
| 460 if it is on the border between the window and its right sibling, | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
461 return 3. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
462 if it is on the window's top line, return 4; |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
463 if it is in the bitmap area to the left/right of the window, |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
464 return 5 or 6, and convert *X and *Y to window-relative corrdinates. |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
465 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
466 X and Y are frame relative pixel coordinates. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
467 |
| 432 | 468 static int |
| 469 coordinates_in_window (w, x, y) | |
| 470 register struct window *w; | |
| 471 register int *x, *y; | |
| 472 { | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
473 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
474 int left_x, right_x, top_y, bottom_y; |
|
25462
19b101d6ee2a
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
25402
diff
changeset
|
475 int flags_area_width = FRAME_LEFT_FLAGS_AREA_WIDTH (f); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
476 |
|
28918
e42cd428f056
(coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents:
28726
diff
changeset
|
477 /* In what's below, we subtract 1 when computing right_x because we |
|
e42cd428f056
(coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents:
28726
diff
changeset
|
478 want the rightmost pixel, which is given by left_pixel+width-1. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
479 if (w->pseudo_window_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
480 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
481 left_x = 0; |
|
28918
e42cd428f056
(coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents:
28726
diff
changeset
|
482 right_x = XFASTINT (w->width) * CANON_Y_UNIT (f) - 1; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
483 top_y = WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
484 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
485 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
486 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
487 { |
|
27850
3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents:
27848
diff
changeset
|
488 left_x = (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w) |
|
28004
7e296e4ec801
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
27956
diff
changeset
|
489 - FRAME_INTERNAL_BORDER_WIDTH_SAFE (f)); |
|
28918
e42cd428f056
(coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents:
28726
diff
changeset
|
490 right_x = WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X (w) - 1; |
|
27850
3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents:
27848
diff
changeset
|
491 top_y = (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w) |
|
28004
7e296e4ec801
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
27956
diff
changeset
|
492 - FRAME_INTERNAL_BORDER_WIDTH_SAFE (f)); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
493 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
494 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
495 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
496 if (*y < top_y |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
497 || *y >= bottom_y |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
498 || *x < (left_x |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
499 - flags_area_width |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
500 - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
501 * CANON_X_UNIT (f))) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
502 || *x > right_x + flags_area_width) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
503 /* Completely outside anything interesting. */ |
| 432 | 504 return 0; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
505 else if (WINDOW_WANTS_MODELINE_P (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
506 && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
507 /* On the mode line. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
508 return 2; |
| 25546 | 509 else if (WINDOW_WANTS_HEADER_LINE_P (w) |
| 510 && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
511 /* On the top line. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
512 return 4; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
513 else if (*x < left_x || *x >= right_x) |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
514 { |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
515 /* Other lines than the mode line don't include flags areas and |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
516 scroll bars on the left. */ |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
517 |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
518 /* Convert X and Y to window-relative pixel coordinates. */ |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
519 *x -= left_x; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
520 *y -= top_y; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
521 return *x < left_x ? 5 : 6; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
522 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
523 else if (!w->pseudo_window_p |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
524 && !WINDOW_RIGHTMOST_P (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
525 && *x >= right_x - CANON_X_UNIT (f)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
526 /* On the border on the right side of the window? Assume that |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
527 this area begins at RIGHT_X minus a canonical char width. */ |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
528 return 3; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
529 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
530 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
531 /* Convert X and Y to window-relative pixel coordinates. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
532 *x -= left_x; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
533 *y -= top_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
534 return 1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
535 } |
| 432 | 536 } |
| 537 | |
| 538 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, | |
| 539 Scoordinates_in_window_p, 2, 2, 0, | |
| 540 "Return non-nil if COORDINATES are in WINDOW.\n\ | |
| 708 | 541 COORDINATES is a cons of the form (X . Y), X and Y being distances\n\ |
| 769 | 542 measured in characters from the upper-left corner of the frame.\n\ |
| 708 | 543 (0 . 0) denotes the character in the upper left corner of the\n\ |
| 769 | 544 frame.\n\ |
| 432 | 545 If COORDINATES are in the text portion of WINDOW,\n\ |
| 546 the coordinates relative to the window are returned.\n\ | |
| 732 | 547 If they are in the mode line of WINDOW, `mode-line' is returned.\n\ |
| 25546 | 548 If they are in the top mode line of WINDOW, `header-line' is returned.\n\ |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
549 If they are in the bitmap-area to the left of the window,\n\ |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
550 `left-bitmap-area' is returned, if they are in the area on the right of\n\ |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
551 the window, `right-bitmap-area' is returned.\n\ |
| 432 | 552 If they are on the border between WINDOW and its right sibling,\n\ |
| 732 | 553 `vertical-line' is returned.") |
| 432 | 554 (coordinates, window) |
| 555 register Lisp_Object coordinates, window; | |
| 556 { | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
557 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
558 struct frame *f; |
| 432 | 559 int x, y; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
560 Lisp_Object lx, ly; |
| 432 | 561 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
562 CHECK_LIVE_WINDOW (window, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
563 w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
564 f = XFRAME (w->frame); |
| 432 | 565 CHECK_CONS (coordinates, 1); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
566 lx = Fcar (coordinates); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
567 ly = Fcdr (coordinates); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
568 CHECK_NUMBER_OR_FLOAT (lx, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
569 CHECK_NUMBER_OR_FLOAT (ly, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
570 x = PIXEL_X_FROM_CANON_X (f, lx); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
571 y = PIXEL_Y_FROM_CANON_Y (f, ly); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
572 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
573 switch (coordinates_in_window (w, &x, &y)) |
| 432 | 574 { |
| 575 case 0: /* NOT in window at all. */ | |
| 576 return Qnil; | |
| 577 | |
| 578 case 1: /* In text part of window. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
579 /* X and Y are now window relative pixel coordinates. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
580 Convert them to canonical char units before returning |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
581 them. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
582 return Fcons (CANON_X_FROM_PIXEL_X (f, x), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
583 CANON_Y_FROM_PIXEL_Y (f, y)); |
| 432 | 584 |
| 585 case 2: /* In mode line of window. */ | |
| 586 return Qmode_line; | |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
587 |
| 432 | 588 case 3: /* On right border of window. */ |
| 732 | 589 return Qvertical_line; |
| 432 | 590 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
591 case 4: |
| 25546 | 592 return Qheader_line; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
593 |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
594 case 5: |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
595 return Qleft_bitmap_area; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
596 |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
597 case 6: |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
598 return Qright_bitmap_area; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
599 |
| 432 | 600 default: |
| 601 abort (); | |
| 602 } | |
| 603 } | |
| 604 | |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
605 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
606 /* Callback for foreach_window, used in window_from_coordinates. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
607 Check if window W contains coordinates *X/*Y. If it does, return W |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
608 in *WINDOW, as Lisp_Object, and return in *PART the part of the |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
609 window under coordinates *X/*Y. Return zero from this function to |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
610 stop iterating over windows. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
611 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
612 static int |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
613 check_window_containing (w, window, x, y, part) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
614 struct window *w; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
615 Lisp_Object *window; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
616 int *x, *y, *part; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
617 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
618 int found; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
619 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
620 found = coordinates_in_window (w, x, y); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
621 if (found) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
622 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
623 *part = found - 1; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
624 XSETWINDOW (*window, w); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
625 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
626 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
627 return !found; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
628 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
629 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
630 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
631 /* Find the window containing frame-relative pixel position X/Y and |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
632 return it as a Lisp_Object. If X, Y is on the window's modeline, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
633 set *PART to 1; if it is on the separating line between the window |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
634 and its right sibling, set it to 2; otherwise set it to 0. If |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
635 there is no window under X, Y return nil and leave *PART |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
636 unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
637 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
638 This function was previously implemented with a loop cycling over |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
639 windows with Fnext_window, and starting with the frame's selected |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
640 window. It turned out that this doesn't work with an |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
641 implementation of next_window using Vwindow_list, because |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
642 FRAME_SELECTED_WINDOW (F) is not always contained in the window |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
643 tree of F when this function is called asynchronously from |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
644 note_mouse_highlight. The original loop didn't terminate in this |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
645 case. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
646 |
| 265 | 647 Lisp_Object |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
648 window_from_coordinates (f, x, y, part, tool_bar_p) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
649 struct frame *f; |
| 265 | 650 int x, y; |
| 432 | 651 int *part; |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
652 int tool_bar_p; |
| 265 | 653 { |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
654 Lisp_Object window; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
655 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
656 window = Qnil; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
657 foreach_window (f, check_window_containing, &window, &x, &y, part); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
658 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
659 /* If not found above, see if it's in the tool bar window, if a tool |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
660 bar exists. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
661 if (NILP (window) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
662 && tool_bar_p |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
663 && WINDOWP (f->tool_bar_window) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
664 && XINT (XWINDOW (f->tool_bar_window)->height) > 0 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
665 && coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
666 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
667 *part = 0; |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
668 window = f->tool_bar_window; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
669 } |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
670 |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
671 return window; |
| 265 | 672 } |
| 673 | |
|
681
026f978690be
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
555
diff
changeset
|
674 DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, |
| 1798 | 675 "Return window containing coordinates X and Y on FRAME.\n\ |
| 769 | 676 If omitted, FRAME defaults to the currently selected frame.\n\ |
| 677 The top left corner of the frame is considered to be row 0,\n\ | |
| 548 | 678 column 0.") |
| 1798 | 679 (x, y, frame) |
| 680 Lisp_Object x, y, frame; | |
| 265 | 681 { |
| 682 int part; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
683 struct frame *f; |
| 265 | 684 |
| 769 | 685 if (NILP (frame)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
686 frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
687 CHECK_LIVE_FRAME (frame, 2); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
688 f = XFRAME (frame); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
689 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
690 /* Check that arguments are integers or floats. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
691 CHECK_NUMBER_OR_FLOAT (x, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
692 CHECK_NUMBER_OR_FLOAT (y, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
693 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
694 return window_from_coordinates (f, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
695 PIXEL_X_FROM_CANON_X (f, x), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
696 PIXEL_Y_FROM_CANON_Y (f, y), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
697 &part, 0); |
| 265 | 698 } |
| 699 | |
| 700 DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | |
| 701 "Return current value of point in WINDOW.\n\ | |
| 702 For a nonselected window, this is the value point would have\n\ | |
| 703 if that window were selected.\n\ | |
| 704 \n\ | |
| 705 Note that, when WINDOW is the selected window and its buffer\n\ | |
| 706 is also currently selected, the value returned is the same as (point).\n\ | |
| 707 It would be more strictly correct to return the `top-level' value\n\ | |
| 708 of point, outside of any save-excursion forms.\n\ | |
| 709 But that is hard to define.") | |
| 710 (window) | |
| 711 Lisp_Object window; | |
| 712 { | |
| 713 register struct window *w = decode_window (window); | |
| 714 | |
| 715 if (w == XWINDOW (selected_window) | |
| 716 && current_buffer == XBUFFER (w->buffer)) | |
| 717 return Fpoint (); | |
| 718 return Fmarker_position (w->pointm); | |
| 719 } | |
| 720 | |
| 721 DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, | |
|
12597
c2f4101915eb
(Fwindow_start): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12492
diff
changeset
|
722 "Return position at which display currently starts in WINDOW.\n\ |
|
c2f4101915eb
(Fwindow_start): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12492
diff
changeset
|
723 This is updated by redisplay or by calling `set-window-start'.") |
| 265 | 724 (window) |
| 725 Lisp_Object window; | |
| 726 { | |
| 727 return Fmarker_position (decode_window (window)->start); | |
| 728 } | |
| 729 | |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
730 /* This is text temporarily removed from the doc string below. |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
731 |
|
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
732 This function returns nil if the position is not currently known.\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
733 That happens when redisplay is preempted and doesn't finish.\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
734 If in that case you want to compute where the end of the window would\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
735 have been if redisplay had finished, do this:\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
736 (save-excursion\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
737 (goto-char (window-start window))\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
738 (vertical-motion (1- (window-height window)) window)\n\ |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
739 (point))") */ |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
740 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
741 DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 2, 0, |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
742 "Return position at which display currently ends in WINDOW.\n\ |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
743 This is updated by redisplay, when it runs to completion.\n\ |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
744 Simply changing the buffer text or setting `window-start'\n\ |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
745 does not update this value.\n\ |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
746 If UP-TO-DATE is non-nil, compute the up-to-date position\n\ |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
747 if it isn't already recorded.") |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
748 (window, update) |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
749 Lisp_Object window, update; |
| 265 | 750 { |
| 751 Lisp_Object value; | |
| 752 struct window *w = decode_window (window); | |
|
4292
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
753 Lisp_Object buf; |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
754 |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
755 buf = w->buffer; |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
756 CHECK_BUFFER (buf, 0); |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
757 |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
758 #if 0 /* This change broke some things. We should make it later. */ |
|
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
759 /* If we don't know the end position, return nil. |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
760 The user can compute it with vertical-motion if he wants to. |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
761 It would be nicer to do it automatically, |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
762 but that's so slow that it would probably bother people. */ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
763 if (NILP (w->window_end_valid)) |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
764 return Qnil; |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
765 #endif |
|
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
766 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
767 if (! NILP (update) |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
768 && ! (! NILP (w->window_end_valid) |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
769 && XFASTINT (w->last_modified) >= MODIFF)) |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
770 { |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
771 int opoint = PT, opoint_byte = PT_BYTE; |
|
26635
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
772 |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
773 /* In case W->start is out of the range, use something |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
774 reasonable. This situation occured when loading a file with |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
775 `-l' containing a call to `rmail' with subsequent other |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
776 commands. At the end, W->start happened to be BEG, while |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
777 rmail had already narrowed the buffer. This leads to an |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
778 abort in temp_set_pt_both. */ |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
779 if (XMARKER (w->start)->charpos < BEGV) |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
780 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
781 else if (XMARKER (w->start)->charpos > ZV) |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
782 TEMP_SET_PT_BOTH (ZV, ZV_BYTE); |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
783 else |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
784 TEMP_SET_PT_BOTH (XMARKER (w->start)->charpos, |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
785 XMARKER (w->start)->bytepos); |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
786 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
787 Fvertical_motion (make_number (window_internal_height (w)), Qnil); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
788 XSETINT (value, PT); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
789 TEMP_SET_PT_BOTH (opoint, opoint_byte); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
790 } |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
791 else |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
792 XSETINT (value, |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
793 BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); |
| 265 | 794 |
| 795 return value; | |
| 796 } | |
| 797 | |
| 798 DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, | |
| 799 "Make point value in WINDOW be at position POS in WINDOW's buffer.") | |
| 800 (window, pos) | |
| 801 Lisp_Object window, pos; | |
| 802 { | |
| 803 register struct window *w = decode_window (window); | |
| 804 | |
| 805 CHECK_NUMBER_COERCE_MARKER (pos, 1); | |
|
24230
ee835eec7607
(Fset_window_point): If WINDOW is selected but the
Richard M. Stallman <rms@gnu.org>
parents:
23728
diff
changeset
|
806 if (w == XWINDOW (selected_window) |
|
ee835eec7607
(Fset_window_point): If WINDOW is selected but the
Richard M. Stallman <rms@gnu.org>
parents:
23728
diff
changeset
|
807 && XBUFFER (w->buffer) == current_buffer) |
| 265 | 808 Fgoto_char (pos); |
| 809 else | |
| 810 set_marker_restricted (w->pointm, pos, w->buffer); | |
|
25387
df0083768b79
(Fset_window_point): Reset Vresize_mini_config.
Gerd Moellmann <gerd@gnu.org>
parents:
25375
diff
changeset
|
811 |
| 265 | 812 return pos; |
| 813 } | |
| 814 | |
| 815 DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, | |
| 816 "Make display in WINDOW start at position POS in WINDOW's buffer.\n\ | |
| 817 Optional third arg NOFORCE non-nil inhibits next redisplay\n\ | |
| 818 from overriding motion of point in order to display at this exact start.") | |
| 819 (window, pos, noforce) | |
| 820 Lisp_Object window, pos, noforce; | |
| 821 { | |
| 822 register struct window *w = decode_window (window); | |
| 823 | |
| 824 CHECK_NUMBER_COERCE_MARKER (pos, 1); | |
| 825 set_marker_restricted (w->start, pos, w->buffer); | |
| 826 /* this is not right, but much easier than doing what is right. */ | |
| 827 w->start_at_line_beg = Qnil; | |
| 485 | 828 if (NILP (noforce)) |
| 265 | 829 w->force_start = Qt; |
| 830 w->update_mode_line = Qt; | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
831 XSETFASTINT (w->last_modified, 0); |
|
16208
e3a834653117
(Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
16068
diff
changeset
|
832 XSETFASTINT (w->last_overlay_modified, 0); |
| 338 | 833 if (!EQ (window, selected_window)) |
| 834 windows_or_buffers_changed++; | |
|
25387
df0083768b79
(Fset_window_point): Reset Vresize_mini_config.
Gerd Moellmann <gerd@gnu.org>
parents:
25375
diff
changeset
|
835 |
| 265 | 836 return pos; |
| 837 } | |
| 838 | |
| 839 DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | |
| 840 1, 1, 0, | |
| 841 "Return WINDOW's dedicated object, usually t or nil.\n\ | |
|
2865
427eadecebd6
* window.c (window-dedicated-p): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
2693
diff
changeset
|
842 See also `set-window-dedicated-p'.") |
| 265 | 843 (window) |
| 844 Lisp_Object window; | |
| 845 { | |
| 846 return decode_window (window)->dedicated; | |
| 847 } | |
| 848 | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
849 DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
850 Sset_window_dedicated_p, 2, 2, 0, |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
851 "Control whether WINDOW is dedicated to the buffer it displays.\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
852 If it is dedicated, Emacs will not automatically change\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
853 which buffer appears in it.\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
854 The second argument is the new value for the dedication flag;\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
855 non-nil means yes.") |
| 265 | 856 (window, arg) |
| 857 Lisp_Object window, arg; | |
| 858 { | |
| 859 register struct window *w = decode_window (window); | |
| 860 | |
| 485 | 861 if (NILP (arg)) |
| 265 | 862 w->dedicated = Qnil; |
| 863 else | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
864 w->dedicated = Qt; |
| 265 | 865 |
| 866 return w->dedicated; | |
| 867 } | |
| 868 | |
| 869 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, | |
| 870 0, 1, 0, | |
| 871 "Return the display-table that WINDOW is using.") | |
| 872 (window) | |
| 873 Lisp_Object window; | |
| 874 { | |
| 875 return decode_window (window)->display_table; | |
| 876 } | |
| 877 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
878 /* Get the display table for use on window W. This is either W's |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
879 display table or W's buffer's display table. Ignore the specified |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
880 tables if they are not valid; if no valid table is specified, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
881 return 0. */ |
| 265 | 882 |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
883 struct Lisp_Char_Table * |
| 265 | 884 window_display_table (w) |
| 885 struct window *w; | |
| 886 { | |
| 887 Lisp_Object tem; | |
| 888 tem = w->display_table; | |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
889 if (DISP_TABLE_P (tem)) |
|
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
890 return XCHAR_TABLE (tem); |
|
21227
be147fbd56f1
(window_display_table): Don't look inside buffer if its nil.
Richard M. Stallman <rms@gnu.org>
parents:
21198
diff
changeset
|
891 if (NILP (w->buffer)) |
|
be147fbd56f1
(window_display_table): Don't look inside buffer if its nil.
Richard M. Stallman <rms@gnu.org>
parents:
21198
diff
changeset
|
892 return 0; |
|
be147fbd56f1
(window_display_table): Don't look inside buffer if its nil.
Richard M. Stallman <rms@gnu.org>
parents:
21198
diff
changeset
|
893 |
| 265 | 894 tem = XBUFFER (w->buffer)->display_table; |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
895 if (DISP_TABLE_P (tem)) |
|
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
896 return XCHAR_TABLE (tem); |
| 265 | 897 tem = Vstandard_display_table; |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
898 if (DISP_TABLE_P (tem)) |
|
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
899 return XCHAR_TABLE (tem); |
| 265 | 900 return 0; |
| 901 } | |
| 902 | |
| 555 | 903 DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, |
| 265 | 904 "Set WINDOW's display-table to TABLE.") |
| 905 (window, table) | |
| 906 register Lisp_Object window, table; | |
| 907 { | |
| 908 register struct window *w; | |
| 909 | |
| 910 w = decode_window (window); | |
| 911 w->display_table = table; | |
| 912 return table; | |
| 913 } | |
| 914 | |
| 915 /* Record info on buffer window w is displaying | |
| 916 when it is about to cease to display that buffer. */ | |
| 21514 | 917 static void |
| 265 | 918 unshow_buffer (w) |
| 919 register struct window *w; | |
| 920 { | |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
921 Lisp_Object buf; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
922 struct buffer *b; |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
923 |
|
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
924 buf = w->buffer; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
925 b = XBUFFER (buf); |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
926 if (b != XMARKER (w->pointm)->buffer) |
| 265 | 927 abort (); |
| 928 | |
|
5990
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
929 #if 0 |
| 265 | 930 if (w == XWINDOW (selected_window) |
| 931 || ! EQ (buf, XWINDOW (selected_window)->buffer)) | |
| 932 /* Do this except when the selected window's buffer | |
| 933 is being removed from some other window. */ | |
|
5990
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
934 #endif |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
935 /* last_window_start records the start position that this buffer |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
936 had in the last window to be disconnected from it. |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
937 Now that this statement is unconditional, |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
938 it is possible for the buffer to be displayed in the |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
939 selected window, while last_window_start reflects another |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
940 window which was recently showing the same buffer. |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
941 Some people might say that might be a good thing. Let's see. */ |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
942 b->last_window_start = marker_position (w->start); |
| 265 | 943 |
| 944 /* Point in the selected window's buffer | |
| 945 is actually stored in that buffer, and the window's pointm isn't used. | |
| 946 So don't clobber point in that buffer. */ | |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
947 if (! EQ (buf, XWINDOW (selected_window)->buffer) |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
948 /* This line helps to fix Horsley's testbug.el bug. */ |
|
28417
4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents:
28104
diff
changeset
|
949 && !(WINDOWP (b->last_selected_window) |
|
4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents:
28104
diff
changeset
|
950 && w != XWINDOW (b->last_selected_window) |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
951 && EQ (buf, XWINDOW (b->last_selected_window)->buffer))) |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
952 temp_set_point_both (b, |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
953 clip_to_bounds (BUF_BEGV (b), |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
954 XMARKER (w->pointm)->charpos, |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
955 BUF_ZV (b)), |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
956 clip_to_bounds (BUF_BEGV_BYTE (b), |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
957 marker_byte_position (w->pointm), |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
958 BUF_ZV_BYTE (b))); |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
959 |
|
28417
4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents:
28104
diff
changeset
|
960 if (WINDOWP (b->last_selected_window) |
|
4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents:
28104
diff
changeset
|
961 && w == XWINDOW (b->last_selected_window)) |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
962 b->last_selected_window = Qnil; |
| 265 | 963 } |
| 964 | |
| 965 /* Put replacement into the window structure in place of old. */ | |
| 21514 | 966 static void |
| 265 | 967 replace_window (old, replacement) |
| 968 Lisp_Object old, replacement; | |
| 969 { | |
| 970 register Lisp_Object tem; | |
| 971 register struct window *o = XWINDOW (old), *p = XWINDOW (replacement); | |
| 972 | |
| 769 | 973 /* If OLD is its frame's root_window, then replacement is the new |
| 974 root_window for that frame. */ | |
| 265 | 975 |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
976 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) |
| 769 | 977 FRAME_ROOT_WINDOW (XFRAME (o->frame)) = replacement; |
| 265 | 978 |
| 979 p->left = o->left; | |
| 980 p->top = o->top; | |
| 981 p->width = o->width; | |
| 982 p->height = o->height; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
983 p->desired_matrix = p->current_matrix = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
984 p->vscroll = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
985 bzero (&p->cursor, sizeof (p->cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
986 bzero (&p->last_cursor, sizeof (p->last_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
987 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
988 p->phys_cursor_type = -1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
989 p->must_be_updated_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
990 p->pseudo_window_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
991 XSETFASTINT (p->window_end_vpos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
992 XSETFASTINT (p->window_end_pos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
993 p->window_end_valid = Qnil; |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
994 p->frozen_window_start_p = 0; |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
995 p->orig_top = p->orig_height = Qnil; |
| 265 | 996 |
| 997 p->next = tem = o->next; | |
| 485 | 998 if (!NILP (tem)) |
| 265 | 999 XWINDOW (tem)->prev = replacement; |
| 1000 | |
| 1001 p->prev = tem = o->prev; | |
| 485 | 1002 if (!NILP (tem)) |
| 265 | 1003 XWINDOW (tem)->next = replacement; |
| 1004 | |
| 1005 p->parent = tem = o->parent; | |
| 485 | 1006 if (!NILP (tem)) |
| 265 | 1007 { |
| 1008 if (EQ (XWINDOW (tem)->vchild, old)) | |
| 1009 XWINDOW (tem)->vchild = replacement; | |
| 1010 if (EQ (XWINDOW (tem)->hchild, old)) | |
| 1011 XWINDOW (tem)->hchild = replacement; | |
| 1012 } | |
| 1013 | |
| 1014 /*** Here, if replacement is a vertical combination | |
| 1015 and so is its new parent, we should make replacement's | |
| 1016 children be children of that parent instead. ***/ | |
| 1017 } | |
| 1018 | |
| 1019 DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", | |
| 1020 "Remove WINDOW from the display. Default is selected window.") | |
| 1021 (window) | |
| 1022 register Lisp_Object window; | |
| 1023 { | |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1024 delete_window (window); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1025 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1026 if (! NILP (Vwindow_configuration_change_hook) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1027 && ! NILP (Vrun_hooks)) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1028 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1029 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1030 return Qnil; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1031 } |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1032 |
| 20351 | 1033 void |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1034 delete_window (window) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1035 register Lisp_Object window; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1036 { |
| 265 | 1037 register Lisp_Object tem, parent, sib; |
| 1038 register struct window *p; | |
| 1039 register struct window *par; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1040 FRAME_PTR frame; |
| 265 | 1041 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1042 /* Because this function is called by other C code on non-leaf |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1043 windows, the CHECK_LIVE_WINDOW macro would choke inappropriately, |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1044 so we can't decode_window here. */ |
| 485 | 1045 if (NILP (window)) |
| 265 | 1046 window = selected_window; |
| 1047 else | |
| 1048 CHECK_WINDOW (window, 0); | |
| 1049 p = XWINDOW (window); | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1050 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1051 /* It's okay to delete an already-deleted window. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1052 if (NILP (p->buffer) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1053 && NILP (p->hchild) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1054 && NILP (p->vchild)) |
|
17365
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
1055 return; |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1056 |
| 265 | 1057 parent = p->parent; |
| 485 | 1058 if (NILP (parent)) |
| 265 | 1059 error ("Attempt to delete minibuffer or sole ordinary window"); |
| 1060 par = XWINDOW (parent); | |
| 1061 | |
| 1062 windows_or_buffers_changed++; | |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1063 Vwindow_list = Qnil; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1064 frame = XFRAME (WINDOW_FRAME (p)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1065 FRAME_WINDOW_SIZES_CHANGED (frame) = 1; |
| 265 | 1066 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1067 /* Are we trying to delete any frame's selected window? */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1068 { |
|
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1069 Lisp_Object frame, pwindow; |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1070 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1071 /* See if the frame's selected window is either WINDOW |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1072 or any subwindow of it, by finding all that window's parents |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1073 and comparing each one with WINDOW. */ |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1074 frame = WINDOW_FRAME (XWINDOW (window)); |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1075 pwindow = FRAME_SELECTED_WINDOW (XFRAME (frame)); |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1076 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1077 while (!NILP (pwindow)) |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1078 { |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1079 if (EQ (window, pwindow)) |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1080 break; |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1081 pwindow = XWINDOW (pwindow)->parent; |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1082 } |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1083 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1084 if (EQ (window, pwindow)) |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1085 { |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1086 Lisp_Object alternative; |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1087 alternative = Fnext_window (window, Qlambda, Qnil); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1088 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1089 /* If we're about to delete the selected window on the |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1090 selected frame, then we should use Fselect_window to select |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1091 the new window. On the other hand, if we're about to |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1092 delete the selected window on any other frame, we shouldn't do |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1093 anything but set the frame's selected_window slot. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1094 if (EQ (window, selected_window)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1095 Fselect_window (alternative); |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1096 else |
|
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1097 FRAME_SELECTED_WINDOW (XFRAME (frame)) = alternative; |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1098 } |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1099 } |
| 265 | 1100 |
| 1101 tem = p->buffer; | |
| 1102 /* tem is null for dummy parent windows | |
| 1103 (which have inferiors but not any contents themselves) */ | |
| 485 | 1104 if (!NILP (tem)) |
| 265 | 1105 { |
| 1106 unshow_buffer (p); | |
| 1107 unchain_marker (p->pointm); | |
| 1108 unchain_marker (p->start); | |
| 1109 } | |
| 1110 | |
|
26761
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1111 /* Free window glyph matrices. It is sure that they are allocated |
|
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1112 again when ADJUST_GLYPHS is called. Block input so that expose |
|
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1113 events and other events that access glyph matrices are not |
|
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1114 processed while we are changing them. */ |
|
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1115 BLOCK_INPUT; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1116 free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (frame))); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1117 |
| 265 | 1118 tem = p->next; |
| 485 | 1119 if (!NILP (tem)) |
| 265 | 1120 XWINDOW (tem)->prev = p->prev; |
| 1121 | |
| 1122 tem = p->prev; | |
| 485 | 1123 if (!NILP (tem)) |
| 265 | 1124 XWINDOW (tem)->next = p->next; |
| 1125 | |
| 1126 if (EQ (window, par->hchild)) | |
| 1127 par->hchild = p->next; | |
| 1128 if (EQ (window, par->vchild)) | |
| 1129 par->vchild = p->next; | |
| 1130 | |
| 1131 /* Find one of our siblings to give our space to. */ | |
| 1132 sib = p->prev; | |
| 485 | 1133 if (NILP (sib)) |
| 265 | 1134 { |
| 1135 /* If p gives its space to its next sibling, that sibling needs | |
| 1136 to have its top/left side pulled back to where p's is. | |
| 1137 set_window_{height,width} will re-position the sibling's | |
| 1138 children. */ | |
| 1139 sib = p->next; | |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
1140 XWINDOW (sib)->top = p->top; |
|
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
1141 XWINDOW (sib)->left = p->left; |
| 265 | 1142 } |
| 1143 | |
| 1144 /* Stretch that sibling. */ | |
| 485 | 1145 if (!NILP (par->vchild)) |
| 265 | 1146 set_window_height (sib, |
| 1147 XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height), | |
| 1148 1); | |
| 485 | 1149 if (!NILP (par->hchild)) |
| 265 | 1150 set_window_width (sib, |
| 1151 XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width), | |
| 1152 1); | |
| 1153 | |
| 1154 /* If parent now has only one child, | |
| 1155 put the child into the parent's place. */ | |
| 1156 tem = par->hchild; | |
| 485 | 1157 if (NILP (tem)) |
| 265 | 1158 tem = par->vchild; |
| 485 | 1159 if (NILP (XWINDOW (tem)->next)) |
| 265 | 1160 replace_window (parent, tem); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1161 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1162 /* Since we may be deleting combination windows, we must make sure that |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1163 not only p but all its children have been marked as deleted. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1164 if (! NILP (p->hchild)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1165 delete_all_subwindows (XWINDOW (p->hchild)); |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1166 else if (! NILP (p->vchild)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1167 delete_all_subwindows (XWINDOW (p->vchild)); |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1168 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1169 /* Mark this window as deleted. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1170 p->buffer = p->hchild = p->vchild = Qnil; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1171 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1172 /* Adjust glyph matrices. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1173 adjust_glyphs (frame); |
|
26761
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1174 UNBLOCK_INPUT; |
| 265 | 1175 } |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1176 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1177 |
| 265 | 1178 |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1179 /*********************************************************************** |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1180 Window List |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1181 ***********************************************************************/ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1182 |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1183 /* Add window W to *LIST. This is a callback function for |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1184 foreach_window, used in function window_list. */ |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1185 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1186 static int |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1187 add_window_to_list (w, list) |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1188 struct window *w; |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1189 Lisp_Object *list; |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1190 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1191 Lisp_Object window; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1192 XSETWINDOW (window, w); |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1193 *list = Fcons (window, *list); |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1194 return 1; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1195 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1196 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1197 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1198 /* Return a list of all windows, for use by next_window. If |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1199 Vwindow_list is a list, return that list. Otherwise, build a new |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1200 list, cache it in Vwindow_list, and return that. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1201 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1202 static Lisp_Object |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1203 window_list () |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1204 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1205 if (!CONSP (Vwindow_list)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1206 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1207 Lisp_Object tail; |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1208 |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1209 Vwindow_list = Qnil; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1210 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1211 { |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1212 Lisp_Object args[2]; |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1213 |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1214 /* We are visiting windows in canonical order, and add |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1215 new windows at the front of args[1], which means we |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1216 have to reverse this list at the end. */ |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1217 args[1] = Qnil; |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1218 foreach_window (XFRAME (XCAR (tail)), add_window_to_list, &args[1]); |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1219 args[0] = Vwindow_list; |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1220 args[1] = Fnreverse (args[1]); |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1221 Vwindow_list = Fnconc (2, args); |
|
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1222 } |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1223 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1224 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1225 return Vwindow_list; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1226 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1227 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1228 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1229 /* Value is non-zero if WINODW satisfies the constraints given by |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1230 MINIBUF and ALL_FRAMES. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1231 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1232 MINIBUF t means WINDOW may be a minibuffer window. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1233 MINIBUF `lambda' means it may not be a minibuffer window. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1234 MINIBUF being a window means WINDOW must be equal to MINIBUF. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1235 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1236 ALL_FRAMES t means WINDOW may be on any frame. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1237 ALL_FRAMES nil means WINDOW must not be on a minibuffer-only frame. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1238 ALL_FRAMES `visible' means WINDOW must be on a visible frame. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1239 ALL_FRAMES 0 means WINDOW must be on a visible or iconified frame. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1240 ALL_FRAMES being a frame means WINDOW must be on that frame. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1241 ALL_FRAMES being a window means WINDOW must be on a frame using |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1242 the same minibuffer as ALL_FRAMES. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1243 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1244 static int |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1245 candidate_window_p (window, minibuf, all_frames) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1246 Lisp_Object window, minibuf, all_frames; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1247 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1248 struct window *w = XWINDOW (window); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1249 struct frame *f = XFRAME (w->frame); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1250 int candidate_p = 1; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1251 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1252 if (!BUFFERP (w->buffer)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1253 candidate_p = 0; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1254 else if (MINI_WINDOW_P (w) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1255 && (EQ (minibuf, Qlambda) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1256 || (WINDOWP (minibuf) && !EQ (minibuf, window)))) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1257 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1258 /* If MINIBUF is `lambda' don't consider any mini-windows. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1259 If it is a window, consider only that one. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1260 candidate_p = 0; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1261 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1262 else if (NILP (all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1263 candidate_p = !FRAME_MINIBUF_ONLY_P (f); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1264 else if (EQ (all_frames, Qvisible)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1265 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1266 FRAME_SAMPLE_VISIBILITY (f); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1267 candidate_p = FRAME_VISIBLE_P (f); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1268 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1269 else if (INTEGERP (all_frames) && XINT (all_frames) == 0) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1270 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1271 FRAME_SAMPLE_VISIBILITY (f); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1272 candidate_p = FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1273 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1274 else if (FRAMEP (all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1275 candidate_p = EQ (all_frames, w->frame); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1276 else if (WINDOWP (all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1277 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1278 || EQ (XWINDOW (all_frames)->frame, w->frame) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1279 || EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f))); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1280 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1281 return candidate_p; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1282 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1283 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1284 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1285 /* Decode arguments as allowed by Fnext_window, Fprevious_window, and |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1286 Fwindow_list. See there for the meaning of WINDOW, MINIBUF, and |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1287 ALL_FRAMES. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1288 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1289 static void |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1290 decode_next_window_args (window, minibuf, all_frames) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1291 Lisp_Object *window, *minibuf, *all_frames; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1292 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1293 if (NILP (*window)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1294 *window = selected_window; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1295 else |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1296 CHECK_LIVE_WINDOW (*window, 0); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1297 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1298 /* MINIBUF nil may or may not include minibuffers. Decide if it |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1299 does. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1300 if (NILP (*minibuf)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1301 *minibuf = minibuf_level ? minibuf_window : Qlambda; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1302 else if (!EQ (*minibuf, Qt)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1303 *minibuf = Qlambda; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1304 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1305 /* Now *MINIBUF can be t => count all minibuffer windows, `lambda' |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1306 => count none of them, or a specific minibuffer window (the |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1307 active one) to count. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1308 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1309 /* ALL_FRAMES nil doesn't specify which frames to include. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1310 if (NILP (*all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1311 *all_frames = (!EQ (*minibuf, Qlambda) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1312 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1313 : Qnil); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1314 else if (EQ (*all_frames, Qvisible)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1315 ; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1316 else if (XFASTINT (*all_frames) == 0) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1317 ; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1318 else if (FRAMEP (*all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1319 ; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1320 else if (!EQ (*all_frames, Qt)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1321 *all_frames = Qnil; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1322 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1323 /* Now *ALL_FRAMES is t meaning search all frames, nil meaning |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1324 search just current frame, `visible' meaning search just visible |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1325 frames, 0 meaning search visible and iconified frames, or a |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1326 window, meaning search the frame that window belongs to, or a |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1327 frame, meaning consider windows on that frame, only. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1328 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1329 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1330 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1331 /* Return the next or previous window of WINDOW in canonical ordering |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1332 of windows. NEXT_P non-zero means return the next window. See the |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1333 documentation string of next-window for the meaning of MINIBUF and |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1334 ALL_FRAMES. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1335 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1336 static Lisp_Object |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1337 next_window (window, minibuf, all_frames, next_p) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1338 Lisp_Object window, minibuf, all_frames; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1339 int next_p; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1340 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1341 decode_next_window_args (&window, &minibuf, &all_frames); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1342 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1343 /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1344 return the first window on the frame. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1345 if (FRAMEP (all_frames) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1346 && !EQ (all_frames, XWINDOW (window)->frame)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1347 return Fframe_first_window (all_frames); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1348 |
|
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1349 if (next_p) |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1350 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1351 Lisp_Object list; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1352 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1353 /* Find WINDOW in the list of all windows. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1354 list = Fmemq (window, window_list ()); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1355 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1356 /* Scan forward from WINDOW to the end of the window list. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1357 if (CONSP (list)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1358 for (list = XCDR (list); CONSP (list); list = XCDR (list)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1359 if (candidate_window_p (XCAR (list), minibuf, all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1360 break; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1361 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1362 /* Scan from the start of the window list up to WINDOW. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1363 if (!CONSP (list)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1364 for (list = Vwindow_list; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1365 CONSP (list) && !EQ (XCAR (list), window); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1366 list = XCDR (list)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1367 if (candidate_window_p (XCAR (list), minibuf, all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1368 break; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1369 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1370 if (CONSP (list)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1371 window = XCAR (list); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1372 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1373 else |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1374 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1375 Lisp_Object candidate, list; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1376 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1377 /* Scan through the list of windows for candidates. If there are |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1378 candidate windows in front of WINDOW, the last one of these |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1379 is the one we want. If there are candidates following WINDOW |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1380 in the list, again the last one of these is the one we want. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1381 candidate = Qnil; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1382 for (list = window_list (); CONSP (list); list = XCDR (list)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1383 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1384 if (EQ (XCAR (list), window)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1385 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1386 if (WINDOWP (candidate)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1387 break; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1388 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1389 else if (candidate_window_p (XCAR (list), minibuf, all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1390 candidate = XCAR (list); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1391 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1392 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1393 if (WINDOWP (candidate)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1394 window = candidate; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1395 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1396 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1397 return window; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1398 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1399 |
| 432 | 1400 |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1401 /* This comment supplies the doc string for `next-window', |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1402 for make-docfile to see. We cannot put this in the real DEFUN |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1403 due to limits in the Unix cpp. |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1404 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1405 DEFUN ("next-window", Ffoo, Sfoo, 0, 3, 0, |
| 432 | 1406 "Return next window after WINDOW in canonical ordering of windows.\n\ |
| 1407 If omitted, WINDOW defaults to the selected window.\n\ | |
| 1408 \n\ | |
| 1409 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
| 1410 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
| 1411 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
| 1412 minibuffer even if it is active.\n\ | |
| 1413 \n\ | |
| 769 | 1414 Several frames may share a single minibuffer; if the minibuffer\n\ |
| 1415 counts, all windows on all frames that share that minibuffer count\n\ | |
| 8139 | 1416 too. Therefore, `next-window' can be used to iterate through the\n\ |
| 769 | 1417 set of windows even when the minibuffer is on another frame. If the\n\ |
| 1418 minibuffer does not count, only windows from WINDOW's frame count.\n\ | |
| 432 | 1419 \n\ |
| 769 | 1420 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
| 1421 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1422 above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\ |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1423 ALL-FRAMES = 0 means include windows on all visible and iconified frames.\n\ |
|
11307
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1424 If ALL-FRAMES is a frame, restrict search to windows on that frame.\n\ |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1425 Anything else means restrict to WINDOW's frame.\n\ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1426 \n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1427 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1428 `next-window' to iterate through the entire cycle of acceptable\n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1429 windows, eventually ending up back at the window you started with.\n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1430 `previous-window' traverses the same cycle, in the reverse order.") |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1431 (window, minibuf, all_frames) */ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1432 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1433 DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0, |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1434 0) |
| 769 | 1435 (window, minibuf, all_frames) |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1436 Lisp_Object window, minibuf, all_frames; |
| 265 | 1437 { |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1438 return next_window (window, minibuf, all_frames, 1); |
| 265 | 1439 } |
| 1440 | |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1441 |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1442 /* This comment supplies the doc string for `previous-window', |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1443 for make-docfile to see. We cannot put this in the real DEFUN |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1444 due to limits in the Unix cpp. |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1445 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1446 DEFUN ("previous-window", Ffoo, Sfoo, 0, 3, 0, |
|
13946
b7670a09033c
(Fprevious_window, Fwindow_configuration_p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13918
diff
changeset
|
1447 "Return the window preceding WINDOW in canonical ordering of windows.\n\ |
| 432 | 1448 If omitted, WINDOW defaults to the selected window.\n\ |
| 1449 \n\ | |
| 1450 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
| 1451 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
| 1452 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
| 1453 minibuffer even if it is active.\n\ | |
| 1454 \n\ | |
| 769 | 1455 Several frames may share a single minibuffer; if the minibuffer\n\ |
| 1456 counts, all windows on all frames that share that minibuffer count\n\ | |
| 8139 | 1457 too. Therefore, `previous-window' can be used to iterate through\n\ |
| 769 | 1458 the set of windows even when the minibuffer is on another frame. If\n\ |
| 8139 | 1459 the minibuffer does not count, only windows from WINDOW's frame count\n\ |
| 432 | 1460 \n\ |
| 769 | 1461 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
| 1462 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1463 above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\ |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1464 ALL-FRAMES = 0 means include windows on all visible and iconified frames.\n\ |
|
11307
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1465 If ALL-FRAMES is a frame, restrict search to windows on that frame.\n\ |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1466 Anything else means restrict to WINDOW's frame.\n\ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1467 \n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1468 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1469 `previous-window' to iterate through the entire cycle of acceptable\n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1470 windows, eventually ending up back at the window you started with.\n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1471 `next-window' traverses the same cycle, in the reverse order.") |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1472 (window, minibuf, all_frames) */ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1473 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1474 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1475 DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0, |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1476 0) |
| 769 | 1477 (window, minibuf, all_frames) |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1478 Lisp_Object window, minibuf, all_frames; |
| 265 | 1479 { |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1480 return next_window (window, minibuf, all_frames, 0); |
| 265 | 1481 } |
| 1482 | |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1483 |
| 338 | 1484 DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", |
| 769 | 1485 "Select the ARG'th different window on this frame.\n\ |
| 1486 All windows on current frame are arranged in a cyclic order.\n\ | |
| 265 | 1487 This command selects the window ARG steps away in that order.\n\ |
| 1488 A negative ARG moves in the opposite order. If the optional second\n\ | |
| 769 | 1489 argument ALL_FRAMES is non-nil, cycle through all frames.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1490 (arg, all_frames) |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1491 Lisp_Object arg, all_frames; |
| 265 | 1492 { |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1493 Lisp_Object window; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1494 int i; |
| 265 | 1495 |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1496 CHECK_NUMBER (arg, 0); |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1497 window = selected_window; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1498 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1499 for (i = XINT (arg); i > 0; --i) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1500 window = Fnext_window (window, Qnil, all_frames); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1501 for (; i < 0; ++i) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1502 window = Fprevious_window (window, Qnil, all_frames); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1503 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1504 Fselect_window (window); |
| 265 | 1505 return Qnil; |
| 1506 } | |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1507 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1508 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1509 DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1510 "Return a list windows in canonical ordering.\n\ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1511 Arguments are like for `next-window'.") |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1512 (window, minibuf, all_frames) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1513 Lisp_Object minibuf, all_frames; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1514 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1515 Lisp_Object tail, list; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1516 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1517 decode_next_window_args (&window, &minibuf, &all_frames); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1518 list = Qnil; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1519 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1520 for (tail = window_list (); CONSP (tail); tail = XCDR (tail)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1521 if (candidate_window_p (XCAR (tail), minibuf, all_frames)) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1522 list = Fcons (XCAR (tail), list); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1523 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1524 return list; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1525 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1526 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1527 |
| 265 | 1528 |
| 1529 /* Look at all windows, performing an operation specified by TYPE | |
| 1530 with argument OBJ. | |
|
3785
3455cbb3339d
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3765
diff
changeset
|
1531 If FRAMES is Qt, look at all frames; |
|
3455cbb3339d
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3765
diff
changeset
|
1532 Qnil, look at just the selected frame; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1533 Qvisible, look at visible frames; |
|
3785
3455cbb3339d
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3765
diff
changeset
|
1534 a frame, just look at windows on that frame. |
| 265 | 1535 If MINI is non-zero, perform the operation on minibuffer windows too. |
| 1536 */ | |
| 1537 | |
| 1538 enum window_loop | |
| 1539 { | |
| 1540 WINDOW_LOOP_UNUSED, | |
| 1541 GET_BUFFER_WINDOW, /* Arg is buffer */ | |
| 1542 GET_LRU_WINDOW, /* Arg is t for full-width windows only */ | |
| 1543 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ | |
| 1544 DELETE_BUFFER_WINDOWS, /* Arg is buffer */ | |
| 1545 GET_LARGEST_WINDOW, | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1546 UNSHOW_BUFFER, /* Arg is buffer */ |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1547 CHECK_ALL_WINDOWS |
| 265 | 1548 }; |
| 1549 | |
| 1550 static Lisp_Object | |
| 769 | 1551 window_loop (type, obj, mini, frames) |
| 265 | 1552 enum window_loop type; |
| 769 | 1553 register Lisp_Object obj, frames; |
| 265 | 1554 int mini; |
| 1555 { | |
| 1556 register Lisp_Object w; | |
| 1557 register Lisp_Object best_window; | |
| 1558 register Lisp_Object next_window; | |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1559 register Lisp_Object last_window; |
| 769 | 1560 FRAME_PTR frame; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1561 Lisp_Object frame_arg; |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1562 frame_arg = Qt; |
| 265 | 1563 |
| 769 | 1564 /* If we're only looping through windows on a particular frame, |
| 1565 frame points to that frame. If we're looping through windows | |
| 1566 on all frames, frame is 0. */ | |
| 1567 if (FRAMEP (frames)) | |
| 1568 frame = XFRAME (frames); | |
| 1569 else if (NILP (frames)) | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
1570 frame = SELECTED_FRAME (); |
| 265 | 1571 else |
| 769 | 1572 frame = 0; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1573 if (frame) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1574 frame_arg = Qlambda; |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1575 else if (XFASTINT (frames) == 0) |
|
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1576 frame_arg = frames; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1577 else if (EQ (frames, Qvisible)) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1578 frame_arg = frames; |
| 265 | 1579 |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1580 /* frame_arg is Qlambda to stick to one frame, |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1581 Qvisible to consider all visible frames, |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1582 or Qt otherwise. */ |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1583 |
| 265 | 1584 /* Pick a window to start with. */ |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
1585 if (WINDOWP (obj)) |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1586 w = obj; |
| 769 | 1587 else if (frame) |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1588 w = FRAME_SELECTED_WINDOW (frame); |
| 265 | 1589 else |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
1590 w = FRAME_SELECTED_WINDOW (SELECTED_FRAME ()); |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1591 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1592 /* Figure out the last window we're going to mess with. Since |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1593 Fnext_window, given the same options, is guaranteed to go in a |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1594 ring, we can just use Fprevious_window to find the last one. |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1595 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1596 We can't just wait until we hit the first window again, because |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1597 it might be deleted. */ |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1598 |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1599 last_window = Fprevious_window (w, mini ? Qt : Qnil, frame_arg); |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1600 |
| 265 | 1601 best_window = Qnil; |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1602 for (;;) |
| 265 | 1603 { |
| 1604 /* Pick the next window now, since some operations will delete | |
| 1605 the current window. */ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1606 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg); |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1607 |
|
6268
43853122823f
(window_loop): Delete MULTI_FRAME
Richard M. Stallman <rms@gnu.org>
parents:
6267
diff
changeset
|
1608 /* Note that we do not pay attention here to whether |
|
43853122823f
(window_loop): Delete MULTI_FRAME
Richard M. Stallman <rms@gnu.org>
parents:
6267
diff
changeset
|
1609 the frame is visible, since Fnext_window skips non-visible frames |
|
43853122823f
(window_loop): Delete MULTI_FRAME
Richard M. Stallman <rms@gnu.org>
parents:
6267
diff
changeset
|
1610 if that is desired, under the control of frame_arg. */ |
|
3785
3455cbb3339d
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3765
diff
changeset
|
1611 if (! MINI_WINDOW_P (XWINDOW (w)) |
|
23728
0d1a0ded9aa1
(temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents:
23410
diff
changeset
|
1612 /* For UNSHOW_BUFFER, we must always consider all windows. */ |
|
0d1a0ded9aa1
(temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents:
23410
diff
changeset
|
1613 || type == UNSHOW_BUFFER |
| 265 | 1614 || (mini && minibuf_level > 0)) |
| 1615 switch (type) | |
| 1616 { | |
| 1617 case GET_BUFFER_WINDOW: | |
|
16522
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1618 if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj) |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1619 /* Don't find any minibuffer window |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1620 except the one that is currently in use. */ |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1621 && (MINI_WINDOW_P (XWINDOW (w)) |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1622 ? EQ (w, minibuf_window) : 1)) |
| 265 | 1623 return w; |
| 1624 break; | |
| 1625 | |
| 1626 case GET_LRU_WINDOW: | |
| 1627 /* t as arg means consider only full-width windows */ | |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
1628 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (XWINDOW (w))) |
| 265 | 1629 break; |
| 1630 /* Ignore dedicated windows and minibuffers. */ | |
| 1631 if (MINI_WINDOW_P (XWINDOW (w)) | |
| 485 | 1632 || !NILP (XWINDOW (w)->dedicated)) |
| 265 | 1633 break; |
| 485 | 1634 if (NILP (best_window) |
| 265 | 1635 || (XFASTINT (XWINDOW (best_window)->use_time) |
| 1636 > XFASTINT (XWINDOW (w)->use_time))) | |
| 1637 best_window = w; | |
| 1638 break; | |
| 1639 | |
| 1640 case DELETE_OTHER_WINDOWS: | |
| 1641 if (XWINDOW (w) != XWINDOW (obj)) | |
| 1642 Fdelete_window (w); | |
| 1643 break; | |
| 1644 | |
| 1645 case DELETE_BUFFER_WINDOWS: | |
| 1646 if (EQ (XWINDOW (w)->buffer, obj)) | |
| 1647 { | |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1648 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1649 |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1650 /* If this window is dedicated, and in a frame of its own, |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1651 kill the frame. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1652 if (EQ (w, FRAME_ROOT_WINDOW (f)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1653 && !NILP (XWINDOW (w)->dedicated) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1654 && other_visible_frames (f)) |
| 265 | 1655 { |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1656 /* Skip the other windows on this frame. |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1657 There might be one, the minibuffer! */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1658 if (! EQ (w, last_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1659 while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window)))) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1660 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1661 /* As we go, check for the end of the loop. |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1662 We mustn't start going around a second time. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1663 if (EQ (next_window, last_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1664 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1665 last_window = w; |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1666 break; |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1667 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1668 next_window = Fnext_window (next_window, |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1669 mini ? Qt : Qnil, |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1670 frame_arg); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1671 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1672 /* Now we can safely delete the frame. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1673 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
| 265 | 1674 } |
| 1675 else | |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1676 /* If we're deleting the buffer displayed in the only window |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1677 on the frame, find a new buffer to display there. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1678 if (NILP (XWINDOW (w)->parent)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1679 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1680 Lisp_Object new_buffer; |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
1681 new_buffer = Fother_buffer (obj, Qnil, |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
1682 XWINDOW (w)->frame); |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1683 if (NILP (new_buffer)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1684 new_buffer |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1685 = Fget_buffer_create (build_string ("*scratch*")); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1686 Fset_window_buffer (w, new_buffer); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1687 if (EQ (w, selected_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1688 Fset_buffer (XWINDOW (w)->buffer); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1689 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1690 else |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1691 Fdelete_window (w); |
| 265 | 1692 } |
| 1693 break; | |
| 1694 | |
| 1695 case GET_LARGEST_WINDOW: | |
| 1696 /* Ignore dedicated windows and minibuffers. */ | |
| 1697 if (MINI_WINDOW_P (XWINDOW (w)) | |
|
28417
4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents:
28104
diff
changeset
|
1698 || !NILP (XWINDOW (w)->dedicated) |
|
4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents:
28104
diff
changeset
|
1699 || NILP (best_window)) |
| 265 | 1700 break; |
| 1701 { | |
| 1702 struct window *best_window_ptr = XWINDOW (best_window); | |
| 1703 struct window *w_ptr = XWINDOW (w); | |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1704 if (NILP (best_window) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1705 || (XFASTINT (w_ptr->height) * XFASTINT (w_ptr->width) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1706 > (XFASTINT (best_window_ptr->height) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1707 * XFASTINT (best_window_ptr->width)))) |
| 265 | 1708 best_window = w; |
| 1709 } | |
| 1710 break; | |
| 1711 | |
| 1712 case UNSHOW_BUFFER: | |
| 1713 if (EQ (XWINDOW (w)->buffer, obj)) | |
| 1714 { | |
| 1715 /* Find another buffer to show in this window. */ | |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
1716 Lisp_Object another_buffer; |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1717 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
1718 another_buffer = Fother_buffer (obj, Qnil, XWINDOW (w)->frame); |
| 485 | 1719 if (NILP (another_buffer)) |
| 265 | 1720 another_buffer |
| 1721 = Fget_buffer_create (build_string ("*scratch*")); | |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1722 /* If this window is dedicated, and in a frame of its own, |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1723 kill the frame. */ |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1724 if (EQ (w, FRAME_ROOT_WINDOW (f)) |
|
7663
eb26954fb767
(window_loop): Fix test of dedicated flag in prev change.
Richard M. Stallman <rms@gnu.org>
parents:
7647
diff
changeset
|
1725 && !NILP (XWINDOW (w)->dedicated) |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1726 && other_visible_frames (f)) |
|
8536
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1727 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1728 /* Skip the other windows on this frame. |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1729 There might be one, the minibuffer! */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1730 if (! EQ (w, last_window)) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1731 while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window)))) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1732 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1733 /* As we go, check for the end of the loop. |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1734 We mustn't start going around a second time. */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1735 if (EQ (next_window, last_window)) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1736 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1737 last_window = w; |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1738 break; |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1739 } |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1740 next_window = Fnext_window (next_window, |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1741 mini ? Qt : Qnil, |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1742 frame_arg); |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1743 } |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1744 /* Now we can safely delete the frame. */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1745 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1746 } |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1747 else |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1748 { |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1749 /* Otherwise show a different buffer in the window. */ |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1750 XWINDOW (w)->dedicated = Qnil; |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1751 Fset_window_buffer (w, another_buffer); |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1752 if (EQ (w, selected_window)) |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1753 Fset_buffer (XWINDOW (w)->buffer); |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1754 } |
| 265 | 1755 } |
| 1756 break; | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1757 |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1758 /* Check for a window that has a killed buffer. */ |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1759 case CHECK_ALL_WINDOWS: |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1760 if (! NILP (XWINDOW (w)->buffer) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1761 && NILP (XBUFFER (XWINDOW (w)->buffer)->name)) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1762 abort (); |
| 265 | 1763 } |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1764 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1765 if (EQ (w, last_window)) |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1766 break; |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1767 |
| 265 | 1768 w = next_window; |
| 1769 } | |
| 1770 | |
| 1771 return best_window; | |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
1772 } |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1773 |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1774 /* Used for debugging. Abort if any window has a dead buffer. */ |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1775 |
| 25268 | 1776 void |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1777 check_all_windows () |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1778 { |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1779 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1780 } |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1781 |
| 265 | 1782 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
| 1783 "Return the window least recently selected or used for display.\n\ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1784 If optional argument FRAME is `visible', search all visible frames.\n\ |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
1785 If FRAME is 0, search all visible and iconified frames.\n\ |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1786 If FRAME is t, search all frames.\n\ |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1787 If FRAME is nil, search only the selected frame.\n\ |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1788 If FRAME is a frame, search only that frame.") |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1789 (frame) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1790 Lisp_Object frame; |
| 265 | 1791 { |
| 1792 register Lisp_Object w; | |
| 1793 /* First try for a window that is full-width */ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1794 w = window_loop (GET_LRU_WINDOW, Qt, 0, frame); |
| 485 | 1795 if (!NILP (w) && !EQ (w, selected_window)) |
| 265 | 1796 return w; |
| 1797 /* If none of them, try the rest */ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1798 return window_loop (GET_LRU_WINDOW, Qnil, 0, frame); |
| 265 | 1799 } |
| 1800 | |
| 1801 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, | |
| 1802 "Return the largest window in area.\n\ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1803 If optional argument FRAME is `visible', search all visible frames.\n\ |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
1804 If FRAME is 0, search all visible and iconified frames.\n\ |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1805 If FRAME is t, search all frames.\n\ |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1806 If FRAME is nil, search only the selected frame.\n\ |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1807 If FRAME is a frame, search only that frame.") |
| 769 | 1808 (frame) |
| 1809 Lisp_Object frame; | |
| 265 | 1810 { |
| 1811 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, | |
| 769 | 1812 frame); |
| 265 | 1813 } |
| 1814 | |
| 1815 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, | |
| 1816 "Return a window currently displaying BUFFER, or nil if none.\n\ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1817 If optional argument FRAME is `visible', search all visible frames.\n\ |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1818 If optional argument FRAME is 0, search all visible and iconified frames.\n\ |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1819 If FRAME is t, search all frames.\n\ |
|
3803
c267c2431d92
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3785
diff
changeset
|
1820 If FRAME is nil, search only the selected frame.\n\ |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1821 If FRAME is a frame, search only that frame.") |
| 769 | 1822 (buffer, frame) |
| 1823 Lisp_Object buffer, frame; | |
| 265 | 1824 { |
| 1825 buffer = Fget_buffer (buffer); | |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
1826 if (BUFFERP (buffer)) |
| 769 | 1827 return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame); |
| 265 | 1828 else |
| 1829 return Qnil; | |
| 1830 } | |
| 1831 | |
| 1832 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows, | |
| 1833 0, 1, "", | |
| 769 | 1834 "Make WINDOW (or the selected window) fill its frame.\n\ |
|
4564
9fc21d8d9441
(Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents:
4347
diff
changeset
|
1835 Only the frame WINDOW is on is affected.\n\ |
|
9fc21d8d9441
(Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents:
4347
diff
changeset
|
1836 This function tries to reduce display jumps\n\ |
|
9fc21d8d9441
(Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents:
4347
diff
changeset
|
1837 by keeping the text previously visible in WINDOW\n\ |
|
9fc21d8d9441
(Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents:
4347
diff
changeset
|
1838 in the same place on the frame. Doing this depends on\n\ |
|
9fc21d8d9441
(Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents:
4347
diff
changeset
|
1839 the value of (window-start WINDOW), so if calling this function\n\ |
|
9fc21d8d9441
(Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents:
4347
diff
changeset
|
1840 in a program gives strange scrolling, make sure the window-start\n\ |
|
9fc21d8d9441
(Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents:
4347
diff
changeset
|
1841 value is reasonable when this function is called.") |
| 265 | 1842 (window) |
| 1843 Lisp_Object window; | |
| 1844 { | |
| 1845 struct window *w; | |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1846 int startpos; |
| 265 | 1847 int top; |
| 1848 | |
| 485 | 1849 if (NILP (window)) |
| 265 | 1850 window = selected_window; |
| 1851 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1852 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 1853 |
| 1854 w = XWINDOW (window); | |
|
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1855 |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1856 startpos = marker_position (w->start); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1857 top = XFASTINT (w->top) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); |
| 265 | 1858 |
|
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1859 if (MINI_WINDOW_P (w) && top > 0) |
|
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1860 error ("Can't expand minibuffer to full frame"); |
|
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1861 |
|
2190
482c7827b968
(Fdelete_other_windows): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
1862 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); |
| 265 | 1863 |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1864 /* Try to minimize scrolling, by setting the window start to the point |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1865 will cause the text at the old window start to be at the same place |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1866 on the frame. But don't try to do this if the window start is |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1867 outside the visible portion (as might happen when the display is |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1868 not current, due to typeahead). */ |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1869 if (startpos >= BUF_BEGV (XBUFFER (w->buffer)) |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1870 && startpos <= BUF_ZV (XBUFFER (w->buffer))) |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1871 { |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1872 struct position pos; |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1873 struct buffer *obuf = current_buffer; |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1874 |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1875 Fset_buffer (w->buffer); |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1876 /* This computation used to temporarily move point, but that can |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1877 have unwanted side effects due to text properties. */ |
|
11809
56ffc162094b
(Fdelete_other_windows): Fix args to vmotion.
Karl Heuer <kwzh@gnu.org>
parents:
11771
diff
changeset
|
1878 pos = *vmotion (startpos, -top, w); |
|
16555
6aea522a93c7
(Fdelete_other_windows): Set optional_new_start instead of force_start.
Richard M. Stallman <rms@gnu.org>
parents:
16522
diff
changeset
|
1879 |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1880 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1881 w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1882 || FETCH_BYTE (pos.bytepos - 1) == '\n') ? Qt |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1883 : Qnil); |
|
13198
43d90596da34
(Fdelete_other_windows): Set w->force_start.
Richard M. Stallman <rms@gnu.org>
parents:
13187
diff
changeset
|
1884 /* We need to do this, so that the window-scroll-functions |
|
43d90596da34
(Fdelete_other_windows): Set w->force_start.
Richard M. Stallman <rms@gnu.org>
parents:
13187
diff
changeset
|
1885 get called. */ |
|
16555
6aea522a93c7
(Fdelete_other_windows): Set optional_new_start instead of force_start.
Richard M. Stallman <rms@gnu.org>
parents:
16522
diff
changeset
|
1886 w->optional_new_start = Qt; |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1887 |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1888 set_buffer_internal (obuf); |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1889 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1890 |
| 265 | 1891 return Qnil; |
| 1892 } | |
| 1893 | |
| 1894 DEFUN ("delete-windows-on", Fdelete_windows_on, Sdelete_windows_on, | |
|
4776
fdca0d445357
(Fdelete_windows_on): Fix DEFUN to allow optional second arg to appear.
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
1895 1, 2, "bDelete windows on (buffer): ", |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1896 "Delete all windows showing BUFFER.\n\ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1897 Optional second argument FRAME controls which frames are affected.\n\ |
|
22223
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1898 If optional argument FRAME is `visible', search all visible frames.\n\ |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1899 If FRAME is 0, search all visible and iconified frames.\n\ |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1900 If FRAME is nil, search all frames.\n\ |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1901 If FRAME is t, search only the selected frame.\n\ |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1902 If FRAME is a frame, search only that frame.") |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1903 (buffer, frame) |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1904 Lisp_Object buffer, frame; |
| 265 | 1905 { |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1906 /* FRAME uses t and nil to mean the opposite of what window_loop |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1907 expects. */ |
|
22223
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1908 if (NILP (frame)) |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1909 frame = Qt; |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1910 else if (EQ (frame, Qt)) |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1911 frame = Qnil; |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1912 |
| 485 | 1913 if (!NILP (buffer)) |
| 265 | 1914 { |
| 1915 buffer = Fget_buffer (buffer); | |
| 1916 CHECK_BUFFER (buffer, 0); | |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1917 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame); |
| 265 | 1918 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1919 |
| 265 | 1920 return Qnil; |
| 1921 } | |
| 1922 | |
| 1923 DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows, | |
| 1924 Sreplace_buffer_in_windows, | |
| 1925 1, 1, "bReplace buffer in windows: ", | |
| 1926 "Replace BUFFER with some other buffer in all windows showing it.") | |
| 1927 (buffer) | |
| 1928 Lisp_Object buffer; | |
| 1929 { | |
| 485 | 1930 if (!NILP (buffer)) |
| 265 | 1931 { |
| 1932 buffer = Fget_buffer (buffer); | |
| 1933 CHECK_BUFFER (buffer, 0); | |
| 1934 window_loop (UNSHOW_BUFFER, buffer, 0, Qt); | |
| 1935 } | |
| 1936 return Qnil; | |
| 1937 } | |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1938 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1939 /* Replace BUFFER with some other buffer in all windows |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1940 of all frames, even those on other keyboards. */ |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1941 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1942 void |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1943 replace_buffer_in_all_windows (buffer) |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1944 Lisp_Object buffer; |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1945 { |
|
14204
c0b44d3a8312
(replace_buffer_in_all_windows): Don't change selected
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1946 #ifdef MULTI_KBOARD |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1947 Lisp_Object tail, frame; |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1948 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1949 /* A single call to window_loop won't do the job |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1950 because it only considers frames on the current keyboard. |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1951 So loop manually over frames, and handle each one. */ |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1952 FOR_EACH_FRAME (tail, frame) |
|
20066
affc9c857428
(replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents:
20046
diff
changeset
|
1953 window_loop (UNSHOW_BUFFER, buffer, 1, frame); |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1954 #else |
|
20066
affc9c857428
(replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents:
20046
diff
changeset
|
1955 window_loop (UNSHOW_BUFFER, buffer, 1, Qt); |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1956 #endif |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1957 } |
| 265 | 1958 |
| 1959 /* Set the height of WINDOW and all its inferiors. */ | |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1960 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1961 /* The smallest acceptable dimensions for a window. Anything smaller |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1962 might crash Emacs. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1963 |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1964 #define MIN_SAFE_WINDOW_WIDTH (2) |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1965 #define MIN_SAFE_WINDOW_HEIGHT (2) |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1966 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1967 /* Make sure that window_min_height and window_min_width are |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1968 not too small; if they are, set them to safe minima. */ |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1969 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1970 static void |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1971 check_min_window_sizes () |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1972 { |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1973 /* Smaller values might permit a crash. */ |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1974 if (window_min_width < MIN_SAFE_WINDOW_WIDTH) |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1975 window_min_width = MIN_SAFE_WINDOW_WIDTH; |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1976 if (window_min_height < MIN_SAFE_WINDOW_HEIGHT) |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1977 window_min_height = MIN_SAFE_WINDOW_HEIGHT; |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1978 } |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1979 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1980 /* If *ROWS or *COLS are too small a size for FRAME, set them to the |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1981 minimum allowable size. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1982 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1983 void |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1984 check_frame_size (frame, rows, cols) |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1985 FRAME_PTR frame; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1986 int *rows, *cols; |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1987 { |
|
4347
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
1988 /* For height, we have to see: |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
1989 whether the frame has a minibuffer, |
|
4347
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
1990 whether it wants a mode line, and |
|
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
1991 whether it has a menu bar. */ |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1992 int min_height = |
|
3765
bde2da377085
* window.c (check_frame_size): Allow minibuffer-only frames to be
Jim Blandy <jimb@redhat.com>
parents:
3723
diff
changeset
|
1993 (FRAME_MINIBUF_ONLY_P (frame) ? MIN_SAFE_WINDOW_HEIGHT - 1 |
|
bde2da377085
* window.c (check_frame_size): Allow minibuffer-only frames to be
Jim Blandy <jimb@redhat.com>
parents:
3723
diff
changeset
|
1994 : (! FRAME_HAS_MINIBUF_P (frame)) ? MIN_SAFE_WINDOW_HEIGHT |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1995 : 2 * MIN_SAFE_WINDOW_HEIGHT - 1); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1996 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1997 if (FRAME_TOP_MARGIN (frame) > 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1998 min_height += FRAME_TOP_MARGIN (frame); |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1999 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2000 if (*rows < min_height) |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2001 *rows = min_height; |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2002 if (*cols < MIN_SAFE_WINDOW_WIDTH) |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2003 *cols = MIN_SAFE_WINDOW_WIDTH; |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2004 } |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2005 |
| 25254 | 2006 |
| 25268 | 2007 /* Value is non-zero if window W is fixed-size. WIDTH_P non-zero means |
| 2008 check if W's width can be changed, otherwise check W's height. | |
| 2009 CHECK_SIBLINGS_P non-zero means check resizablity of WINDOW's | |
| 2010 siblings, too. If none of the siblings is resizable, WINDOW isn't | |
| 2011 either. */ | |
| 2012 | |
| 2013 static int | |
| 2014 window_fixed_size_p (w, width_p, check_siblings_p) | |
| 2015 struct window *w; | |
| 2016 int width_p, check_siblings_p; | |
| 2017 { | |
| 2018 int fixed_p; | |
| 2019 struct window *c; | |
| 2020 | |
| 2021 if (!NILP (w->hchild)) | |
| 2022 { | |
| 2023 c = XWINDOW (w->hchild); | |
| 2024 | |
| 2025 if (width_p) | |
| 2026 { | |
| 2027 /* A horiz. combination is fixed-width if all of if its | |
| 2028 children are. */ | |
| 2029 while (c && window_fixed_size_p (c, width_p, 0)) | |
| 2030 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2031 fixed_p = c == NULL; | |
| 2032 } | |
| 2033 else | |
| 2034 { | |
| 2035 /* A horiz. combination is fixed-height if one of if its | |
| 2036 children is. */ | |
| 2037 while (c && !window_fixed_size_p (c, width_p, 0)) | |
| 2038 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2039 fixed_p = c != NULL; | |
| 2040 } | |
| 2041 } | |
| 2042 else if (!NILP (w->vchild)) | |
| 2043 { | |
| 2044 c = XWINDOW (w->vchild); | |
| 2045 | |
| 2046 if (width_p) | |
| 2047 { | |
| 2048 /* A vert. combination is fixed-width if one of if its | |
| 2049 children is. */ | |
| 2050 while (c && !window_fixed_size_p (c, width_p, 0)) | |
| 2051 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2052 fixed_p = c != NULL; | |
| 2053 } | |
| 2054 else | |
| 2055 { | |
| 2056 /* A vert. combination is fixed-height if all of if its | |
| 2057 children are. */ | |
| 2058 while (c && window_fixed_size_p (c, width_p, 0)) | |
| 2059 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2060 fixed_p = c == NULL; | |
| 2061 } | |
| 2062 } | |
| 2063 else if (BUFFERP (w->buffer)) | |
| 2064 { | |
|
25739
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2065 if (w->height_fixed_p && !width_p) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2066 fixed_p = 1; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2067 else |
| 25268 | 2068 { |
|
25739
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2069 struct buffer *old = current_buffer; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2070 Lisp_Object val; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2071 |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2072 current_buffer = XBUFFER (w->buffer); |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2073 val = find_symbol_value (Qwindow_size_fixed); |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2074 current_buffer = old; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2075 |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2076 fixed_p = 0; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2077 if (!EQ (val, Qunbound)) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2078 { |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2079 fixed_p = !NILP (val); |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2080 |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2081 if (fixed_p |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2082 && ((EQ (val, Qheight) && width_p) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2083 || (EQ (val, Qwidth) && !width_p))) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2084 fixed_p = 0; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2085 } |
| 25268 | 2086 } |
| 2087 | |
| 2088 /* Can't tell if this one is resizable without looking at | |
| 2089 siblings. If all siblings are fixed-size this one is too. */ | |
| 2090 if (!fixed_p && check_siblings_p && WINDOWP (w->parent)) | |
| 2091 { | |
| 2092 Lisp_Object child; | |
| 2093 | |
| 2094 for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev) | |
| 2095 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) | |
| 2096 break; | |
| 2097 | |
| 2098 if (NILP (child)) | |
| 2099 for (child = w->next; !NILP (child); child = XWINDOW (child)->next) | |
| 2100 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) | |
| 2101 break; | |
| 2102 | |
| 2103 if (NILP (child)) | |
| 2104 fixed_p = 1; | |
| 2105 } | |
| 2106 } | |
| 2107 else | |
| 2108 fixed_p = 1; | |
| 2109 | |
| 2110 return fixed_p; | |
| 2111 } | |
| 2112 | |
| 2113 | |
| 2114 /* Return the minimum size of window W, not taking fixed-width windows | |
| 2115 into account. WIDTH_P non-zero means return the minimum width, | |
| 2116 otherwise return the minimum height. If W is a combination window, | |
| 2117 compute the minimum size from the minimum sizes of W's children. */ | |
| 2118 | |
| 2119 static int | |
| 2120 window_min_size_1 (w, width_p) | |
| 25254 | 2121 struct window *w; |
| 2122 int width_p; | |
| 2123 { | |
| 25268 | 2124 struct window *c; |
| 25254 | 2125 int size; |
| 2126 | |
| 25268 | 2127 if (!NILP (w->hchild)) |
| 2128 { | |
| 2129 c = XWINDOW (w->hchild); | |
| 2130 size = 0; | |
| 2131 | |
| 2132 if (width_p) | |
| 2133 { | |
| 2134 /* The min width of a horizontal combination is | |
| 2135 the sum of the min widths of its children. */ | |
| 2136 while (c) | |
| 2137 { | |
| 2138 size += window_min_size_1 (c, width_p); | |
| 2139 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2140 } | |
| 2141 } | |
| 2142 else | |
| 2143 { | |
| 2144 /* The min height a horizontal combination equals | |
| 2145 the maximum of all min height of its children. */ | |
| 2146 while (c) | |
| 2147 { | |
| 2148 int min_size = window_min_size_1 (c, width_p); | |
| 2149 size = max (min_size, size); | |
| 2150 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2151 } | |
| 2152 } | |
| 2153 } | |
| 2154 else if (!NILP (w->vchild)) | |
| 2155 { | |
| 2156 c = XWINDOW (w->vchild); | |
| 2157 size = 0; | |
| 2158 | |
| 2159 if (width_p) | |
| 2160 { | |
| 2161 /* The min width of a vertical combination is | |
| 2162 the maximum of the min widths of its children. */ | |
| 2163 while (c) | |
| 2164 { | |
| 2165 int min_size = window_min_size_1 (c, width_p); | |
| 2166 size = max (min_size, size); | |
| 2167 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2168 } | |
| 2169 } | |
| 2170 else | |
| 2171 { | |
| 2172 /* The min height of a vertical combination equals | |
| 2173 the sum of the min height of its children. */ | |
| 2174 while (c) | |
| 2175 { | |
| 2176 size += window_min_size_1 (c, width_p); | |
| 2177 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2178 } | |
| 2179 } | |
| 2180 } | |
| 25254 | 2181 else |
| 2182 { | |
| 25268 | 2183 if (width_p) |
| 2184 size = window_min_width; | |
| 25254 | 2185 else |
| 25268 | 2186 { |
| 2187 if (MINI_WINDOW_P (w) | |
| 2188 || (!WINDOW_WANTS_MODELINE_P (w) | |
| 25546 | 2189 && !WINDOW_WANTS_HEADER_LINE_P (w))) |
| 25268 | 2190 size = 1; |
| 2191 else | |
| 2192 size = window_min_height; | |
| 2193 } | |
| 25254 | 2194 } |
| 2195 | |
| 2196 return size; | |
| 2197 } | |
| 2198 | |
| 2199 | |
| 25268 | 2200 /* Return the minimum size of window W, taking fixed-size windows into |
| 2201 account. WIDTH_P non-zero means return the minimum width, | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2202 otherwise return the minimum height. IGNORE_FIXED_P non-zero means |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2203 ignore if W is fixed-size. Set *FIXED to 1 if W is fixed-size |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2204 unless FIXED is null. */ |
| 25268 | 2205 |
| 2206 static int | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2207 window_min_size (w, width_p, ignore_fixed_p, fixed) |
| 25268 | 2208 struct window *w; |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2209 int width_p, ignore_fixed_p, *fixed; |
| 25268 | 2210 { |
| 2211 int size, fixed_p; | |
| 2212 | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2213 if (ignore_fixed_p) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2214 fixed_p = 0; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2215 else |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2216 fixed_p = window_fixed_size_p (w, width_p, 1); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2217 |
| 25268 | 2218 if (fixed) |
| 2219 *fixed = fixed_p; | |
| 2220 | |
| 2221 if (fixed_p) | |
| 2222 size = width_p ? XFASTINT (w->width) : XFASTINT (w->height); | |
| 2223 else | |
| 2224 size = window_min_size_1 (w, width_p); | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2225 |
| 25268 | 2226 return size; |
| 2227 } | |
| 2228 | |
| 2229 | |
| 2230 /* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set | |
| 2231 WINDOW's width. Resize WINDOW's children, if any, so that they | |
| 2232 keep their proportionate size relative to WINDOW. Propagate | |
| 2233 WINDOW's top or left edge position to children. Delete windows | |
| 2234 that become too small unless NODELETE_P is non-zero. */ | |
| 2235 | |
| 2236 static void | |
| 2237 size_window (window, size, width_p, nodelete_p) | |
| 2238 Lisp_Object window; | |
| 2239 int size, width_p, nodelete_p; | |
| 2240 { | |
| 2241 struct window *w = XWINDOW (window); | |
| 2242 struct window *c; | |
| 2243 Lisp_Object child, *forward, *sideward; | |
| 2244 int old_size, min_size; | |
| 2245 | |
| 2246 check_min_window_sizes (); | |
| 2247 | |
| 2248 /* If the window has been "too small" at one point, | |
| 2249 don't delete it for being "too small" in the future. | |
| 2250 Preserve it as long as that is at all possible. */ | |
| 2251 if (width_p) | |
| 2252 { | |
| 2253 old_size = XFASTINT (w->width); | |
| 2254 min_size = window_min_width; | |
| 2255 } | |
| 2256 else | |
| 2257 { | |
| 2258 old_size = XFASTINT (w->height); | |
| 2259 min_size = window_min_height; | |
| 2260 } | |
| 2261 | |
| 2262 if (old_size < window_min_width) | |
| 2263 w->too_small_ok = Qt; | |
| 2264 | |
| 2265 /* Maybe delete WINDOW if it's too small. */ | |
| 2266 if (!nodelete_p && !NILP (w->parent)) | |
| 2267 { | |
| 2268 int min_size; | |
| 2269 | |
| 2270 if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok)) | |
| 2271 min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT; | |
| 2272 else | |
| 2273 min_size = width_p ? window_min_width : window_min_height; | |
| 2274 | |
| 2275 if (size < min_size) | |
| 2276 { | |
| 2277 delete_window (window); | |
| 2278 return; | |
| 2279 } | |
| 2280 } | |
| 2281 | |
| 2282 /* Set redisplay hints. */ | |
| 2283 XSETFASTINT (w->last_modified, 0); | |
| 2284 XSETFASTINT (w->last_overlay_modified, 0); | |
| 2285 windows_or_buffers_changed++; | |
| 2286 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1; | |
| 2287 | |
| 2288 if (width_p) | |
| 2289 { | |
| 2290 sideward = &w->vchild; | |
| 2291 forward = &w->hchild; | |
| 2292 XSETFASTINT (w->width, size); | |
| 2293 } | |
| 2294 else | |
| 2295 { | |
| 2296 sideward = &w->hchild; | |
| 2297 forward = &w->vchild; | |
| 2298 XSETFASTINT (w->height, size); | |
| 2299 } | |
| 2300 | |
| 2301 if (!NILP (*sideward)) | |
| 2302 { | |
| 2303 for (child = *sideward; !NILP (child); child = c->next) | |
| 2304 { | |
| 2305 c = XWINDOW (child); | |
| 2306 if (width_p) | |
| 2307 c->left = w->left; | |
| 2308 else | |
| 2309 c->top = w->top; | |
| 2310 size_window (child, size, width_p, nodelete_p); | |
| 2311 } | |
| 2312 } | |
| 2313 else if (!NILP (*forward)) | |
| 2314 { | |
| 2315 int fixed_size, each, extra, n; | |
| 2316 int resize_fixed_p, nfixed; | |
| 2317 int last_pos, first_pos, nchildren; | |
| 2318 | |
| 2319 /* Determine the fixed-size portion of the this window, and the | |
| 2320 number of child windows. */ | |
| 2321 fixed_size = nchildren = nfixed = 0; | |
| 2322 for (child = *forward; !NILP (child); child = c->next, ++nchildren) | |
| 2323 { | |
| 2324 c = XWINDOW (child); | |
| 2325 if (window_fixed_size_p (c, width_p, 0)) | |
| 2326 { | |
| 2327 fixed_size += (width_p | |
| 2328 ? XFASTINT (c->width) : XFASTINT (c->height)); | |
| 2329 ++nfixed; | |
| 2330 } | |
| 2331 } | |
| 2332 | |
| 2333 /* If the new size is smaller than fixed_size, or if there | |
| 2334 aren't any resizable windows, allow resizing fixed-size | |
| 2335 windows. */ | |
| 2336 resize_fixed_p = nfixed == nchildren || size < fixed_size; | |
| 2337 | |
| 2338 /* Compute how many lines/columns to add to each child. The | |
| 2339 value of extra takes care of rounding errors. */ | |
| 2340 n = resize_fixed_p ? nchildren : nchildren - nfixed; | |
| 2341 each = (size - old_size) / n; | |
| 2342 extra = (size - old_size) - n * each; | |
| 2343 | |
| 2344 /* Compute new children heights and edge positions. */ | |
| 2345 first_pos = width_p ? XFASTINT (w->left) : XFASTINT (w->top); | |
| 2346 last_pos = first_pos; | |
| 2347 for (child = *forward; !NILP (child); child = c->next) | |
| 2348 { | |
| 2349 int new_size, old_size; | |
| 2350 | |
| 2351 c = XWINDOW (child); | |
| 2352 old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); | |
| 2353 new_size = old_size; | |
| 2354 | |
| 2355 /* The top or left edge position of this child equals the | |
| 2356 bottom or right edge of its predecessor. */ | |
| 2357 if (width_p) | |
| 2358 c->left = make_number (last_pos); | |
| 2359 else | |
| 2360 c->top = make_number (last_pos); | |
| 2361 | |
| 2362 /* If this child can be resized, do it. */ | |
| 2363 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) | |
| 2364 { | |
| 2365 new_size = old_size + each + extra; | |
| 2366 extra = 0; | |
| 2367 } | |
| 2368 | |
| 2369 /* Set new height. Note that size_window also propagates | |
| 2370 edge positions to children, so it's not a no-op if we | |
| 2371 didn't change the child's size. */ | |
| 2372 size_window (child, new_size, width_p, 1); | |
| 2373 | |
| 2374 /* Remember the bottom/right edge position of this child; it | |
| 2375 will be used to set the top/left edge of the next child. */ | |
| 2376 last_pos += new_size; | |
| 2377 } | |
| 2378 | |
| 2379 /* We should have covered the parent exactly with child windows. */ | |
| 2380 xassert (size == last_pos - first_pos); | |
| 2381 | |
| 2382 /* Now delete any children that became too small. */ | |
| 2383 if (!nodelete_p) | |
| 2384 for (child = *forward; !NILP (child); child = c->next) | |
| 2385 { | |
| 2386 int child_size; | |
| 2387 c = XWINDOW (child); | |
| 2388 child_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); | |
| 2389 size_window (child, child_size, width_p, 0); | |
| 2390 } | |
| 2391 } | |
| 2392 } | |
| 2393 | |
| 2394 /* Set WINDOW's height to HEIGHT, and recursively change the height of | |
| 2395 WINDOW's children. NODELETE non-zero means don't delete windows | |
| 2396 that become too small in the process. (The caller should check | |
| 2397 later and do so if appropriate.) */ | |
| 265 | 2398 |
| 20351 | 2399 void |
| 265 | 2400 set_window_height (window, height, nodelete) |
| 2401 Lisp_Object window; | |
| 2402 int height; | |
| 2403 int nodelete; | |
| 2404 { | |
| 25268 | 2405 size_window (window, height, 0, nodelete); |
| 265 | 2406 } |
| 2407 | |
| 25268 | 2408 |
| 2409 /* Set WINDOW's width to WIDTH, and recursively change the width of | |
| 2410 WINDOW's children. NODELETE non-zero means don't delete windows | |
| 2411 that become too small in the process. (The caller should check | |
| 2412 later and do so if appropriate.) */ | |
| 265 | 2413 |
| 20351 | 2414 void |
| 265 | 2415 set_window_width (window, width, nodelete) |
| 2416 Lisp_Object window; | |
| 2417 int width; | |
| 2418 int nodelete; | |
| 2419 { | |
| 25268 | 2420 size_window (window, width, 1, nodelete); |
| 265 | 2421 } |
| 25268 | 2422 |
| 265 | 2423 |
| 362 | 2424 int window_select_count; |
| 265 | 2425 |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2426 Lisp_Object |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2427 Fset_window_buffer_unwind (obuf) |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2428 Lisp_Object obuf; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2429 { |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2430 Fset_buffer (obuf); |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2431 return Qnil; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2432 } |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2433 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2434 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2435 /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2436 means it's allowed to run hooks. See make_frame for a case where |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2437 it's not allowed. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2438 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2439 void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2440 set_window_buffer (window, buffer, run_hooks_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2441 Lisp_Object window, buffer; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2442 int run_hooks_p; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2443 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2444 struct window *w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2445 struct buffer *b = XBUFFER (buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2446 int count = specpdl_ptr - specpdl; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2447 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2448 w->buffer = buffer; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2449 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2450 if (EQ (window, selected_window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2451 b->last_selected_window = window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2452 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2453 /* Update time stamps of buffer display. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2454 if (INTEGERP (b->display_count)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2455 XSETINT (b->display_count, XINT (b->display_count) + 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2456 b->display_time = Fcurrent_time (); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2457 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2458 XSETFASTINT (w->window_end_pos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2459 XSETFASTINT (w->window_end_vpos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2460 bzero (&w->last_cursor, sizeof w->last_cursor); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2461 w->window_end_valid = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2462 XSETFASTINT (w->hscroll, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2463 set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2464 set_marker_restricted (w->start, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2465 make_number (b->last_window_start), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2466 buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2467 w->start_at_line_beg = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2468 w->force_start = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2469 XSETFASTINT (w->last_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2470 XSETFASTINT (w->last_overlay_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2471 windows_or_buffers_changed++; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2472 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2473 /* We must select BUFFER for running the window-scroll-functions. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2474 If WINDOW is selected, switch permanently. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2475 Otherwise, switch but go back to the ambient buffer afterward. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2476 if (EQ (window, selected_window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2477 Fset_buffer (buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2478 /* We can't check ! NILP (Vwindow_scroll_functions) here |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2479 because that might itself be a local variable. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2480 else if (window_initialized) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2481 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2482 record_unwind_protect (Fset_window_buffer_unwind, Fcurrent_buffer ()); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2483 Fset_buffer (buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2484 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2485 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2486 /* Set left and right marginal area width from buffer. */ |
|
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
2487 Fset_window_margins (window, b->left_margin_width, b->right_margin_width); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2488 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2489 if (run_hooks_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2490 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2491 if (! NILP (Vwindow_scroll_functions)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2492 run_hook_with_args_2 (Qwindow_scroll_functions, window, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2493 Fmarker_position (w->start)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2494 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2495 if (! NILP (Vwindow_configuration_change_hook) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2496 && ! NILP (Vrun_hooks)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2497 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2498 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2499 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2500 unbind_to (count, Qnil); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2501 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2502 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2503 |
| 265 | 2504 DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 2, 0, |
| 2505 "Make WINDOW display BUFFER as its contents.\n\ | |
| 2506 BUFFER can be a buffer or buffer name.") | |
| 2507 (window, buffer) | |
| 2508 register Lisp_Object window, buffer; | |
| 2509 { | |
| 2510 register Lisp_Object tem; | |
| 2511 register struct window *w = decode_window (window); | |
| 2512 | |
|
27848
27b993d2ea05
(Fset_window_buffer): Set WINDOW to the window
Gerd Moellmann <gerd@gnu.org>
parents:
27699
diff
changeset
|
2513 XSETWINDOW (window, w); |
| 265 | 2514 buffer = Fget_buffer (buffer); |
| 2515 CHECK_BUFFER (buffer, 1); | |
| 2516 | |
| 485 | 2517 if (NILP (XBUFFER (buffer)->name)) |
| 265 | 2518 error ("Attempt to display deleted buffer"); |
| 2519 | |
| 2520 tem = w->buffer; | |
| 485 | 2521 if (NILP (tem)) |
| 265 | 2522 error ("Window is deleted"); |
| 2523 else if (! EQ (tem, Qt)) /* w->buffer is t when the window | |
| 2524 is first being set up. */ | |
| 2525 { | |
| 485 | 2526 if (!NILP (w->dedicated) && !EQ (tem, buffer)) |
|
7545
0e1f3b9598bb
(Fset_window_buffer): Fix dedicated window error call.
Richard M. Stallman <rms@gnu.org>
parents:
7348
diff
changeset
|
2527 error ("Window is dedicated to `%s'", |
|
0e1f3b9598bb
(Fset_window_buffer): Fix dedicated window error call.
Richard M. Stallman <rms@gnu.org>
parents:
7348
diff
changeset
|
2528 XSTRING (XBUFFER (tem)->name)->data); |
| 265 | 2529 |
| 2530 unshow_buffer (w); | |
| 2531 } | |
| 2532 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2533 set_window_buffer (window, buffer, 1); |
| 265 | 2534 return Qnil; |
| 2535 } | |
| 2536 | |
| 2537 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, | |
| 2538 "Select WINDOW. Most editing will apply to WINDOW's buffer.\n\ | |
|
22149
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2539 If WINDOW is not already selected, also make WINDOW's buffer current.\n\ |
|
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2540 Note that the main editor command loop\n\ |
|
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2541 selects the buffer of the selected window before each command.") |
| 265 | 2542 (window) |
| 2543 register Lisp_Object window; | |
| 2544 { | |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2545 return select_window_1 (window, 1); |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2546 } |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2547 |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2548 /* Note that selected_window can be nil |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2549 when this is called from Fset_window_configuration. */ |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2550 |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2551 static Lisp_Object |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2552 select_window_1 (window, recordflag) |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2553 register Lisp_Object window; |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2554 int recordflag; |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2555 { |
| 265 | 2556 register struct window *w; |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2557 register struct window *ow; |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2558 struct frame *sf; |
| 265 | 2559 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2560 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 2561 |
| 2562 w = XWINDOW (window); | |
| 2563 | |
| 485 | 2564 if (NILP (w->buffer)) |
| 265 | 2565 error ("Trying to select deleted window or non-leaf window"); |
| 2566 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2567 XSETFASTINT (w->use_time, ++window_select_count); |
| 265 | 2568 if (EQ (window, selected_window)) |
| 2569 return window; | |
| 2570 | |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2571 if (!NILP (selected_window)) |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2572 { |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2573 ow = XWINDOW (selected_window); |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2574 if (! NILP (ow->buffer)) |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2575 set_marker_both (ow->pointm, ow->buffer, |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2576 BUF_PT (XBUFFER (ow->buffer)), |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2577 BUF_PT_BYTE (XBUFFER (ow->buffer))); |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2578 } |
| 265 | 2579 |
| 2580 selected_window = window; | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2581 sf = SELECTED_FRAME (); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2582 if (XFRAME (WINDOW_FRAME (w)) != sf) |
| 265 | 2583 { |
| 769 | 2584 XFRAME (WINDOW_FRAME (w))->selected_window = window; |
|
7080
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2585 /* Use this rather than Fhandle_switch_frame |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2586 so that FRAME_FOCUS_FRAME is moved appropriately as we |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2587 move around in the state where a minibuffer in a separate |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2588 frame is active. */ |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2589 Fselect_frame (WINDOW_FRAME (w), Qnil); |
| 265 | 2590 } |
| 2591 else | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2592 sf->selected_window = window; |
| 265 | 2593 |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2594 if (recordflag) |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2595 record_buffer (w->buffer); |
| 265 | 2596 Fset_buffer (w->buffer); |
| 2597 | |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
2598 XBUFFER (w->buffer)->last_selected_window = window; |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
2599 |
| 265 | 2600 /* Go to the point recorded in the window. |
| 2601 This is important when the buffer is in more | |
| 2602 than one window. It also matters when | |
| 2603 redisplay_window has altered point after scrolling, | |
| 2604 because it makes the change only in the window. */ | |
| 2605 { | |
| 2606 register int new_point = marker_position (w->pointm); | |
| 2607 if (new_point < BEGV) | |
| 2608 SET_PT (BEGV); | |
|
8245
b743577d12c2
(Fselect_window): Fix bug checking new_point is in range.
Richard M. Stallman <rms@gnu.org>
parents:
8191
diff
changeset
|
2609 else if (new_point > ZV) |
| 265 | 2610 SET_PT (ZV); |
| 2611 else | |
| 2612 SET_PT (new_point); | |
| 2613 } | |
| 2614 | |
| 2615 windows_or_buffers_changed++; | |
| 2616 return window; | |
| 2617 } | |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2618 |
|
14175
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2619 /* Deiconify the frame containing the window WINDOW, |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2620 unless it is the selected frame; |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2621 then return WINDOW. |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2622 |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2623 The reason for the exception for the selected frame |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2624 is that it seems better not to change the selected frames visibility |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2625 merely because of displaying a different buffer in it. |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2626 The deiconification is useful when a buffer gets shown in |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2627 another frame that you were not using lately. */ |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2628 |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2629 static Lisp_Object |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2630 display_buffer_1 (window) |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2631 Lisp_Object window; |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2632 { |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2633 Lisp_Object frame = XWINDOW (window)->frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2634 FRAME_PTR f = XFRAME (frame); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2635 |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2636 FRAME_SAMPLE_VISIBILITY (f); |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2637 |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2638 if (!EQ (frame, selected_frame)) |
|
14535
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2639 { |
|
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2640 if (FRAME_ICONIFIED_P (f)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2641 Fmake_frame_visible (frame); |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2642 else if (FRAME_VISIBLE_P (f)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2643 Fraise_frame (frame); |
|
14535
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2644 } |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2645 |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2646 return window; |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2647 } |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2648 |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2649 DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0, |
|
16587
13cda507257c
(special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents:
16559
diff
changeset
|
2650 "Returns non-nil if a buffer named BUFFER-NAME would be created specially.\n\ |
|
13cda507257c
(special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents:
16559
diff
changeset
|
2651 The value is actually t if the frame should be called with default frame\n\ |
|
13cda507257c
(special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents:
16559
diff
changeset
|
2652 parameters, and a list of frame parameters if they were specified.\n\ |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2653 See `special-display-buffer-names', and `special-display-regexps'.") |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2654 (buffer_name) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2655 Lisp_Object buffer_name; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2656 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2657 Lisp_Object tem; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2658 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2659 CHECK_STRING (buffer_name, 1); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2660 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2661 tem = Fmember (buffer_name, Vspecial_display_buffer_names); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2662 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2663 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2664 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2665 tem = Fassoc (buffer_name, Vspecial_display_buffer_names); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2666 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2667 return XCDR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2668 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2669 for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCDR (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2670 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2671 Lisp_Object car = XCAR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2672 if (STRINGP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2673 && fast_string_match (car, buffer_name) >= 0) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2674 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2675 else if (CONSP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2676 && STRINGP (XCAR (car)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2677 && fast_string_match (XCAR (car), buffer_name) >= 0) |
|
20653
19ba67f153d5
(Fspecial_display_p): Return the right value
Richard M. Stallman <rms@gnu.org>
parents:
20627
diff
changeset
|
2678 return XCDR (car); |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2679 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2680 return Qnil; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2681 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2682 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2683 DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0, |
|
16587
13cda507257c
(special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents:
16559
diff
changeset
|
2684 "Returns non-nil if a new buffer named BUFFER-NAME would use the same window.\n\ |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2685 See `same-window-buffer-names' and `same-window-regexps'.") |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2686 (buffer_name) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2687 Lisp_Object buffer_name; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2688 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2689 Lisp_Object tem; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2690 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2691 CHECK_STRING (buffer_name, 1); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2692 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2693 tem = Fmember (buffer_name, Vsame_window_buffer_names); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2694 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2695 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2696 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2697 tem = Fassoc (buffer_name, Vsame_window_buffer_names); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2698 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2699 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2700 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2701 for (tem = Vsame_window_regexps; CONSP (tem); tem = XCDR (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2702 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2703 Lisp_Object car = XCAR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2704 if (STRINGP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2705 && fast_string_match (car, buffer_name) >= 0) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2706 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2707 else if (CONSP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2708 && STRINGP (XCAR (car)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2709 && fast_string_match (XCAR (car), buffer_name) >= 0) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2710 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2711 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2712 return Qnil; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2713 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2714 |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2715 /* Use B so the default is (other-buffer). */ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2716 DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 3, |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2717 "BDisplay buffer: \nP", |
| 265 | 2718 "Make BUFFER appear in some window but don't select it.\n\ |
| 2719 BUFFER can be a buffer or a buffer name.\n\ | |
| 2720 If BUFFER is shown already in some window, just use that one,\n\ | |
| 2721 unless the window is the selected window and the optional second\n\ | |
|
1805
7ba5cfe280eb
(Fdisplay_buffer): Doc fix.
Roland McGrath <roland@gnu.org>
parents:
1798
diff
changeset
|
2722 argument NOT-THIS-WINDOW is non-nil (interactively, with prefix arg).\n\ |
|
5232
823c0cf7bbc8
(Fdisplay_buffer): If pop_up_frames, pass t to Fget_buffer_window.
Richard M. Stallman <rms@gnu.org>
parents:
5096
diff
changeset
|
2723 If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\ |
|
15306
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2724 Returns the window displaying BUFFER.\n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2725 \n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2726 The variables `special-display-buffer-names', `special-display-regexps',\n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2727 `same-window-buffer-names', and `same-window-regexps' customize how certain\n\ |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2728 buffer names are handled.\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2729 \n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2730 If optional argument FRAME is `visible', search all visible frames.\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2731 If FRAME is 0, search all visible and iconified frames.\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2732 If FRAME is t, search all frames.\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2733 If FRAME is a frame, search only that frame.\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2734 If FRAME is nil, search only the selected frame\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2735 (actually the last nonminibuffer frame),\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2736 unless `pop-up-frames' is non-nil,\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2737 which means search visible and iconified frames.") |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2738 (buffer, not_this_window, frame) |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2739 register Lisp_Object buffer, not_this_window, frame; |
| 265 | 2740 { |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2741 register Lisp_Object window, tem, swp; |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2742 struct frame *f; |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2743 |
|
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2744 swp = Qnil; |
| 265 | 2745 buffer = Fget_buffer (buffer); |
| 2746 CHECK_BUFFER (buffer, 0); | |
| 2747 | |
| 485 | 2748 if (!NILP (Vdisplay_buffer_function)) |
| 265 | 2749 return call2 (Vdisplay_buffer_function, buffer, not_this_window); |
| 2750 | |
| 485 | 2751 if (NILP (not_this_window) |
| 265 | 2752 && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer)) |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2753 return display_buffer_1 (selected_window); |
| 265 | 2754 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2755 /* See if the user has specified this buffer should appear |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2756 in the selected window. */ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2757 if (NILP (not_this_window)) |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2758 { |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2759 swp = Fsame_window_p (XBUFFER (buffer)->name); |
|
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2760 if (!NILP (swp) && !no_switch_window (selected_window)) |
|
11003
71304a70d0f6
(Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents:
10958
diff
changeset
|
2761 { |
|
71304a70d0f6
(Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents:
10958
diff
changeset
|
2762 Fswitch_to_buffer (buffer, Qnil); |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2763 return display_buffer_1 (selected_window); |
|
11003
71304a70d0f6
(Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents:
10958
diff
changeset
|
2764 } |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2765 } |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2766 |
|
6262
930d259c1f95
(Fdisplay_buffer): If pop_up_frames != 0,
Richard M. Stallman <rms@gnu.org>
parents:
6247
diff
changeset
|
2767 /* If pop_up_frames, |
|
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2768 look for a window showing BUFFER on any visible or iconified frame. |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2769 Otherwise search only the current frame. */ |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2770 if (! NILP (frame)) |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2771 tem = frame; |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2772 else if (pop_up_frames || last_nonminibuf_frame == 0) |
|
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2773 XSETFASTINT (tem, 0); |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2774 else |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2775 XSETFRAME (tem, last_nonminibuf_frame); |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2776 window = Fget_buffer_window (buffer, tem); |
| 485 | 2777 if (!NILP (window) |
| 2778 && (NILP (not_this_window) || !EQ (window, selected_window))) | |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
2779 { |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2780 return display_buffer_1 (window); |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
2781 } |
| 265 | 2782 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2783 /* Certain buffer names get special handling. */ |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2784 if (!NILP (Vspecial_display_function) && NILP (swp)) |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2785 { |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2786 tem = Fspecial_display_p (XBUFFER (buffer)->name); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2787 if (EQ (tem, Qt)) |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2788 return call1 (Vspecial_display_function, buffer); |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2789 if (CONSP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2790 return call2 (Vspecial_display_function, buffer, tem); |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2791 } |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2792 |
| 769 | 2793 /* If there are no frames open that have more than a minibuffer, |
| 2794 we need to create a new frame. */ | |
| 2795 if (pop_up_frames || last_nonminibuf_frame == 0) | |
| 265 | 2796 { |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2797 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
| 265 | 2798 Fset_window_buffer (window, buffer); |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2799 return display_buffer_1 (window); |
| 265 | 2800 } |
| 2801 | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2802 f = SELECTED_FRAME (); |
| 358 | 2803 if (pop_up_windows |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2804 || FRAME_MINIBUF_ONLY_P (f) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2805 /* If the current frame is a special display frame, |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2806 don't try to reuse its windows. */ |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2807 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated)) |
| 358 | 2808 { |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2809 Lisp_Object frames; |
|
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2810 |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2811 frames = Qnil; |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2812 if (FRAME_MINIBUF_ONLY_P (f)) |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
2813 XSETFRAME (frames, last_nonminibuf_frame); |
| 265 | 2814 /* Don't try to create a window if would get an error */ |
| 2815 if (split_height_threshold < window_min_height << 1) | |
| 2816 split_height_threshold = window_min_height << 1; | |
| 2817 | |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2818 /* Note that both Fget_largest_window and Fget_lru_window |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2819 ignore minibuffers and dedicated windows. |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2820 This means they can return nil. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2821 |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2822 /* If the frame we would try to split cannot be split, |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2823 try other frames. */ |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2824 if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2825 { |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2826 /* Try visible frames first. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2827 window = Fget_largest_window (Qvisible); |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2828 /* If that didn't work, try iconified frames. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2829 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2830 window = Fget_largest_window (make_number (0)); |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2831 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2832 window = Fget_largest_window (Qt); |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2833 } |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2834 else |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2835 window = Fget_largest_window (frames); |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2836 |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2837 /* If we got a tall enough full-width window that can be split, |
|
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2838 split it. */ |
| 485 | 2839 if (!NILP (window) |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2840 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
| 265 | 2841 && window_height (window) >= split_height_threshold |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
2842 && WINDOW_FULL_WIDTH_P (XWINDOW (window))) |
| 265 | 2843 window = Fsplit_window (window, Qnil, Qnil); |
| 2844 else | |
| 2845 { | |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2846 Lisp_Object upper, lower, other; |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2847 |
| 769 | 2848 window = Fget_lru_window (frames); |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2849 /* If the LRU window is selected, and big enough, |
|
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2850 and can be split, split it. */ |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2851 if (!NILP (window) |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2852 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2853 && (EQ (window, selected_window) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2854 || EQ (XWINDOW (window)->parent, Qnil)) |
| 265 | 2855 && window_height (window) >= window_min_height << 1) |
| 2856 window = Fsplit_window (window, Qnil, Qnil); | |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2857 /* If Fget_lru_window returned nil, try other approaches. */ |
|
17628
0b6db83d4663
(Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents:
17540
diff
changeset
|
2858 |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2859 /* Try visible frames first. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2860 if (NILP (window)) |
|
17628
0b6db83d4663
(Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents:
17540
diff
changeset
|
2861 window = Fget_buffer_window (buffer, Qvisible); |
|
0b6db83d4663
(Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents:
17540
diff
changeset
|
2862 if (NILP (window)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2863 window = Fget_largest_window (Qvisible); |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2864 /* If that didn't work, try iconified frames. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2865 if (NILP (window)) |
|
17628
0b6db83d4663
(Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents:
17540
diff
changeset
|
2866 window = Fget_buffer_window (buffer, make_number (0)); |
|
0b6db83d4663
(Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents:
17540
diff
changeset
|
2867 if (NILP (window)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2868 window = Fget_largest_window (make_number (0)); |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2869 /* Try invisible frames. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2870 if (NILP (window)) |
|
17628
0b6db83d4663
(Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents:
17540
diff
changeset
|
2871 window = Fget_buffer_window (buffer, Qt); |
|
0b6db83d4663
(Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents:
17540
diff
changeset
|
2872 if (NILP (window)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2873 window = Fget_largest_window (Qt); |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2874 /* As a last resort, make a new frame. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2875 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2876 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2877 /* If window appears above or below another, |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2878 even out their heights. */ |
|
11750
b911d6f75664
(Fdisplay_buffer): Initialize other, upper, lower.
Richard M. Stallman <rms@gnu.org>
parents:
11731
diff
changeset
|
2879 other = upper = lower = Qnil; |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2880 if (!NILP (XWINDOW (window)->prev)) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2881 other = upper = XWINDOW (window)->prev, lower = window; |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2882 if (!NILP (XWINDOW (window)->next)) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2883 other = lower = XWINDOW (window)->next, upper = window; |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2884 if (!NILP (other) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2885 /* Check that OTHER and WINDOW are vertically arrayed. */ |
|
17365
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
2886 && !EQ (XWINDOW (other)->top, XWINDOW (window)->top) |
|
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
2887 && (XFASTINT (XWINDOW (other)->height) |
|
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
2888 > XFASTINT (XWINDOW (window)->height))) |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2889 { |
|
17365
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
2890 int total = (XFASTINT (XWINDOW (other)->height) |
|
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
2891 + XFASTINT (XWINDOW (window)->height)); |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
2892 enlarge_window (upper, |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
2893 total / 2 - XFASTINT (XWINDOW (upper)->height), |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2894 0); |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2895 } |
| 265 | 2896 } |
| 2897 } | |
| 2898 else | |
| 2899 window = Fget_lru_window (Qnil); | |
| 2900 | |
| 2901 Fset_window_buffer (window, buffer); | |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2902 return display_buffer_1 (window); |
| 265 | 2903 } |
| 2904 | |
| 2905 void | |
| 2906 temp_output_buffer_show (buf) | |
| 2907 register Lisp_Object buf; | |
| 2908 { | |
| 2909 register struct buffer *old = current_buffer; | |
| 2910 register Lisp_Object window; | |
| 2911 register struct window *w; | |
| 2912 | |
|
18493
d65021d5c39e
(temp_output_buffer_show): Copy default-directory from current buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18065
diff
changeset
|
2913 XBUFFER (buf)->directory = current_buffer->directory; |
|
d65021d5c39e
(temp_output_buffer_show): Copy default-directory from current buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18065
diff
changeset
|
2914 |
| 265 | 2915 Fset_buffer (buf); |
|
10302
34556316a48a
(temp_output_buffer_show): Use BUF_SAVE_MODIFF.
Richard M. Stallman <rms@gnu.org>
parents:
10043
diff
changeset
|
2916 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; |
| 265 | 2917 BEGV = BEG; |
| 2918 ZV = Z; | |
| 2919 SET_PT (BEG); | |
| 25375 | 2920 XBUFFER (buf)->prevent_redisplay_optimizations_p = 1; |
| 265 | 2921 set_buffer_internal (old); |
| 2922 | |
| 2923 if (!EQ (Vtemp_buffer_show_function, Qnil)) | |
| 2924 call1 (Vtemp_buffer_show_function, buf); | |
| 2925 else | |
| 2926 { | |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2927 window = Fdisplay_buffer (buf, Qnil, Qnil); |
| 265 | 2928 |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2929 if (!EQ (XWINDOW (window)->frame, selected_frame)) |
| 769 | 2930 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
| 265 | 2931 Vminibuf_scroll_window = window; |
| 2932 w = XWINDOW (window); | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2933 XSETFASTINT (w->hscroll, 0); |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
2934 set_marker_restricted_both (w->start, buf, 1, 1); |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
2935 set_marker_restricted_both (w->pointm, buf, 1, 1); |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2936 |
|
22149
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2937 /* Run temp-buffer-show-hook, with the chosen window selected |
|
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2938 and it sbuffer current. */ |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2939 if (!NILP (Vrun_hooks)) |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2940 { |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2941 Lisp_Object tem; |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2942 tem = Fboundp (Qtemp_buffer_show_hook); |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2943 if (!NILP (tem)) |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2944 { |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2945 tem = Fsymbol_value (Qtemp_buffer_show_hook); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2946 if (!NILP (tem)) |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2947 { |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2948 int count = specpdl_ptr - specpdl; |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2949 Lisp_Object prev_window; |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2950 prev_window = selected_window; |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2951 |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2952 /* Select the window that was chosen, for running the hook. */ |
|
23728
0d1a0ded9aa1
(temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents:
23410
diff
changeset
|
2953 record_unwind_protect (Fselect_window, prev_window); |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2954 select_window_1 (window, 0); |
|
22149
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2955 Fset_buffer (w->buffer); |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2956 call1 (Vrun_hooks, Qtemp_buffer_show_hook); |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2957 select_window_1 (prev_window, 0); |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2958 unbind_to (count, Qnil); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2959 } |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2960 } |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2961 } |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2962 } |
| 265 | 2963 } |
| 2964 | |
| 21514 | 2965 static void |
| 265 | 2966 make_dummy_parent (window) |
| 2967 Lisp_Object window; | |
| 2968 { | |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2969 Lisp_Object new; |
| 265 | 2970 register struct window *o, *p; |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2971 register struct Lisp_Vector *vec; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2972 int i; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2973 |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2974 o = XWINDOW (window); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2975 vec = allocate_vectorlike ((EMACS_INT)VECSIZE (struct window)); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2976 for (i = 0; i < VECSIZE (struct window); ++i) |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2977 vec->contents[i] = ((struct Lisp_Vector *)o)->contents[i]; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2978 vec->size = VECSIZE (struct window); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2979 p = (struct window *)vec; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2980 XSETWINDOW (new, p); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2981 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2982 XSETFASTINT (p->sequence_number, ++sequence_number); |
| 265 | 2983 |
| 2984 /* Put new into window structure in place of window */ | |
| 2985 replace_window (window, new); | |
| 2986 | |
| 2987 o->next = Qnil; | |
| 2988 o->prev = Qnil; | |
| 2989 o->vchild = Qnil; | |
| 2990 o->hchild = Qnil; | |
| 2991 o->parent = new; | |
| 2992 | |
| 2993 p->start = Qnil; | |
| 2994 p->pointm = Qnil; | |
| 2995 p->buffer = Qnil; | |
| 2996 } | |
| 2997 | |
| 2998 DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", | |
| 2999 "Split WINDOW, putting SIZE lines in the first of the pair.\n\ | |
| 3000 WINDOW defaults to selected one and SIZE to half its size.\n\ | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3001 If optional third arg HORFLAG is non-nil, split side by side\n\ |
|
22923
970b3bad71fd
(Fsplit_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22897
diff
changeset
|
3002 and put SIZE columns in the first of the pair. In that case,\n\ |
|
970b3bad71fd
(Fsplit_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22897
diff
changeset
|
3003 SIZE includes that window's scroll bar, or the divider column to its right.") |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3004 (window, size, horflag) |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3005 Lisp_Object window, size, horflag; |
| 265 | 3006 { |
| 3007 register Lisp_Object new; | |
| 3008 register struct window *o, *p; | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3009 FRAME_PTR fo; |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3010 register int size_int; |
| 265 | 3011 |
| 485 | 3012 if (NILP (window)) |
| 265 | 3013 window = selected_window; |
| 3014 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3015 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 3016 |
| 3017 o = XWINDOW (window); | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3018 fo = XFRAME (WINDOW_FRAME (o)); |
| 265 | 3019 |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3020 if (NILP (size)) |
| 265 | 3021 { |
| 485 | 3022 if (!NILP (horflag)) |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3023 /* Calculate the size of the left-hand window, by dividing |
|
25044
e6c2ab650ebc
(Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents:
24997
diff
changeset
|
3024 the usable space in columns by two. |
|
e6c2ab650ebc
(Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents:
24997
diff
changeset
|
3025 We round up, since the left-hand window may include |
|
e6c2ab650ebc
(Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents:
24997
diff
changeset
|
3026 a dividing line, while the right-hand may not. */ |
|
e6c2ab650ebc
(Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents:
24997
diff
changeset
|
3027 size_int = (XFASTINT (o->width) + 1) >> 1; |
| 265 | 3028 else |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3029 size_int = XFASTINT (o->height) >> 1; |
| 265 | 3030 } |
| 3031 else | |
| 3032 { | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3033 CHECK_NUMBER (size, 1); |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3034 size_int = XINT (size); |
| 265 | 3035 } |
| 3036 | |
| 3037 if (MINI_WINDOW_P (o)) | |
| 3038 error ("Attempt to split minibuffer window"); | |
| 25268 | 3039 else if (window_fixed_size_p (o, !NILP (horflag), 0)) |
| 3040 error ("Attempt to split fixed-size window"); | |
| 265 | 3041 |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
3042 check_min_window_sizes (); |
| 265 | 3043 |
| 485 | 3044 if (NILP (horflag)) |
| 265 | 3045 { |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3046 if (size_int < window_min_height) |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3047 error ("Window height %d too small (after splitting)", size_int); |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3048 if (size_int + window_min_height > XFASTINT (o->height)) |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
3049 error ("Window height %d too small (after splitting)", |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3050 XFASTINT (o->height) - size_int); |
| 485 | 3051 if (NILP (o->parent) |
| 3052 || NILP (XWINDOW (o->parent)->vchild)) | |
| 265 | 3053 { |
| 3054 make_dummy_parent (window); | |
| 3055 new = o->parent; | |
| 3056 XWINDOW (new)->vchild = window; | |
| 3057 } | |
| 3058 } | |
| 3059 else | |
| 3060 { | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3061 if (size_int < window_min_width) |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3062 error ("Window width %d too small (after splitting)", size_int); |
|
15902
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
3063 |
|
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
3064 if (size_int + window_min_width > XFASTINT (o->width)) |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
3065 error ("Window width %d too small (after splitting)", |
|
15902
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
3066 XFASTINT (o->width) - size_int); |
| 485 | 3067 if (NILP (o->parent) |
| 3068 || NILP (XWINDOW (o->parent)->hchild)) | |
| 265 | 3069 { |
| 3070 make_dummy_parent (window); | |
| 3071 new = o->parent; | |
| 3072 XWINDOW (new)->hchild = window; | |
| 3073 } | |
| 3074 } | |
| 3075 | |
| 3076 /* Now we know that window's parent is a vertical combination | |
| 3077 if we are dividing vertically, or a horizontal combination | |
| 3078 if we are making side-by-side windows */ | |
| 3079 | |
| 3080 windows_or_buffers_changed++; | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3081 FRAME_WINDOW_SIZES_CHANGED (fo) = 1; |
| 265 | 3082 new = make_window (); |
| 3083 p = XWINDOW (new); | |
| 3084 | |
| 769 | 3085 p->frame = o->frame; |
| 265 | 3086 p->next = o->next; |
| 485 | 3087 if (!NILP (p->next)) |
| 265 | 3088 XWINDOW (p->next)->prev = new; |
| 3089 p->prev = window; | |
| 3090 o->next = new; | |
| 3091 p->parent = o->parent; | |
| 3092 p->buffer = Qt; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3093 p->window_end_valid = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3094 bzero (&p->last_cursor, sizeof p->last_cursor); |
| 265 | 3095 |
| 769 | 3096 /* Apportion the available frame space among the two new windows */ |
| 265 | 3097 |
| 485 | 3098 if (!NILP (horflag)) |
| 265 | 3099 { |
| 3100 p->height = o->height; | |
| 3101 p->top = o->top; | |
|
15902
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
3102 XSETFASTINT (p->width, XFASTINT (o->width) - size_int); |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3103 XSETFASTINT (o->width, size_int); |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3104 XSETFASTINT (p->left, XFASTINT (o->left) + size_int); |
| 265 | 3105 } |
| 3106 else | |
| 3107 { | |
| 3108 p->left = o->left; | |
| 3109 p->width = o->width; | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3110 XSETFASTINT (p->height, XFASTINT (o->height) - size_int); |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3111 XSETFASTINT (o->height, size_int); |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3112 XSETFASTINT (p->top, XFASTINT (o->top) + size_int); |
| 265 | 3113 } |
| 3114 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3115 /* Adjust glyph matrices. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3116 adjust_glyphs (fo); |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3117 Fset_window_buffer (new, o->buffer); |
| 265 | 3118 return new; |
| 3119 } | |
| 3120 | |
| 3121 DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p", | |
| 3122 "Make current window ARG lines bigger.\n\ | |
| 3123 From program, optional second arg non-nil means grow sideways ARG columns.") | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3124 (arg, side) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3125 register Lisp_Object arg, side; |
| 265 | 3126 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3127 CHECK_NUMBER (arg, 0); |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3128 enlarge_window (selected_window, XINT (arg), !NILP (side)); |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3129 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3130 if (! NILP (Vwindow_configuration_change_hook)) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3131 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3132 |
| 265 | 3133 return Qnil; |
| 3134 } | |
| 3135 | |
| 3136 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", | |
| 3137 "Make current window ARG lines smaller.\n\ | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3138 From program, optional second arg non-nil means shrink sideways arg columns.") |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3139 (arg, side) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3140 register Lisp_Object arg, side; |
| 265 | 3141 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3142 CHECK_NUMBER (arg, 0); |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3143 enlarge_window (selected_window, -XINT (arg), !NILP (side)); |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3144 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3145 if (! NILP (Vwindow_configuration_change_hook)) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3146 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3147 |
| 265 | 3148 return Qnil; |
| 3149 } | |
| 3150 | |
| 3151 int | |
| 3152 window_height (window) | |
| 3153 Lisp_Object window; | |
| 3154 { | |
| 3155 register struct window *p = XWINDOW (window); | |
| 3156 return XFASTINT (p->height); | |
| 3157 } | |
| 3158 | |
| 3159 int | |
| 3160 window_width (window) | |
| 3161 Lisp_Object window; | |
| 3162 { | |
| 3163 register struct window *p = XWINDOW (window); | |
| 3164 return XFASTINT (p->width); | |
| 3165 } | |
| 3166 | |
| 25254 | 3167 |
| 265 | 3168 #define CURBEG(w) \ |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3169 *(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top)) |
| 265 | 3170 |
| 3171 #define CURSIZE(w) \ | |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3172 *(widthflag ? &(XWINDOW (w)->width) : &(XWINDOW (w)->height)) |
| 265 | 3173 |
| 25268 | 3174 |
| 3175 /* Enlarge selected_window by DELTA. WIDTHFLAG non-zero means | |
| 3176 increase its width. Siblings of the selected window are resized to | |
| 3177 fullfil the size request. If they become too small in the process, | |
| 3178 they will be deleted. */ | |
| 265 | 3179 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3180 static void |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3181 enlarge_window (window, delta, widthflag) |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3182 Lisp_Object window; |
| 25268 | 3183 int delta, widthflag; |
| 265 | 3184 { |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3185 Lisp_Object parent, next, prev; |
| 25268 | 3186 struct window *p; |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3187 Lisp_Object *sizep; |
|
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3188 int maximum; |
| 20351 | 3189 int (*sizefun) P_ ((Lisp_Object)) |
| 3190 = widthflag ? window_width : window_height; | |
| 25268 | 3191 void (*setsizefun) P_ ((Lisp_Object, int, int)) |
| 20351 | 3192 = (widthflag ? set_window_width : set_window_height); |
| 25268 | 3193 |
| 3194 /* Check values of window_min_width and window_min_height for | |
| 3195 validity. */ | |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
3196 check_min_window_sizes (); |
| 265 | 3197 |
| 25268 | 3198 /* Give up if this window cannot be resized. */ |
| 3199 if (window_fixed_size_p (XWINDOW (window), widthflag, 1)) | |
| 3200 error ("Window is not resizable"); | |
| 3201 | |
| 3202 /* Find the parent of the selected window. */ | |
| 265 | 3203 while (1) |
| 3204 { | |
| 3205 p = XWINDOW (window); | |
| 3206 parent = p->parent; | |
| 25268 | 3207 |
| 485 | 3208 if (NILP (parent)) |
| 265 | 3209 { |
| 3210 if (widthflag) | |
| 3211 error ("No other window to side of this one"); | |
| 3212 break; | |
| 3213 } | |
| 25268 | 3214 |
| 3215 if (widthflag | |
| 3216 ? !NILP (XWINDOW (parent)->hchild) | |
| 485 | 3217 : !NILP (XWINDOW (parent)->vchild)) |
| 265 | 3218 break; |
| 25268 | 3219 |
| 265 | 3220 window = parent; |
| 3221 } | |
| 3222 | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3223 sizep = &CURSIZE (window); |
|
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3224 |
| 265 | 3225 { |
| 3226 register int maxdelta; | |
| 3227 | |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3228 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep) |
| 25254 | 3229 : !NILP (p->next) ? ((*sizefun) (p->next) |
| 3230 - window_min_size (XWINDOW (p->next), | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3231 widthflag, 0, 0)) |
| 25254 | 3232 : !NILP (p->prev) ? ((*sizefun) (p->prev) |
| 3233 - window_min_size (XWINDOW (p->prev), | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3234 widthflag, 0, 0)) |
| 769 | 3235 /* This is a frame with only one window, a minibuffer-only |
| 3236 or a minibufferless frame. */ | |
| 432 | 3237 : (delta = 0)); |
| 265 | 3238 |
| 3239 if (delta > maxdelta) | |
| 3240 /* This case traps trying to make the minibuffer | |
| 769 | 3241 the full frame, or make the only window aside from the |
| 3242 minibuffer the full frame. */ | |
| 265 | 3243 delta = maxdelta; |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3244 } |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3245 |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3246 if (XINT (*sizep) + delta < window_min_size (XWINDOW (window), widthflag, 0, 0)) |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3247 { |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3248 delete_window (window); |
| 432 | 3249 return; |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3250 } |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3251 |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3252 if (delta == 0) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3253 return; |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3254 |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3255 /* Find the total we can get from other siblings. */ |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3256 maximum = 0; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3257 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) |
| 25254 | 3258 maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3259 widthflag, 0, 0); |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3260 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) |
| 25254 | 3261 maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3262 widthflag, 0, 0); |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3263 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3264 /* If we can get it all from them, do so. */ |
|
18900
23ee59ec294b
(set_window_height): Allow all heights > 0 for minibuffer windows.
Richard M. Stallman <rms@gnu.org>
parents:
18737
diff
changeset
|
3265 if (delta <= maximum) |
| 265 | 3266 { |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3267 Lisp_Object first_unaffected; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3268 Lisp_Object first_affected; |
| 25268 | 3269 int fixed_p; |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3270 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3271 next = p->next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3272 prev = p->prev; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3273 first_affected = window; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3274 /* Look at one sibling at a time, |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3275 moving away from this window in both directions alternately, |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3276 and take as much as we can get without deleting that sibling. */ |
| 25268 | 3277 while (delta != 0 && (!NILP (next) || !NILP (prev))) |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3278 { |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3279 if (! NILP (next)) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3280 { |
| 25254 | 3281 int this_one = ((*sizefun) (next) |
| 25268 | 3282 - window_min_size (XWINDOW (next), |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3283 widthflag, 0, &fixed_p)); |
| 25268 | 3284 if (!fixed_p) |
| 3285 { | |
| 3286 if (this_one > delta) | |
| 3287 this_one = delta; | |
| 3288 | |
| 3289 (*setsizefun) (next, (*sizefun) (next) - this_one, 0); | |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3290 (*setsizefun) (window, XINT (*sizep) + this_one, 0); |
| 25268 | 3291 |
| 3292 delta -= this_one; | |
| 3293 } | |
| 3294 | |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3295 next = XWINDOW (next)->next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3296 } |
| 25268 | 3297 |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3298 if (delta == 0) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3299 break; |
| 25268 | 3300 |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3301 if (! NILP (prev)) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3302 { |
| 25254 | 3303 int this_one = ((*sizefun) (prev) |
| 25268 | 3304 - window_min_size (XWINDOW (prev), |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3305 widthflag, 0, &fixed_p)); |
| 25268 | 3306 if (!fixed_p) |
| 3307 { | |
| 3308 if (this_one > delta) | |
| 3309 this_one = delta; | |
| 3310 | |
| 3311 first_affected = prev; | |
| 3312 | |
| 3313 (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0); | |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3314 (*setsizefun) (window, XINT (*sizep) + this_one, 0); |
| 25268 | 3315 |
| 3316 delta -= this_one; | |
| 3317 } | |
| 3318 | |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3319 prev = XWINDOW (prev)->prev; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3320 } |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3321 } |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3322 |
| 25268 | 3323 xassert (delta == 0); |
| 3324 | |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3325 /* Now recalculate the edge positions of all the windows affected, |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3326 based on the new sizes. */ |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3327 first_unaffected = next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3328 prev = first_affected; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3329 for (next = XWINDOW (prev)->next; ! EQ (next, first_unaffected); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3330 prev = next, next = XWINDOW (next)->next) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3331 { |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3332 XSETINT (CURBEG (next), XINT (CURBEG (prev)) + (*sizefun) (prev)); |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3333 /* This does not change size of NEXT, |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3334 but it propagates the new top edge to its children */ |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3335 (*setsizefun) (next, (*sizefun) (next), 0); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3336 } |
| 265 | 3337 } |
| 3338 else | |
| 3339 { | |
| 3340 register int delta1; | |
| 3341 register int opht = (*sizefun) (parent); | |
| 3342 | |
| 3343 /* If trying to grow this window to or beyond size of the parent, | |
| 3344 make delta1 so big that, on shrinking back down, | |
| 3345 all the siblings end up with less than one line and are deleted. */ | |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3346 if (opht <= XINT (*sizep) + delta) |
| 265 | 3347 delta1 = opht * opht * 2; |
| 3348 else | |
| 25268 | 3349 { |
| 3350 /* Otherwise, make delta1 just right so that if we add | |
| 3351 delta1 lines to this window and to the parent, and then | |
| 3352 shrink the parent back to its original size, the new | |
| 3353 proportional size of this window will increase by delta. | |
| 3354 | |
| 3355 The function size_window will compute the new height h' | |
| 3356 of the window from delta1 as: | |
| 3357 | |
| 3358 e = delta1/n | |
| 3359 x = delta1 - delta1/n * n for the 1st resizable child | |
| 3360 h' = h + e + x | |
| 3361 | |
| 3362 where n is the number of children that can be resized. | |
| 3363 We can ignore x by choosing a delta1 that is a multiple of | |
| 3364 n. We want the height of this window to come out as | |
| 3365 | |
| 3366 h' = h + delta | |
| 3367 | |
| 3368 So, delta1 must be | |
| 3369 | |
| 3370 h + e = h + delta | |
| 3371 delta1/n = delta | |
| 3372 delta1 = n * delta. | |
| 3373 | |
| 3374 The number of children n rquals the number of resizable | |
| 3375 children of this window + 1 because we know window itself | |
| 3376 is resizable (otherwise we would have signalled an error. */ | |
| 3377 | |
| 3378 struct window *w = XWINDOW (window); | |
| 3379 Lisp_Object s; | |
| 3380 int n = 1; | |
| 3381 | |
| 3382 for (s = w->next; !NILP (s); s = XWINDOW (s)->next) | |
| 3383 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) | |
| 3384 ++n; | |
| 3385 for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev) | |
| 3386 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) | |
| 3387 ++n; | |
| 3388 | |
| 3389 delta1 = n * delta; | |
| 3390 } | |
| 265 | 3391 |
| 3392 /* Add delta1 lines or columns to this window, and to the parent, | |
| 3393 keeping things consistent while not affecting siblings. */ | |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3394 XSETINT (CURSIZE (parent), opht + delta1); |
|
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3395 (*setsizefun) (window, XINT (*sizep) + delta1, 0); |
| 265 | 3396 |
| 3397 /* Squeeze out delta1 lines or columns from our parent, | |
| 3398 shriking this window and siblings proportionately. | |
| 3399 This brings parent back to correct size. | |
| 3400 Delta1 was calculated so this makes this window the desired size, | |
| 3401 taking it all out of the siblings. */ | |
| 3402 (*setsizefun) (parent, opht, 0); | |
| 3403 } | |
| 3404 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3405 XSETFASTINT (p->last_modified, 0); |
|
16208
e3a834653117
(Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
16068
diff
changeset
|
3406 XSETFASTINT (p->last_overlay_modified, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3407 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3408 /* Adjust glyph matrices. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3409 adjust_glyphs (XFRAME (WINDOW_FRAME (XWINDOW (window)))); |
| 265 | 3410 } |
| 25254 | 3411 |
| 265 | 3412 #undef CURBEG |
| 3413 #undef CURSIZE | |
| 3414 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3415 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3416 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3417 /*********************************************************************** |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3418 Resizing Mini-Windows |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3419 ***********************************************************************/ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3420 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3421 static void shrink_window_lowest_first P_ ((struct window *, int)); |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3422 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3423 enum save_restore_action |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3424 { |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3425 CHECK_ORIG_SIZES, |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3426 SAVE_ORIG_SIZES, |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3427 RESTORE_ORIG_SIZES |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3428 }; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3429 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3430 static int save_restore_orig_size P_ ((struct window *, |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3431 enum save_restore_action)); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3432 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3433 /* Shrink windows rooted in window W to HEIGHT. Take the space needed |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3434 from lowest windows first. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3435 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3436 static void |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3437 shrink_window_lowest_first (w, height) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3438 struct window *w; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3439 int height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3440 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3441 struct window *c; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3442 Lisp_Object child; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3443 int old_height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3444 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3445 xassert (!MINI_WINDOW_P (w)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3446 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3447 /* Set redisplay hints. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3448 XSETFASTINT (w->last_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3449 XSETFASTINT (w->last_overlay_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3450 windows_or_buffers_changed++; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3451 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3452 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3453 old_height = XFASTINT (w->height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3454 XSETFASTINT (w->height, height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3455 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3456 if (!NILP (w->hchild)) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3457 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3458 for (child = w->hchild; !NILP (child); child = c->next) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3459 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3460 c = XWINDOW (child); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3461 c->top = w->top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3462 shrink_window_lowest_first (c, height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3463 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3464 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3465 else if (!NILP (w->vchild)) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3466 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3467 Lisp_Object last_child; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3468 int delta = old_height - height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3469 int last_top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3470 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3471 /* Find the last child. We are taking space from lowest windows |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3472 first, so we iterate over children from the last child |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3473 backwards. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3474 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3475 last_child = child; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3476 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3477 /* Assign new heights. We leave only MIN_SAFE_WINDOW_HEIGHT. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3478 for (child = last_child; delta && !NILP (child); child = c->prev) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3479 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3480 int this_one; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3481 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3482 c = XWINDOW (child); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3483 this_one = XFASTINT (c->height) - MIN_SAFE_WINDOW_HEIGHT; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3484 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3485 if (this_one > delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3486 this_one = delta; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3487 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3488 shrink_window_lowest_first (c, XFASTINT (c->height) - this_one); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3489 delta -= this_one; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3490 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3491 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3492 /* Compute new positions. */ |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3493 last_top = XINT (w->top); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3494 for (child = w->vchild; !NILP (child); child = c->next) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3495 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3496 c = XWINDOW (child); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3497 c->top = make_number (last_top); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3498 shrink_window_lowest_first (c, XFASTINT (c->height)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3499 last_top += XFASTINT (c->height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3500 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3501 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3502 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3503 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3504 |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3505 /* Save, restore, or check positions and sizes in the window tree |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3506 rooted at W. ACTION says what to do. |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3507 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3508 If ACTION is CHECK_ORIG_SIZES, check if orig_top and orig_height |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3509 members are valid for all windows in the window tree. Value is |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3510 non-zero if they are valid. |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3511 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3512 If ACTION is SAVE_ORIG_SIZES, save members top and height in |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3513 orig_top and orig_height for all windows in the tree. |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3514 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3515 If ACTION is RESTORE_ORIG_SIZES, restore top and height from |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3516 values stored in orig_top and orig_height for all windows. */ |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3517 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3518 static int |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3519 save_restore_orig_size (w, action) |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3520 struct window *w; |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3521 enum save_restore_action action; |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3522 { |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3523 int success_p = 1; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3524 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3525 while (w) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3526 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3527 if (!NILP (w->hchild)) |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3528 { |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3529 if (!save_restore_orig_size (XWINDOW (w->hchild), action)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3530 success_p = 0; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3531 } |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3532 else if (!NILP (w->vchild)) |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3533 { |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3534 if (!save_restore_orig_size (XWINDOW (w->vchild), action)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3535 success_p = 0; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3536 } |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3537 |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3538 switch (action) |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3539 { |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3540 case CHECK_ORIG_SIZES: |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3541 if (!INTEGERP (w->orig_top) || !INTEGERP (w->orig_height)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3542 return 0; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3543 break; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3544 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3545 case SAVE_ORIG_SIZES: |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3546 w->orig_top = w->top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3547 w->orig_height = w->height; |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3548 XSETFASTINT (w->last_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3549 XSETFASTINT (w->last_overlay_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3550 break; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3551 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3552 case RESTORE_ORIG_SIZES: |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3553 xassert (INTEGERP (w->orig_top) && INTEGERP (w->orig_height)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3554 w->top = w->orig_top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3555 w->height = w->orig_height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3556 w->orig_height = w->orig_top = Qnil; |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3557 XSETFASTINT (w->last_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3558 XSETFASTINT (w->last_overlay_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3559 break; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3560 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3561 default: |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3562 abort (); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3563 } |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3564 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3565 w = NILP (w->next) ? NULL : XWINDOW (w->next); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3566 } |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3567 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3568 return success_p; |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3569 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3570 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3571 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3572 /* Grow mini-window W by DELTA lines, DELTA >= 0, or as much as we can |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3573 without deleting other windows. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3574 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3575 void |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3576 grow_mini_window (w, delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3577 struct window *w; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3578 int delta; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3579 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3580 struct frame *f = XFRAME (w->frame); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3581 struct window *root; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3582 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3583 xassert (MINI_WINDOW_P (w)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3584 xassert (delta >= 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3585 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3586 /* Check values of window_min_width and window_min_height for |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3587 validity. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3588 check_min_window_sizes (); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3589 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3590 /* Compute how much we can enlarge the mini-window without deleting |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3591 other windows. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3592 root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3593 if (delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3594 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3595 int min_height = window_min_size (root, 0, 0, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3596 if (XFASTINT (root->height) - delta < min_height) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3597 delta = XFASTINT (root->height) - min_height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3598 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3599 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3600 if (delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3601 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3602 /* Save original window sizes and positions, if not already done. */ |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3603 if (!save_restore_orig_size (root, CHECK_ORIG_SIZES)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3604 save_restore_orig_size (root, SAVE_ORIG_SIZES); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3605 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3606 /* Shrink other windows. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3607 shrink_window_lowest_first (root, XFASTINT (root->height) - delta); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3608 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3609 /* Grow the mini-window. */ |
|
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3610 w->top = make_number (XFASTINT (root->top) + XFASTINT (root->height)); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3611 w->height = make_number (XFASTINT (w->height) + delta); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3612 XSETFASTINT (w->last_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3613 XSETFASTINT (w->last_overlay_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3614 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3615 adjust_glyphs (f); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3616 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3617 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3618 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3619 |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3620 /* Shrink mini-window W. If there is recorded info about window sizes |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3621 before a call to grow_mini_window, restore recorded window sizes. |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3622 Otherwise, if the mini-window is higher than 1 line, resize it to 1 |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3623 line. */ |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3624 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3625 void |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3626 shrink_mini_window (w) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3627 struct window *w; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3628 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3629 struct frame *f = XFRAME (w->frame); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3630 struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3631 |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3632 if (save_restore_orig_size (root, CHECK_ORIG_SIZES)) |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3633 { |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3634 save_restore_orig_size (root, RESTORE_ORIG_SIZES); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3635 adjust_glyphs (f); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3636 FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3637 windows_or_buffers_changed = 1; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3638 } |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3639 else if (XFASTINT (w->height) > 1) |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3640 { |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3641 Lisp_Object window; |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3642 XSETWINDOW (window, w); |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3643 enlarge_window (window, 1 - XFASTINT (w->height), 0); |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3644 } |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3645 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3646 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3647 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3648 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3649 /* Mark window cursors off for all windows in the window tree rooted |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3650 at W by setting their phys_cursor_on_p flag to zero. Called from |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3651 xterm.c, e.g. when a frame is cleared and thereby all cursors on |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3652 the frame are cleared. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3653 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3654 void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3655 mark_window_cursors_off (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3656 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3657 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3658 while (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3659 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3660 if (!NILP (w->hchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3661 mark_window_cursors_off (XWINDOW (w->hchild)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3662 else if (!NILP (w->vchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3663 mark_window_cursors_off (XWINDOW (w->vchild)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3664 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3665 w->phys_cursor_on_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3666 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3667 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3668 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3669 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3670 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3671 |
| 265 | 3672 /* Return number of lines of text (not counting mode line) in W. */ |
| 3673 | |
| 3674 int | |
| 3675 window_internal_height (w) | |
| 3676 struct window *w; | |
| 3677 { | |
| 3678 int ht = XFASTINT (w->height); | |
| 3679 | |
| 3680 if (MINI_WINDOW_P (w)) | |
| 3681 return ht; | |
| 3682 | |
| 485 | 3683 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild) |
| 3684 || !NILP (w->next) || !NILP (w->prev) | |
| 769 | 3685 || FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (w)))) |
| 265 | 3686 return ht - 1; |
| 3687 | |
| 3688 return ht; | |
| 3689 } | |
| 3690 | |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3691 |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3692 /* Return the number of columns in W. |
|
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1931
diff
changeset
|
3693 Don't count columns occupied by scroll bars or the vertical bar |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3694 separating W from the sibling to its right. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3695 |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3696 int |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3697 window_internal_width (w) |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3698 struct window *w; |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3699 { |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3700 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3701 int width = XINT (w->width); |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3702 |
|
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1931
diff
changeset
|
3703 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3704 /* Scroll bars occupy a few columns. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3705 width -= FRAME_SCROLL_BAR_COLS (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3706 else if (!WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3707 /* The column of `|' characters separating side-by-side windows |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3708 occupies one column only. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3709 width -= 1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3710 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3711 /* On window-systems, areas to the left and right of the window |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3712 are used to display bitmaps there. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3713 if (FRAME_WINDOW_P (f)) |
|
25462
19b101d6ee2a
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
25402
diff
changeset
|
3714 width -= FRAME_FLAGS_AREA_COLS (f); |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
3715 |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
3716 return width; |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3717 } |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3718 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3719 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3720 /************************************************************************ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3721 Window Scrolling |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3722 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3723 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3724 /* Scroll contents of window WINDOW up. If WHOLE is non-zero, scroll |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3725 one screen-full, which is defined as the height of the window minus |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3726 next_screen_context_lines. If WHOLE is zero, scroll up N lines |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3727 instead. Negative values of N mean scroll down. NOERROR non-zero |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3728 means don't signal an error if we try to move over BEGV or ZV, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3729 respectively. */ |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3730 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3731 static void |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3732 window_scroll (window, n, whole, noerror) |
| 265 | 3733 Lisp_Object window; |
| 3734 int n; | |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3735 int whole; |
| 522 | 3736 int noerror; |
| 265 | 3737 { |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3738 /* If we must, use the pixel-based version which is much slower than |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3739 the line-based one but can handle varying line heights. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3740 if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3741 window_scroll_pixel_based (window, n, whole, noerror); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3742 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3743 window_scroll_line_based (window, n, whole, noerror); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3744 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3745 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3746 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3747 /* Implementation of window_scroll that works based on pixel line |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3748 heights. See the comment of window_scroll for parameter |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3749 descriptions. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3750 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3751 static void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3752 window_scroll_pixel_based (window, n, whole, noerror) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3753 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3754 int n; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3755 int whole; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3756 int noerror; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3757 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3758 struct it it; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3759 struct window *w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3760 struct text_pos start; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3761 Lisp_Object tem; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3762 int this_scroll_margin; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3763 int preserve_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3764 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3765 SET_TEXT_POS_FROM_MARKER (start, w->start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3766 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3767 /* If PT is not visible in WINDOW, move back one half of |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3768 the screen. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3769 XSETFASTINT (tem, PT); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3770 tem = Fpos_visible_in_window_p (tem, window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3771 if (NILP (tem)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3772 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3773 /* Move backward half the height of the window. Performance note: |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3774 vmotion used here is about 10% faster, but would give wrong |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3775 results for variable height lines. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3776 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3777 it.current_y = it.last_visible_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3778 move_it_vertically (&it, -it.last_visible_y / 2); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3779 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3780 /* The function move_iterator_vertically may move over more than |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3781 the specified y-distance. If it->w is small, e.g. a |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3782 mini-buffer window, we may end up in front of the window's |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3783 display area. This is the case when Start displaying at the |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3784 start of the line containing PT in this case. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3785 if (it.current_y <= 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3786 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3787 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3788 move_it_vertically (&it, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3789 it.current_y = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3790 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3791 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3792 start = it.current.pos; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3793 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3794 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3795 /* If scroll_preserve_screen_position is non-zero, we try to set |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3796 point in the same window line as it is now, so get that line. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3797 if (!NILP (Vscroll_preserve_screen_position)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3798 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3799 start_display (&it, w, start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3800 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3801 preserve_y = it.current_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3802 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3803 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3804 preserve_y = -1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3805 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3806 /* Move iterator it from start the specified distance forward or |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3807 backward. The result is the new window start. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3808 start_display (&it, w, start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3809 if (whole) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3810 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3811 int screen_full = (it.last_visible_y |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3812 - next_screen_context_lines * CANON_Y_UNIT (it.f)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3813 int direction = n < 0 ? -1 : 1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3814 move_it_vertically (&it, direction * screen_full); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3815 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3816 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3817 move_it_by_lines (&it, n, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3818 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3819 /* End if we end up at ZV or BEGV. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3820 if ((n > 0 && IT_CHARPOS (it) == ZV) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3821 || (n < 0 && IT_CHARPOS (it) == CHARPOS (start))) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3822 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3823 if (noerror) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3824 return; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3825 else if (IT_CHARPOS (it) == ZV) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3826 Fsignal (Qend_of_buffer, Qnil); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3827 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3828 Fsignal (Qbeginning_of_buffer, Qnil); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3829 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3830 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3831 /* Set the window start, and set up the window for redisplay. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3832 set_marker_restricted (w->start, make_number (IT_CHARPOS (it)), w->buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3833 w->start_at_line_beg = Fbolp (); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3834 w->update_mode_line = Qt; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3835 XSETFASTINT (w->last_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3836 XSETFASTINT (w->last_overlay_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3837 /* Set force_start so that redisplay_window will run the |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3838 window-scroll-functions. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3839 w->force_start = Qt; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3840 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3841 it.current_y = it.vpos = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3842 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3843 /* Preserve the screen position if we must. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3844 if (preserve_y >= 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3845 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3846 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3847 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3848 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3849 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3850 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3851 /* Move PT out of scroll margins. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3852 this_scroll_margin = max (0, scroll_margin); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3853 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->height) / 4); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3854 this_scroll_margin *= CANON_Y_UNIT (it.f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3855 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3856 if (n > 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3857 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3858 /* We moved the window start towards ZV, so PT may be now |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3859 in the scroll margin at the top. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3860 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3861 while (it.current_y < this_scroll_margin) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3862 move_it_by_lines (&it, 1, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3863 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3864 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3865 else if (n < 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3866 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3867 /* We moved the window start towards BEGV, so PT may be now |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3868 in the scroll margin at the bottom. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3869 move_it_to (&it, PT, -1, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3870 it.last_visible_y - this_scroll_margin - 1, -1, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3871 MOVE_TO_POS | MOVE_TO_Y); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3872 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3873 /* Don't put point on a partially visible line at the end. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3874 if (it.current_y + it.max_ascent + it.max_descent |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3875 > it.last_visible_y) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3876 move_it_by_lines (&it, -1, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3877 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3878 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3879 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3880 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3881 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3882 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3883 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3884 /* Implementation of window_scroll that works based on screen lines. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3885 See the comment of window_scroll for parameter descriptions. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3886 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3887 static void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3888 window_scroll_line_based (window, n, whole, noerror) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3889 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3890 int n; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3891 int whole; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3892 int noerror; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3893 { |
| 265 | 3894 register struct window *w = XWINDOW (window); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3895 register int opoint = PT, opoint_byte = PT_BYTE; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3896 register int pos, pos_byte; |
| 265 | 3897 register int ht = window_internal_height (w); |
| 3898 register Lisp_Object tem; | |
| 3899 int lose; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3900 Lisp_Object bolp; |
|
16658
584563254f25
(window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents:
16587
diff
changeset
|
3901 int startpos; |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3902 struct position posit; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3903 int original_vpos; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3904 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3905 startpos = marker_position (w->start); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3906 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3907 posit = *compute_motion (startpos, 0, 0, 0, |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3908 PT, ht, 0, |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3909 window_internal_width (w), XINT (w->hscroll), |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3910 0, w); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3911 original_vpos = posit.vpos; |
|
13102
960db92441d8
(window_scroll): Always set force_start.
Richard M. Stallman <rms@gnu.org>
parents:
12981
diff
changeset
|
3912 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3913 XSETFASTINT (tem, PT); |
| 265 | 3914 tem = Fpos_visible_in_window_p (tem, window); |
| 3915 | |
| 485 | 3916 if (NILP (tem)) |
| 265 | 3917 { |
|
6341
dfc758dd2b08
(window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents:
6326
diff
changeset
|
3918 Fvertical_motion (make_number (- (ht / 2)), window); |
|
16658
584563254f25
(window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents:
16587
diff
changeset
|
3919 startpos = PT; |
| 265 | 3920 } |
|
16658
584563254f25
(window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents:
16587
diff
changeset
|
3921 |
|
584563254f25
(window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents:
16587
diff
changeset
|
3922 SET_PT (startpos); |
| 7347 | 3923 lose = n < 0 && PT == BEGV; |
|
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
3924 Fvertical_motion (make_number (n), window); |
| 7347 | 3925 pos = PT; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3926 pos_byte = PT_BYTE; |
| 265 | 3927 bolp = Fbolp (); |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3928 SET_PT_BOTH (opoint, opoint_byte); |
| 265 | 3929 |
| 3930 if (lose) | |
| 522 | 3931 { |
| 3932 if (noerror) | |
| 3933 return; | |
| 3934 else | |
| 3935 Fsignal (Qbeginning_of_buffer, Qnil); | |
| 3936 } | |
| 265 | 3937 |
| 3938 if (pos < ZV) | |
| 3939 { | |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3940 int this_scroll_margin = scroll_margin; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3941 |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3942 /* Don't use a scroll margin that is negative or too large. */ |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3943 if (this_scroll_margin < 0) |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3944 this_scroll_margin = 0; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3945 |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3946 if (XINT (w->height) < 4 * scroll_margin) |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3947 this_scroll_margin = XINT (w->height) / 4; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3948 |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3949 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); |
| 265 | 3950 w->start_at_line_beg = bolp; |
| 3951 w->update_mode_line = Qt; | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3952 XSETFASTINT (w->last_modified, 0); |
|
16208
e3a834653117
(Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
16068
diff
changeset
|
3953 XSETFASTINT (w->last_overlay_modified, 0); |
|
16658
584563254f25
(window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents:
16587
diff
changeset
|
3954 /* Set force_start so that redisplay_window will run |
|
584563254f25
(window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents:
16587
diff
changeset
|
3955 the window-scroll-functions. */ |
|
584563254f25
(window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents:
16587
diff
changeset
|
3956 w->force_start = Qt; |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3957 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3958 if (whole && !NILP (Vscroll_preserve_screen_position)) |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3959 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3960 SET_PT_BOTH (pos, pos_byte); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3961 Fvertical_motion (make_number (original_vpos), window); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3962 } |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3963 /* If we scrolled forward, put point enough lines down |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3964 that it is outside the scroll margin. */ |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3965 else if (n > 0) |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3966 { |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3967 int top_margin; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3968 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3969 if (this_scroll_margin > 0) |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3970 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3971 SET_PT_BOTH (pos, pos_byte); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3972 Fvertical_motion (make_number (this_scroll_margin), window); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3973 top_margin = PT; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3974 } |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3975 else |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3976 top_margin = pos; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3977 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3978 if (top_margin <= opoint) |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3979 SET_PT_BOTH (opoint, opoint_byte); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3980 else if (!NILP (Vscroll_preserve_screen_position)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3981 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3982 SET_PT_BOTH (pos, pos_byte); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3983 Fvertical_motion (make_number (original_vpos), window); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3984 } |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3985 else |
|
20046
8baac8399a29
(window_scroll): When scrolling forward and point is
Karl Heuer <kwzh@gnu.org>
parents:
19667
diff
changeset
|
3986 SET_PT (top_margin); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3987 } |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3988 else if (n < 0) |
| 265 | 3989 { |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3990 int bottom_margin; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3991 |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3992 /* If we scrolled backward, put point near the end of the window |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3993 but not within the scroll margin. */ |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3994 SET_PT_BOTH (pos, pos_byte); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3995 tem = Fvertical_motion (make_number (ht - this_scroll_margin), window); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3996 if (XFASTINT (tem) == ht - this_scroll_margin) |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3997 bottom_margin = PT; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3998 else |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3999 bottom_margin = PT + 1; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4000 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4001 if (bottom_margin > opoint) |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4002 SET_PT_BOTH (opoint, opoint_byte); |
| 265 | 4003 else |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4004 { |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4005 if (!NILP (Vscroll_preserve_screen_position)) |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4006 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4007 SET_PT_BOTH (pos, pos_byte); |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4008 Fvertical_motion (make_number (original_vpos), window); |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4009 } |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4010 else |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4011 Fvertical_motion (make_number (-1), window); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4012 } |
| 265 | 4013 } |
| 4014 } | |
| 4015 else | |
| 522 | 4016 { |
| 4017 if (noerror) | |
| 4018 return; | |
| 4019 else | |
| 4020 Fsignal (Qend_of_buffer, Qnil); | |
| 4021 } | |
| 265 | 4022 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4023 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4024 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4025 /* Scroll selected_window up or down. If N is nil, scroll a |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4026 screen-full which is defined as the height of the window minus |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4027 next_screen_context_lines. If N is the symbol `-', scroll. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4028 DIRECTION may be 1 meaning to scroll down, or -1 meaning to scroll |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4029 up. This is the guts of Fscroll_up and Fscroll_down. */ |
| 265 | 4030 |
| 4031 static void | |
| 4032 scroll_command (n, direction) | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4033 Lisp_Object n; |
| 265 | 4034 int direction; |
| 4035 { | |
| 4036 register int defalt; | |
| 4037 int count = specpdl_ptr - specpdl; | |
| 4038 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4039 xassert (abs (direction) == 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4040 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4041 /* If selected window's buffer isn't current, make it current for |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4042 the moment. But don't screw up if window_scroll gets an error. */ |
| 265 | 4043 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
| 548 | 4044 { |
| 4045 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
| 4046 Fset_buffer (XWINDOW (selected_window)->buffer); | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4047 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4048 /* Make redisplay consider other windows than just selected_window. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4049 ++windows_or_buffers_changed; |
| 548 | 4050 } |
| 265 | 4051 |
| 4052 defalt = (window_internal_height (XWINDOW (selected_window)) | |
| 4053 - next_screen_context_lines); | |
| 4054 defalt = direction * (defalt < 1 ? 1 : defalt); | |
| 4055 | |
| 485 | 4056 if (NILP (n)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4057 window_scroll (selected_window, defalt, 1, 0); |
| 265 | 4058 else if (EQ (n, Qminus)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4059 window_scroll (selected_window, - defalt, 1, 0); |
| 265 | 4060 else |
| 4061 { | |
| 4062 n = Fprefix_numeric_value (n); | |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4063 window_scroll (selected_window, XINT (n) * direction, 0, 0); |
| 265 | 4064 } |
| 548 | 4065 |
| 4066 unbind_to (count, Qnil); | |
| 265 | 4067 } |
| 4068 | |
| 4069 DEFUN ("scroll-up", Fscroll_up, Sscroll_up, 0, 1, "P", | |
| 4070 "Scroll text of current window upward ARG lines; or near full screen if no ARG.\n\ | |
| 4071 A near full screen is `next-screen-context-lines' less than a full screen.\n\ | |
|
6487
e1b0356ae3c9
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6341
diff
changeset
|
4072 Negative ARG means scroll downward.\n\ |
|
22288
d8f011778094
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
22223
diff
changeset
|
4073 If ARG is the atom `-', scroll downward by nearly full screen.\n\ |
|
d8f011778094
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
22223
diff
changeset
|
4074 When calling from a program, supply as argument a number, nil, or `-'.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4075 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4076 Lisp_Object arg; |
| 265 | 4077 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4078 scroll_command (arg, 1); |
| 265 | 4079 return Qnil; |
| 4080 } | |
| 4081 | |
| 4082 DEFUN ("scroll-down", Fscroll_down, Sscroll_down, 0, 1, "P", | |
|
22155
884e912db9de
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
22149
diff
changeset
|
4083 "Scroll text of current window down ARG lines; or near full screen if no ARG.\n\ |
| 265 | 4084 A near full screen is `next-screen-context-lines' less than a full screen.\n\ |
|
6487
e1b0356ae3c9
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6341
diff
changeset
|
4085 Negative ARG means scroll upward.\n\ |
|
22288
d8f011778094
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
22223
diff
changeset
|
4086 If ARG is the atom `-', scroll upward by nearly full screen.\n\ |
|
d8f011778094
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
22223
diff
changeset
|
4087 When calling from a program, supply as argument a number, nil, or `-'.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4088 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4089 Lisp_Object arg; |
| 265 | 4090 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4091 scroll_command (arg, -1); |
| 265 | 4092 return Qnil; |
| 4093 } | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4094 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4095 DEFUN ("other-window-for-scrolling", Fother_window_for_scrolling, Sother_window_for_scrolling, 0, 0, 0, |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4096 "Return the other window for \"other window scroll\" commands.\n\ |
|
6232
d695df82e96a
(Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6099
diff
changeset
|
4097 If in the minibuffer, `minibuffer-scroll-window' if non-nil\n\ |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4098 specifies the window.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4099 If `other-window-scroll-buffer' is non-nil, a window\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4100 showing that buffer is used.") |
|
8059
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
4101 () |
| 265 | 4102 { |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4103 Lisp_Object window; |
| 265 | 4104 |
| 4105 if (MINI_WINDOW_P (XWINDOW (selected_window)) | |
| 485 | 4106 && !NILP (Vminibuf_scroll_window)) |
| 265 | 4107 window = Vminibuf_scroll_window; |
| 4108 /* If buffer is specified, scroll that buffer. */ | |
| 485 | 4109 else if (!NILP (Vother_window_scroll_buffer)) |
| 265 | 4110 { |
| 4111 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); | |
| 485 | 4112 if (NILP (window)) |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
4113 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt, Qnil); |
| 265 | 4114 } |
| 4115 else | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4116 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4117 /* Nothing specified; look for a neighboring window on the same |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4118 frame. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4119 window = Fnext_window (selected_window, Qnil, Qnil); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4120 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4121 if (EQ (window, selected_window)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4122 /* That didn't get us anywhere; look for a window on another |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4123 visible frame. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4124 do |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4125 window = Fnext_window (window, Qnil, Qt); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4126 while (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (window)))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4127 && ! EQ (window, selected_window)); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4128 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4129 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4130 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 4131 |
| 4132 if (EQ (window, selected_window)) | |
| 4133 error ("There is no other window"); | |
| 4134 | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4135 return window; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4136 } |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4137 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4138 DEFUN ("scroll-other-window", Fscroll_other_window, Sscroll_other_window, 0, 1, "P", |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4139 "Scroll next window upward ARG lines; or near full screen if no ARG.\n\ |
|
22288
d8f011778094
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
22223
diff
changeset
|
4140 A near full screen is `next-screen-context-lines' less than a full screen.\n\ |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4141 The next window is the one below the current one; or the one at the top\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4142 if the current one is at the bottom. Negative ARG means scroll downward.\n\ |
|
22288
d8f011778094
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
22223
diff
changeset
|
4143 If ARG is the atom `-', scroll downward by nearly full screen.\n\ |
|
d8f011778094
(Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
22223
diff
changeset
|
4144 When calling from a program, supply as argument a number, nil, or `-'.\n\ |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4145 \n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4146 If in the minibuffer, `minibuffer-scroll-window' if non-nil\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4147 specifies the window to scroll.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4148 If `other-window-scroll-buffer' is non-nil, scroll the window\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4149 showing that buffer, popping the buffer up if necessary.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4150 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4151 register Lisp_Object arg; |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4152 { |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4153 register Lisp_Object window; |
|
10373
c5c1ffa3755e
(Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents:
10302
diff
changeset
|
4154 register int defalt; |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4155 register struct window *w; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4156 register int count = specpdl_ptr - specpdl; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4157 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4158 window = Fother_window_for_scrolling (); |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4159 |
| 265 | 4160 w = XWINDOW (window); |
|
10373
c5c1ffa3755e
(Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents:
10302
diff
changeset
|
4161 defalt = window_internal_height (w) - next_screen_context_lines; |
|
c5c1ffa3755e
(Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents:
10302
diff
changeset
|
4162 if (defalt < 1) defalt = 1; |
| 265 | 4163 |
| 4164 /* Don't screw up if window_scroll gets an error. */ | |
| 4165 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4166 ++windows_or_buffers_changed; |
| 265 | 4167 |
| 4168 Fset_buffer (w->buffer); | |
| 4169 SET_PT (marker_position (w->pointm)); | |
| 4170 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4171 if (NILP (arg)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4172 window_scroll (window, defalt, 1, 1); |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4173 else if (EQ (arg, Qminus)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4174 window_scroll (window, -defalt, 1, 1); |
| 265 | 4175 else |
| 4176 { | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4177 if (CONSP (arg)) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4178 arg = Fcar (arg); |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4179 CHECK_NUMBER (arg, 0); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4180 window_scroll (window, XINT (arg), 0, 1); |
| 265 | 4181 } |
| 4182 | |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4183 set_marker_both (w->pointm, Qnil, PT, PT_BYTE); |
|
1931
129d8225f748
* keyboard.c (recursive_edit_1, command_loop_1): Pass the proper
Jim Blandy <jimb@redhat.com>
parents:
1829
diff
changeset
|
4184 unbind_to (count, Qnil); |
| 265 | 4185 |
| 4186 return Qnil; | |
| 4187 } | |
| 4188 | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
4189 DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P", |
| 265 | 4190 "Scroll selected window display ARG columns left.\n\ |
| 4191 Default for ARG is window width minus 2.") | |
| 4192 (arg) | |
| 4193 register Lisp_Object arg; | |
| 4194 { | |
| 4195 | |
| 485 | 4196 if (NILP (arg)) |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4197 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
| 265 | 4198 else |
| 4199 arg = Fprefix_numeric_value (arg); | |
| 4200 | |
| 4201 return | |
| 4202 Fset_window_hscroll (selected_window, | |
| 4203 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
| 4204 + XINT (arg))); | |
| 4205 } | |
| 4206 | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
4207 DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P", |
| 265 | 4208 "Scroll selected window display ARG columns right.\n\ |
| 4209 Default for ARG is window width minus 2.") | |
| 4210 (arg) | |
| 4211 register Lisp_Object arg; | |
| 4212 { | |
| 485 | 4213 if (NILP (arg)) |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4214 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
| 265 | 4215 else |
| 4216 arg = Fprefix_numeric_value (arg); | |
| 4217 | |
| 4218 return | |
| 4219 Fset_window_hscroll (selected_window, | |
| 4220 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
| 4221 - XINT (arg))); | |
| 4222 } | |
| 4223 | |
| 4224 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", | |
| 769 | 4225 "Center point in window and redisplay frame. With ARG, put point on line ARG.\n\ |
| 265 | 4226 The desired position of point is always relative to the current window.\n\ |
| 769 | 4227 Just C-u as prefix means put point in the center of the window.\n\ |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4228 If ARG is omitted or nil, erases the entire frame and then\n\ |
| 769 | 4229 redraws with point in the center of the current window.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4230 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4231 register Lisp_Object arg; |
| 265 | 4232 { |
| 4233 register struct window *w = XWINDOW (selected_window); | |
| 4234 register int ht = window_internal_height (w); | |
|
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
4235 struct position pos; |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4236 struct buffer *buf = XBUFFER (w->buffer); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4237 struct buffer *obuf = current_buffer; |
| 265 | 4238 |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4239 if (NILP (arg)) |
| 265 | 4240 { |
| 769 | 4241 extern int frame_garbaged; |
|
26873
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4242 int i; |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4243 |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4244 /* Invalidate pixel data calculated for all compositions. */ |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4245 for (i = 0; i < n_compositions; i++) |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4246 composition_table[i]->font = NULL; |
| 265 | 4247 |
|
25402
857e8b5b1194
(Frecenter): Clear frame if called with nil or no arg.
Gerd Moellmann <gerd@gnu.org>
parents:
25387
diff
changeset
|
4248 Fredraw_frame (w->frame); |
| 769 | 4249 SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w))); |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4250 XSETFASTINT (arg, ht / 2); |
| 265 | 4251 } |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4252 else if (CONSP (arg)) /* Just C-u. */ |
| 265 | 4253 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4254 XSETFASTINT (arg, ht / 2); |
| 265 | 4255 } |
| 4256 else | |
| 4257 { | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4258 arg = Fprefix_numeric_value (arg); |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4259 CHECK_NUMBER (arg, 0); |
| 265 | 4260 } |
| 4261 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4262 if (XINT (arg) < 0) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4263 XSETINT (arg, XINT (arg) + ht); |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4264 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4265 set_buffer_internal (buf); |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15905
diff
changeset
|
4266 pos = *vmotion (PT, - XINT (arg), w); |
|
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
4267 |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4268 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4269 w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4270 || FETCH_BYTE (pos.bytepos - 1) == '\n') |
|
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
4271 ? Qt : Qnil); |
| 265 | 4272 w->force_start = Qt; |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4273 set_buffer_internal (obuf); |
| 265 | 4274 |
| 4275 return Qnil; | |
| 4276 } | |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4277 |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4278 |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4279 /* Value is the number of lines actually displayed in window W, |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4280 as opposed to its height. */ |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4281 |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4282 static int |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4283 displayed_window_lines (w) |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4284 struct window *w; |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4285 { |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4286 struct it it; |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4287 struct text_pos start; |
|
29488
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4288 int height = window_box_height (w); |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4289 |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4290 SET_TEXT_POS_FROM_MARKER (start, w->start); |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4291 start_display (&it, w, start); |
|
29488
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4292 move_it_vertically (&it, height); |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4293 |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4294 /* Add in empty lines at the bottom of the window. */ |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4295 if (it.current_y < height) |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4296 { |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4297 struct frame *f = XFRAME (w->frame); |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4298 int rest = height - it.current_y; |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4299 int lines = (rest + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4300 it.vpos += lines; |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4301 } |
|
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4302 |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4303 return it.vpos; |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4304 } |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4305 |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4306 |
| 265 | 4307 |
| 4308 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, | |
| 4309 1, 1, "P", | |
| 4310 "Position point relative to window.\n\ | |
|
8411
9a68cba600fc
(Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8366
diff
changeset
|
4311 With no argument, position point at center of window.\n\ |
|
22897
e694821e2b96
(Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22288
diff
changeset
|
4312 An argument specifies vertical position within the window;\n\ |
|
e694821e2b96
(Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
22288
diff
changeset
|
4313 zero means top of window, negative means relative to bottom of window.") |
| 265 | 4314 (arg) |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4315 Lisp_Object arg; |
| 265 | 4316 { |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4317 struct window *w = XWINDOW (selected_window); |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4318 int lines, start; |
|
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
4319 Lisp_Object window; |
| 265 | 4320 |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4321 window = selected_window; |
| 265 | 4322 start = marker_position (w->start); |
| 4323 if (start < BEGV || start > ZV) | |
| 4324 { | |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4325 int height = window_internal_height (w); |
|
6341
dfc758dd2b08
(window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents:
6326
diff
changeset
|
4326 Fvertical_motion (make_number (- (height / 2)), window); |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4327 set_marker_both (w->start, w->buffer, PT, PT_BYTE); |
| 265 | 4328 w->start_at_line_beg = Fbolp (); |
| 4329 w->force_start = Qt; | |
| 4330 } | |
| 4331 else | |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4332 Fgoto_char (w->start); |
| 265 | 4333 |
|
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4334 lines = displayed_window_lines (w); |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4335 if (NILP (arg)) |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4336 XSETFASTINT (arg, lines / 2); |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4337 else |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4338 { |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4339 arg = Fprefix_numeric_value (arg); |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4340 if (XINT (arg) < 0) |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4341 XSETINT (arg, XINT (arg) + lines); |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4342 } |
|
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4343 |
|
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
4344 return Fvertical_motion (arg, window); |
| 265 | 4345 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4346 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4347 |
| 265 | 4348 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4349 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4350 Window Configuration |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4351 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4352 |
| 265 | 4353 struct save_window_data |
| 4354 { | |
|
15712
a272ccf6c225
(struct save_window_data, struct saved_window): First
Karl Heuer <kwzh@gnu.org>
parents:
15385
diff
changeset
|
4355 EMACS_INT size_from_Lisp_Vector_struct; |
| 265 | 4356 struct Lisp_Vector *next_from_Lisp_Vector_struct; |
|
6099
19eaf70457d4
(Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents:
5990
diff
changeset
|
4357 Lisp_Object frame_width, frame_height, frame_menu_bar_lines; |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4358 Lisp_Object frame_tool_bar_lines; |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4359 Lisp_Object selected_frame; |
| 265 | 4360 Lisp_Object current_window; |
| 4361 Lisp_Object current_buffer; | |
| 4362 Lisp_Object minibuf_scroll_window; | |
| 4363 Lisp_Object root_window; | |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4364 Lisp_Object focus_frame; |
|
8931
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4365 /* Record the values of window-min-width and window-min-height |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4366 so that window sizes remain consistent with them. */ |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4367 Lisp_Object min_width, min_height; |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4368 /* A vector, each of whose elements is a struct saved_window |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4369 for one window. */ |
| 265 | 4370 Lisp_Object saved_windows; |
| 4371 }; | |
|
1326
709532b86646
* window.c (SAVE_WINDOW_DATA_SIZE): Define this using sizeof,
Jim Blandy <jimb@redhat.com>
parents:
1325
diff
changeset
|
4372 |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4373 /* This is saved as a Lisp_Vector */ |
| 265 | 4374 struct saved_window |
| 4375 { | |
| 4376 /* these first two must agree with struct Lisp_Vector in lisp.h */ | |
|
15712
a272ccf6c225
(struct save_window_data, struct saved_window): First
Karl Heuer <kwzh@gnu.org>
parents:
15385
diff
changeset
|
4377 EMACS_INT size_from_Lisp_Vector_struct; |
| 265 | 4378 struct Lisp_Vector *next_from_Lisp_Vector_struct; |
| 4379 | |
| 4380 Lisp_Object window; | |
| 4381 Lisp_Object buffer, start, pointm, mark; | |
| 4382 Lisp_Object left, top, width, height, hscroll; | |
| 4383 Lisp_Object parent, prev; | |
| 4384 Lisp_Object start_at_line_beg; | |
| 4385 Lisp_Object display_table; | |
| 4386 }; | |
| 4387 #define SAVED_WINDOW_VECTOR_SIZE 14 /* Arg to Fmake_vector */ | |
| 4388 | |
| 4389 #define SAVED_WINDOW_N(swv,n) \ | |
| 4390 ((struct saved_window *) (XVECTOR ((swv)->contents[(n)]))) | |
| 4391 | |
| 4392 DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0, | |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4393 "Return t if OBJECT is a window-configuration object.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4394 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4395 Lisp_Object object; |
| 265 | 4396 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4397 if (WINDOW_CONFIGURATIONP (object)) |
| 265 | 4398 return Qt; |
| 4399 return Qnil; | |
| 4400 } | |
| 4401 | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4402 DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0, |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4403 "Return the frame that CONFIG, a window-configuration object, is about.") |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4404 (config) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4405 Lisp_Object config; |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4406 { |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4407 register struct save_window_data *data; |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4408 struct Lisp_Vector *saved_windows; |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4409 |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4410 if (! WINDOW_CONFIGURATIONP (config)) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4411 wrong_type_argument (Qwindow_configuration_p, config); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4412 |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4413 data = (struct save_window_data *) XVECTOR (config); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4414 saved_windows = XVECTOR (data->saved_windows); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4415 return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4416 } |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4417 |
|
2297
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
4418 DEFUN ("set-window-configuration", Fset_window_configuration, |
|
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
4419 Sset_window_configuration, 1, 1, 0, |
| 265 | 4420 "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\ |
| 4421 CONFIGURATION must be a value previously returned\n\ | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4422 by `current-window-configuration' (which see).\n\ |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4423 If CONFIGURATION was made from a frame that is now deleted,\n\ |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4424 only frame-independent values can be restored. In this case,\n\ |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4425 the return value is nil. Otherwise the value is t.") |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4426 (configuration) |
|
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
4427 Lisp_Object configuration; |
| 265 | 4428 { |
| 4429 register struct save_window_data *data; | |
| 4430 struct Lisp_Vector *saved_windows; | |
| 4431 Lisp_Object new_current_buffer; | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4432 Lisp_Object frame; |
| 769 | 4433 FRAME_PTR f; |
| 18657 | 4434 int old_point = -1; |
| 265 | 4435 |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
4436 while (!WINDOW_CONFIGURATIONP (configuration)) |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4437 wrong_type_argument (Qwindow_configuration_p, configuration); |
| 265 | 4438 |
|
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
4439 data = (struct save_window_data *) XVECTOR (configuration); |
| 265 | 4440 saved_windows = XVECTOR (data->saved_windows); |
| 4441 | |
| 4442 new_current_buffer = data->current_buffer; | |
| 485 | 4443 if (NILP (XBUFFER (new_current_buffer)->name)) |
| 265 | 4444 new_current_buffer = Qnil; |
| 18657 | 4445 else |
| 4446 { | |
| 4447 if (XBUFFER (new_current_buffer) == current_buffer) | |
| 4448 old_point = PT; | |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4449 |
| 18657 | 4450 } |
| 265 | 4451 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4452 frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4453 f = XFRAME (frame); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4454 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4455 /* If f is a dead frame, don't bother rebuilding its window tree. |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4456 However, there is other stuff we should still try to do below. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4457 if (FRAME_LIVE_P (f)) |
| 265 | 4458 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4459 register struct window *w; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4460 register struct saved_window *p; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4461 struct window *root_window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4462 struct window **leaf_windows; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4463 int n_leaf_windows; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4464 int k, i; |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4465 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4466 /* If the frame has been resized since this window configuration was |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4467 made, we change the frame to the size specified in the |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4468 configuration, restore the configuration, and then resize it |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4469 back. We keep track of the prevailing height in these variables. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4470 int previous_frame_height = FRAME_HEIGHT (f); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4471 int previous_frame_width = FRAME_WIDTH (f); |
|
6099
19eaf70457d4
(Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents:
5990
diff
changeset
|
4472 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4473 int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4474 |
| 18657 | 4475 /* The mouse highlighting code could get screwed up |
| 4476 if it runs during this. */ | |
| 4477 BLOCK_INPUT; | |
| 4478 | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4479 if (XFASTINT (data->frame_height) != previous_frame_height |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4480 || XFASTINT (data->frame_width) != previous_frame_width) |
|
21533
b7df83bf15ff
(Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents:
21514
diff
changeset
|
4481 change_frame_size (f, XFASTINT (data->frame_height), |
|
25356
5db69f7aadca
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25315
diff
changeset
|
4482 XFASTINT (data->frame_width), 0, 0, 0); |
|
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
4483 #if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS) |
|
6099
19eaf70457d4
(Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents:
5990
diff
changeset
|
4484 if (XFASTINT (data->frame_menu_bar_lines) |
|
19eaf70457d4
(Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents:
5990
diff
changeset
|
4485 != previous_frame_menu_bar_lines) |
|
21533
b7df83bf15ff
(Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents:
21514
diff
changeset
|
4486 x_set_menu_bar_lines (f, data->frame_menu_bar_lines, make_number (0)); |
|
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4487 #ifdef HAVE_WINDOW_SYSTEM |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4488 if (XFASTINT (data->frame_tool_bar_lines) |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4489 != previous_frame_tool_bar_lines) |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4490 x_set_tool_bar_lines (f, data->frame_tool_bar_lines, make_number (0)); |
|
6852
5cc78dd8efc3
(Fset_window_configuration): Only call X fns if HAVE_X_WINDOWS.
Karl Heuer <kwzh@gnu.org>
parents:
6851
diff
changeset
|
4491 #endif |
|
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4492 #endif |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4493 |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4494 /* "Swap out" point from the selected window |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4495 into its buffer. We do this now, before |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4496 restoring the window contents, and prevent it from |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4497 being done later on when we select a new window. */ |
|
20627
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4498 if (! NILP (XWINDOW (selected_window)->buffer)) |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4499 { |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4500 w = XWINDOW (selected_window); |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4501 set_marker_both (w->pointm, |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4502 w->buffer, |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4503 BUF_PT (XBUFFER (w->buffer)), |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4504 BUF_PT_BYTE (XBUFFER (w->buffer))); |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4505 } |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4506 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4507 windows_or_buffers_changed++; |
|
10666
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
4508 FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4509 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4510 /* Problem: Freeing all matrices and later allocating them again |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4511 is a serious redisplay flickering problem. What we would |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4512 really like to do is to free only those matrices not reused |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4513 below. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4514 root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4515 leaf_windows |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4516 = (struct window **) alloca (count_windows (root_window) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4517 * sizeof (struct window *)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4518 n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4519 |
|
8931
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4520 /* Temporarily avoid any problems with windows that are smaller |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4521 than they are supposed to be. */ |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4522 window_min_height = 1; |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4523 window_min_width = 1; |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4524 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4525 /* Kludge Alert! |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4526 Mark all windows now on frame as "deleted". |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4527 Restoring the new configuration "undeletes" any that are in it. |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
4528 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4529 Save their current buffers in their height fields, since we may |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4530 need it later, if a buffer saved in the configuration is now |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4531 dead. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4532 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4533 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4534 for (k = 0; k < saved_windows->size; k++) |
| 265 | 4535 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4536 p = SAVED_WINDOW_N (saved_windows, k); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4537 w = XWINDOW (p->window); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4538 w->next = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4539 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4540 if (!NILP (p->parent)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4541 w->parent = SAVED_WINDOW_N (saved_windows, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4542 XFASTINT (p->parent))->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4543 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4544 w->parent = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4545 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4546 if (!NILP (p->prev)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4547 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4548 w->prev = SAVED_WINDOW_N (saved_windows, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4549 XFASTINT (p->prev))->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4550 XWINDOW (w->prev)->next = p->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4551 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4552 else |
| 265 | 4553 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4554 w->prev = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4555 if (!NILP (w->parent)) |
| 265 | 4556 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4557 if (EQ (p->width, XWINDOW (w->parent)->width)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4558 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4559 XWINDOW (w->parent)->vchild = p->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4560 XWINDOW (w->parent)->hchild = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4561 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4562 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4563 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4564 XWINDOW (w->parent)->hchild = p->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4565 XWINDOW (w->parent)->vchild = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4566 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4567 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4568 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4569 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4570 /* If we squirreled away the buffer in the window's height, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4571 restore it now. */ |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
4572 if (BUFFERP (w->height)) |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4573 w->buffer = w->height; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4574 w->left = p->left; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4575 w->top = p->top; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4576 w->width = p->width; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4577 w->height = p->height; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4578 w->hscroll = p->hscroll; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4579 w->display_table = p->display_table; |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4580 XSETFASTINT (w->last_modified, 0); |
|
16208
e3a834653117
(Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
16068
diff
changeset
|
4581 XSETFASTINT (w->last_overlay_modified, 0); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4582 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4583 /* Reinstall the saved buffer and pointers into it. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4584 if (NILP (p->buffer)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4585 w->buffer = p->buffer; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4586 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4587 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4588 if (!NILP (XBUFFER (p->buffer)->name)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4589 /* If saved buffer is alive, install it. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4590 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4591 w->buffer = p->buffer; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4592 w->start_at_line_beg = p->start_at_line_beg; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4593 set_marker_restricted (w->start, p->start, w->buffer); |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4594 set_marker_restricted (w->pointm, p->pointm, w->buffer); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4595 Fset_marker (XBUFFER (w->buffer)->mark, |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4596 p->mark, w->buffer); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4597 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4598 /* As documented in Fcurrent_window_configuration, don't |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4599 save the location of point in the buffer which was current |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4600 when the window configuration was recorded. */ |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
4601 if (!EQ (p->buffer, new_current_buffer) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
4602 && XBUFFER (p->buffer) == current_buffer) |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4603 Fgoto_char (w->pointm); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4604 } |
|
3535
581c09f72dbd
(Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents:
3354
diff
changeset
|
4605 else if (NILP (w->buffer) || NILP (XBUFFER (w->buffer)->name)) |
|
581c09f72dbd
(Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents:
3354
diff
changeset
|
4606 /* Else unless window has a live buffer, get one. */ |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4607 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4608 w->buffer = Fcdr (Fcar (Vbuffer_alist)); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4609 /* This will set the markers to beginning of visible |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4610 range. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4611 set_marker_restricted (w->start, make_number (0), w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4612 set_marker_restricted (w->pointm, make_number (0),w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4613 w->start_at_line_beg = Qt; |
| 265 | 4614 } |
| 4615 else | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4616 /* Keeping window's old buffer; make sure the markers |
|
3535
581c09f72dbd
(Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents:
3354
diff
changeset
|
4617 are real. */ |
| 265 | 4618 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4619 /* Set window markers at start of visible range. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4620 if (XMARKER (w->start)->buffer == 0) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4621 set_marker_restricted (w->start, make_number (0), |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4622 w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4623 if (XMARKER (w->pointm)->buffer == 0) |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4624 set_marker_restricted_both (w->pointm, w->buffer, |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4625 BUF_PT (XBUFFER (w->buffer)), |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4626 BUF_PT_BYTE (XBUFFER (w->buffer))); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4627 w->start_at_line_beg = Qt; |
| 265 | 4628 } |
| 4629 } | |
| 4630 } | |
|
1237
3929b2135e58
* window.c (delete_all_subwindows): Save the window's buffer in
Jim Blandy <jimb@redhat.com>
parents:
1123
diff
changeset
|
4631 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4632 FRAME_ROOT_WINDOW (f) = data->root_window; |
|
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4633 /* Prevent "swapping out point" in the old selected window |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4634 using the buffer that has been restored into it. |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4635 That swapping out has already been done, |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4636 near the beginning of this function. */ |
|
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4637 selected_window = Qnil; |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4638 Fselect_window (data->current_window); |
|
17678
c13cd575945a
(Fset_window_configuration): Set last_selected_window
Richard M. Stallman <rms@gnu.org>
parents:
17628
diff
changeset
|
4639 XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
|
c13cd575945a
(Fset_window_configuration): Set last_selected_window
Richard M. Stallman <rms@gnu.org>
parents:
17628
diff
changeset
|
4640 = selected_window; |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4641 |
|
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4642 if (NILP (data->focus_frame) |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
4643 || (FRAMEP (data->focus_frame) |
|
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4644 && FRAME_LIVE_P (XFRAME (data->focus_frame)))) |
|
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4645 Fredirect_frame_focus (frame, data->focus_frame); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4646 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4647 #if 0 /* I don't understand why this is needed, and it causes problems |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4648 when the frame's old selected window has been deleted. */ |
|
15385
72b57d1c8de0
Whitespace and #if 0 code changes.
Richard M. Stallman <rms@gnu.org>
parents:
15384
diff
changeset
|
4649 if (f != selected_frame && FRAME_WINDOW_P (f)) |
|
12288
36d3bd1212de
(Fset_window_configuration): Use do_switch_frame directly.
Richard M. Stallman <rms@gnu.org>
parents:
11852
diff
changeset
|
4650 do_switch_frame (WINDOW_FRAME (XWINDOW (data->root_window)), |
|
36d3bd1212de
(Fset_window_configuration): Use do_switch_frame directly.
Richard M. Stallman <rms@gnu.org>
parents:
11852
diff
changeset
|
4651 Qnil, 0); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4652 #endif |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4653 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4654 /* Set the screen height to the value it had before this function. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4655 if (previous_frame_height != FRAME_HEIGHT (f) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4656 || previous_frame_width != FRAME_WIDTH (f)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4657 change_frame_size (f, previous_frame_height, previous_frame_width, |
|
25356
5db69f7aadca
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25315
diff
changeset
|
4658 0, 0, 0); |
|
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
4659 #if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS) |
|
6099
19eaf70457d4
(Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents:
5990
diff
changeset
|
4660 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f)) |
|
21533
b7df83bf15ff
(Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents:
21514
diff
changeset
|
4661 x_set_menu_bar_lines (f, make_number (previous_frame_menu_bar_lines), |
|
b7df83bf15ff
(Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents:
21514
diff
changeset
|
4662 make_number (0)); |
|
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4663 #ifdef HAVE_WINDOW_SYSTEM |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4664 if (previous_frame_tool_bar_lines != FRAME_TOOL_BAR_LINES (f)) |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4665 x_set_tool_bar_lines (f, make_number (previous_frame_tool_bar_lines), |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4666 make_number (0)); |
|
6852
5cc78dd8efc3
(Fset_window_configuration): Only call X fns if HAVE_X_WINDOWS.
Karl Heuer <kwzh@gnu.org>
parents:
6851
diff
changeset
|
4667 #endif |
|
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4668 #endif |
| 18657 | 4669 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4670 /* Now, free glyph matrices in windows that were not reused. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4671 for (i = 0; i < n_leaf_windows; ++i) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4672 if (NILP (leaf_windows[i]->buffer)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4673 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4674 /* Assert it's not reused as a combination. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4675 xassert (NILP (leaf_windows[i]->hchild) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4676 && NILP (leaf_windows[i]->vchild)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4677 free_window_matrices (leaf_windows[i]); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4678 SET_FRAME_GARBAGED (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4679 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4680 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4681 adjust_glyphs (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4682 |
| 18657 | 4683 UNBLOCK_INPUT; |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4684 |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4685 /* Fselect_window will have made f the selected frame, so we |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4686 reselect the proper frame here. Fhandle_switch_frame will change the |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4687 selected window too, but that doesn't make the call to |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4688 Fselect_window above totally superfluous; it still sets f's |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4689 selected window. */ |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4690 if (FRAME_LIVE_P (XFRAME (data->selected_frame))) |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4691 do_switch_frame (data->selected_frame, Qnil, 0); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4692 |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4693 if (! NILP (Vwindow_configuration_change_hook) |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4694 && ! NILP (Vrun_hooks)) |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4695 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
| 265 | 4696 } |
| 4697 | |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4698 if (!NILP (new_current_buffer)) |
| 18657 | 4699 { |
| 4700 Fset_buffer (new_current_buffer); | |
| 4701 | |
| 4702 /* If the buffer that is current now is the same | |
| 4703 that was current before setting the window configuration, | |
| 4704 don't alter its PT. */ | |
| 4705 if (old_point >= 0) | |
| 4706 SET_PT (old_point); | |
| 4707 } | |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4708 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4709 /* Restore the minimum heights recorded in the configuration. */ |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4710 window_min_height = XINT (data->min_height); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4711 window_min_width = XINT (data->min_width); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4712 |
| 265 | 4713 Vminibuf_scroll_window = data->minibuf_scroll_window; |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
4714 |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4715 return (FRAME_LIVE_P (f) ? Qt : Qnil); |
| 265 | 4716 } |
| 4717 | |
| 769 | 4718 /* Mark all windows now on frame as deleted |
| 265 | 4719 by setting their buffers to nil. */ |
| 4720 | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4721 void |
| 265 | 4722 delete_all_subwindows (w) |
| 4723 register struct window *w; | |
| 4724 { | |
| 485 | 4725 if (!NILP (w->next)) |
| 265 | 4726 delete_all_subwindows (XWINDOW (w->next)); |
| 485 | 4727 if (!NILP (w->vchild)) |
| 265 | 4728 delete_all_subwindows (XWINDOW (w->vchild)); |
| 485 | 4729 if (!NILP (w->hchild)) |
| 265 | 4730 delete_all_subwindows (XWINDOW (w->hchild)); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4731 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4732 w->height = w->buffer; /* See Fset_window_configuration for excuse. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4733 |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4734 if (!NILP (w->buffer)) |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4735 unshow_buffer (w); |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4736 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4737 /* We set all three of these fields to nil, to make sure that we can |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4738 distinguish this dead window from any live window. Live leaf |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4739 windows will have buffer set, and combination windows will have |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4740 vchild or hchild set. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4741 w->buffer = Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4742 w->vchild = Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4743 w->hchild = Qnil; |
|
30045
ff2db81c11c1
(delete_all_subwindows): Reset Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
30039
diff
changeset
|
4744 |
|
ff2db81c11c1
(delete_all_subwindows): Reset Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
30039
diff
changeset
|
4745 Vwindow_list = Qnil; |
| 265 | 4746 } |
| 4747 | |
| 4748 static int | |
| 4749 count_windows (window) | |
| 4750 register struct window *window; | |
| 4751 { | |
| 4752 register int count = 1; | |
| 485 | 4753 if (!NILP (window->next)) |
| 265 | 4754 count += count_windows (XWINDOW (window->next)); |
| 485 | 4755 if (!NILP (window->vchild)) |
| 265 | 4756 count += count_windows (XWINDOW (window->vchild)); |
| 485 | 4757 if (!NILP (window->hchild)) |
| 265 | 4758 count += count_windows (XWINDOW (window->hchild)); |
| 4759 return count; | |
| 4760 } | |
| 4761 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4762 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4763 /* Fill vector FLAT with leaf windows under W, starting at index I. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4764 Value is last index + 1. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4765 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4766 static int |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4767 get_leaf_windows (w, flat, i) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4768 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4769 struct window **flat; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4770 int i; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4771 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4772 while (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4773 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4774 if (!NILP (w->hchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4775 i = get_leaf_windows (XWINDOW (w->hchild), flat, i); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4776 else if (!NILP (w->vchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4777 i = get_leaf_windows (XWINDOW (w->vchild), flat, i); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4778 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4779 flat[i++] = w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4780 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4781 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4782 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4783 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4784 return i; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4785 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4786 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4787 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4788 /* Return a pointer to the glyph W's physical cursor is on. Value is |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4789 null if W's current matrix is invalid, so that no meaningfull glyph |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4790 can be returned. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4791 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4792 struct glyph * |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4793 get_phys_cursor_glyph (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4794 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4795 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4796 struct glyph_row *row; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4797 struct glyph *glyph; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4798 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4799 if (w->phys_cursor.vpos >= 0 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4800 && w->phys_cursor.vpos < w->current_matrix->nrows |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4801 && (row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4802 row->enabled_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4803 && row->used[TEXT_AREA] > w->phys_cursor.hpos) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4804 glyph = row->glyphs[TEXT_AREA] + w->phys_cursor.hpos; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4805 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4806 glyph = NULL; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4807 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4808 return glyph; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4809 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4810 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4811 |
| 265 | 4812 static int |
| 4813 save_window_save (window, vector, i) | |
| 4814 Lisp_Object window; | |
| 4815 struct Lisp_Vector *vector; | |
| 4816 int i; | |
| 4817 { | |
| 4818 register struct saved_window *p; | |
| 4819 register struct window *w; | |
| 4820 register Lisp_Object tem; | |
| 4821 | |
| 485 | 4822 for (;!NILP (window); window = w->next) |
| 265 | 4823 { |
| 4824 p = SAVED_WINDOW_N (vector, i); | |
| 4825 w = XWINDOW (window); | |
| 4826 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4827 XSETFASTINT (w->temslot, i++); |
| 265 | 4828 p->window = window; |
| 4829 p->buffer = w->buffer; | |
| 4830 p->left = w->left; | |
| 4831 p->top = w->top; | |
| 4832 p->width = w->width; | |
| 4833 p->height = w->height; | |
| 4834 p->hscroll = w->hscroll; | |
| 4835 p->display_table = w->display_table; | |
| 485 | 4836 if (!NILP (w->buffer)) |
| 265 | 4837 { |
| 4838 /* Save w's value of point in the window configuration. | |
| 4839 If w is the selected window, then get the value of point | |
| 4840 from the buffer; pointm is garbage in the selected window. */ | |
| 4841 if (EQ (window, selected_window)) | |
| 4842 { | |
| 4843 p->pointm = Fmake_marker (); | |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4844 set_marker_both (p->pointm, w->buffer, |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4845 BUF_PT (XBUFFER (w->buffer)), |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4846 BUF_PT_BYTE (XBUFFER (w->buffer))); |
| 265 | 4847 } |
| 4848 else | |
|
12981
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
4849 p->pointm = Fcopy_marker (w->pointm, Qnil); |
|
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
4850 |
|
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
4851 p->start = Fcopy_marker (w->start, Qnil); |
| 265 | 4852 p->start_at_line_beg = w->start_at_line_beg; |
| 4853 | |
| 4854 tem = XBUFFER (w->buffer)->mark; | |
|
12981
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
4855 p->mark = Fcopy_marker (tem, Qnil); |
| 265 | 4856 } |
| 4857 else | |
| 4858 { | |
| 4859 p->pointm = Qnil; | |
| 4860 p->start = Qnil; | |
| 4861 p->mark = Qnil; | |
| 4862 p->start_at_line_beg = Qnil; | |
| 4863 } | |
| 4864 | |
| 485 | 4865 if (NILP (w->parent)) |
| 265 | 4866 p->parent = Qnil; |
| 4867 else | |
| 4868 p->parent = XWINDOW (w->parent)->temslot; | |
| 4869 | |
| 485 | 4870 if (NILP (w->prev)) |
| 265 | 4871 p->prev = Qnil; |
| 4872 else | |
| 4873 p->prev = XWINDOW (w->prev)->temslot; | |
| 4874 | |
| 485 | 4875 if (!NILP (w->vchild)) |
| 265 | 4876 i = save_window_save (w->vchild, vector, i); |
| 485 | 4877 if (!NILP (w->hchild)) |
| 265 | 4878 i = save_window_save (w->hchild, vector, i); |
| 4879 } | |
| 4880 | |
| 4881 return i; | |
| 4882 } | |
| 4883 | |
|
16485
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
4884 DEFUN ("current-window-configuration", Fcurrent_window_configuration, |
|
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
4885 Scurrent_window_configuration, 0, 1, 0, |
| 769 | 4886 "Return an object representing the current window configuration of FRAME.\n\ |
| 4887 If FRAME is nil or omitted, use the selected frame.\n\ | |
| 265 | 4888 This describes the number of windows, their sizes and current buffers,\n\ |
| 4889 and for each displayed buffer, where display starts, and the positions of\n\ | |
| 4890 point and mark. An exception is made for point in the current buffer:\n\ | |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4891 its value is -not- saved.\n\ |
|
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4892 This also records the currently selected frame, and FRAME's focus\n\ |
|
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4893 redirection (see `redirect-frame-focus').") |
| 769 | 4894 (frame) |
| 4895 Lisp_Object frame; | |
| 265 | 4896 { |
| 4897 register Lisp_Object tem; | |
| 4898 register int n_windows; | |
| 4899 register struct save_window_data *data; | |
|
9974
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4900 register struct Lisp_Vector *vec; |
| 265 | 4901 register int i; |
| 769 | 4902 FRAME_PTR f; |
| 265 | 4903 |
| 769 | 4904 if (NILP (frame)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
4905 frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
4906 CHECK_LIVE_FRAME (frame, 0); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
4907 f = XFRAME (frame); |
| 358 | 4908 |
| 769 | 4909 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
|
9974
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4910 vec = allocate_vectorlike (VECSIZE (struct save_window_data)); |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4911 for (i = 0; i < VECSIZE (struct save_window_data); i++) |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4912 vec->contents[i] = Qnil; |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4913 vec->size = VECSIZE (struct save_window_data); |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4914 data = (struct save_window_data *)vec; |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4915 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4916 XSETFASTINT (data->frame_width, FRAME_WIDTH (f)); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4917 XSETFASTINT (data->frame_height, FRAME_HEIGHT (f)); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4918 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f)); |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
4919 XSETFASTINT (data->frame_tool_bar_lines, FRAME_TOOL_BAR_LINES (f)); |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
4920 data->selected_frame = selected_frame; |
| 769 | 4921 data->current_window = FRAME_SELECTED_WINDOW (f); |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
4922 XSETBUFFER (data->current_buffer, current_buffer); |
| 265 | 4923 data->minibuf_scroll_window = Vminibuf_scroll_window; |
| 769 | 4924 data->root_window = FRAME_ROOT_WINDOW (f); |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4925 data->focus_frame = FRAME_FOCUS_FRAME (f); |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
4926 XSETINT (data->min_height, window_min_height); |
|
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
4927 XSETINT (data->min_width, window_min_width); |
| 265 | 4928 tem = Fmake_vector (make_number (n_windows), Qnil); |
| 4929 data->saved_windows = tem; | |
| 4930 for (i = 0; i < n_windows; i++) | |
| 4931 XVECTOR (tem)->contents[i] | |
| 4932 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil); | |
| 769 | 4933 save_window_save (FRAME_ROOT_WINDOW (f), |
| 265 | 4934 XVECTOR (tem), 0); |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
4935 XSETWINDOW_CONFIGURATION (tem, data); |
| 265 | 4936 return (tem); |
| 4937 } | |
| 4938 | |
| 4939 DEFUN ("save-window-excursion", Fsave_window_excursion, Ssave_window_excursion, | |
| 4940 0, UNEVALLED, 0, | |
| 4941 "Execute body, preserving window sizes and contents.\n\ | |
|
8059
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
4942 Restore which buffer appears in which window, where display starts,\n\ |
|
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
4943 and the value of point and mark for each window.\n\ |
|
28104
7eb1735d6d4d
(Fsave_window_excursion): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28004
diff
changeset
|
4944 Also restore the choice of selected window.\n\ |
|
8059
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
4945 Also restore which buffer is current.\n\ |
| 265 | 4946 Does not restore the value of point in current buffer.") |
| 4947 (args) | |
| 4948 Lisp_Object args; | |
| 4949 { | |
| 4950 register Lisp_Object val; | |
| 4951 register int count = specpdl_ptr - specpdl; | |
| 4952 | |
| 4953 record_unwind_protect (Fset_window_configuration, | |
| 358 | 4954 Fcurrent_window_configuration (Qnil)); |
| 265 | 4955 val = Fprogn (args); |
| 4956 return unbind_to (count, val); | |
| 4957 } | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4958 |
| 265 | 4959 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4960 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4961 Marginal Areas |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4962 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4963 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4964 DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, |
|
27553
49dd86912d71
(Fset_window_margins): Don't make interactive. Doc fix.
Dave Love <fx@gnu.org>
parents:
26873
diff
changeset
|
4965 2, 3, 0, |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4966 "Set width of marginal areas of window WINDOW.\n\ |
|
27553
49dd86912d71
(Fset_window_margins): Don't make interactive. Doc fix.
Dave Love <fx@gnu.org>
parents:
26873
diff
changeset
|
4967 If window is nil, set margins of the currently selected window.\n\ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4968 First parameter LEFT-WIDTH specifies the number of character\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4969 cells to reserve for the left marginal area. Second parameter\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4970 RIGHT-WIDTH does the same for the right marginal area.\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4971 A nil width parameter means no margin.") |
|
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
4972 (window, left, right) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4973 Lisp_Object window, left, right; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4974 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4975 struct window *w = decode_window (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4976 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4977 if (!NILP (left)) |
|
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
4978 CHECK_NUMBER_OR_FLOAT (left, 1); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4979 if (!NILP (right)) |
|
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
4980 CHECK_NUMBER_OR_FLOAT (right, 2); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4981 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4982 /* Check widths < 0 and translate a zero width to nil. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4983 Margins that are too wide have to be checked elsewhere. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4984 if ((INTEGERP (left) && XINT (left) < 0) |
|
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
26153
diff
changeset
|
4985 || (FLOATP (left) && XFLOAT_DATA (left) <= 0)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4986 XSETFASTINT (left, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4987 if (INTEGERP (left) && XFASTINT (left) == 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4988 left = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4989 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4990 if ((INTEGERP (right) && XINT (right) < 0) |
|
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
26153
diff
changeset
|
4991 || (FLOATP (right) && XFLOAT_DATA (right) <= 0)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4992 XSETFASTINT (right, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4993 if (INTEGERP (right) && XFASTINT (right) == 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4994 right = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4995 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4996 w->left_margin_width = left; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4997 w->right_margin_width = right; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4998 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4999 ++windows_or_buffers_changed; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5000 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5001 return Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5002 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5003 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5004 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5005 DEFUN ("window-margins", Fwindow_margins, Swindow_margins, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5006 0, 1, 0, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5007 "Get width of marginal areas of window WINDOW.\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5008 If WINDOW is omitted or nil, use the currently selected window.\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5009 Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5010 If a marginal area does not exist, its width will be returned\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5011 as nil.") |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5012 (window) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5013 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5014 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5015 struct window *w = decode_window (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5016 return Fcons (w->left_margin_width, w->right_margin_width); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5017 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5018 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5019 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5020 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5021 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5022 Smooth scrolling |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5023 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5024 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5025 DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 1, 0, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5026 "Return the amount by which WINDOW is scrolled vertically.\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5027 Use the selected window if WINDOW is nil or omitted.\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5028 Value is a multiple of the canonical character height of WINDOW.") |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5029 (window) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5030 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5031 { |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5032 Lisp_Object result; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5033 struct frame *f; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5034 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5035 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5036 if (NILP (window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5037 window = selected_window; |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5038 else |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5039 CHECK_WINDOW (window, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5040 w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5041 f = XFRAME (w->frame); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5042 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5043 if (FRAME_WINDOW_P (f)) |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5044 result = CANON_Y_FROM_PIXEL_Y (f, -w->vscroll); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5045 else |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5046 result = make_number (0); |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5047 return result; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5048 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5049 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5050 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5051 DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll, |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5052 2, 2, 0, |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5053 "Set amount by which WINDOW should be scrolled vertically to VSCROLL.\n\ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5054 WINDOW nil or omitted means use the selected window. VSCROLL is a\n\ |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5055 non-negative multiple of the canonical character height of WINDOW.") |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5056 (window, vscroll) |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5057 Lisp_Object window, vscroll; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5058 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5059 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5060 struct frame *f; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5061 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5062 if (NILP (window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5063 window = selected_window; |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5064 else |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5065 CHECK_WINDOW (window, 0); |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5066 CHECK_NUMBER_OR_FLOAT (vscroll, 1); |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5067 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5068 w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5069 f = XFRAME (w->frame); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5070 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5071 if (FRAME_WINDOW_P (f)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5072 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5073 int old_dy = w->vscroll; |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5074 |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5075 w->vscroll = - CANON_Y_UNIT (f) * XFLOATINT (vscroll); |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5076 w->vscroll = min (w->vscroll, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5077 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5078 /* Adjust glyph matrix of the frame if the virtual display |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5079 area becomes larger than before. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5080 if (w->vscroll < 0 && w->vscroll < old_dy) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5081 adjust_glyphs (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5082 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5083 /* Prevent redisplay shortcuts. */ |
| 25375 | 5084 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5085 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5086 |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5087 return Fwindow_vscroll (window); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5088 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5089 |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5090 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5091 /* Call FN for all leaf windows on frame F. FN is called with the |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5092 first argument being a pointer to the leaf window, and with |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5093 additional arguments A1..A9. Stops when FN returns 0. */ |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5094 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5095 void |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5096 foreach_window (f, fn, a1, a2, a3, a4, a5, a6, a7, a8, a9) |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5097 struct frame *f; |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5098 int (* fn) (); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5099 int a1, a2, a3, a4, a5, a6, a7, a8, a9; |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5100 { |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5101 foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5102 fn, a1, a2, a3, a4, a5, a6, a7, a8, a9); |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5103 } |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5104 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5105 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5106 /* Helper function for foreach_window. Call FN for all leaf windows |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5107 reachable from W. FN is called with the first argument being a |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5108 pointer to the leaf window, and with additional arguments A1..A9. |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5109 Stop when FN returns 0. Value is 0 if stopped by FN. */ |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5110 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5111 static int |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5112 foreach_window_1 (w, fn, a1, a2, a3, a4, a5, a6, a7, a8, a9) |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5113 struct window *w; |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5114 int (* fn) (); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5115 int a1, a2, a3, a4, a5, a6, a7, a8, a9; |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5116 { |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5117 int cont; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5118 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5119 for (cont = 1; w && cont;) |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5120 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5121 if (!NILP (w->hchild)) |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5122 cont = foreach_window_1 (XWINDOW (w->hchild), |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5123 fn, a1, a2, a3, a4, a5, a6, a7, a8, a9); |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5124 else if (!NILP (w->vchild)) |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5125 cont = foreach_window_1 (XWINDOW (w->vchild), |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5126 fn, a1, a2, a3, a4, a5, a6, a7, a8, a9); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5127 else if (fn (w, a1, a2, a3, a4, a5, a6, a7, a8, a9) == 0) |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5128 cont = 0; |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5129 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5130 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5131 } |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5132 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5133 return cont; |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5134 } |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5135 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5136 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5137 /* Freeze or unfreeze the window start of W if unless it is a |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5138 mini-window or the selected window. FREEZE_P non-zero means freeze |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5139 the window start. */ |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5140 |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5141 static int |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5142 freeze_window_start (w, freeze_p) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5143 struct window *w; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5144 int freeze_p; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5145 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5146 if (w == XWINDOW (selected_window) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5147 || MINI_WINDOW_P (w) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5148 || (MINI_WINDOW_P (XWINDOW (selected_window)) |
|
28726
5f7ccec488b5
(freeze_window_start): Check that minibuffer scroll window isn't nil before
Ken Raeburn <raeburn@raeburn.org>
parents:
28505
diff
changeset
|
5149 && ! NILP (Vminibuf_scroll_window) |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5150 && w == XWINDOW (Vminibuf_scroll_window))) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5151 freeze_p = 0; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5152 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5153 w->frozen_window_start_p = freeze_p; |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5154 return 1; |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5155 } |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5156 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5157 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5158 /* Freeze or unfreeze the window starts of all leaf windows on frame |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5159 F, except the selected window and a mini-window. FREEZE_P non-zero |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5160 means freeze the window start. */ |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5161 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5162 void |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5163 freeze_window_starts (f, freeze_p) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5164 struct frame *f; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5165 int freeze_p; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5166 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5167 foreach_window (f, freeze_window_start, freeze_p); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5168 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5169 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5170 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5171 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5172 Initialization |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5173 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5174 |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5175 /* Return 1 if window configurations C1 and C2 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5176 describe the same state of affairs. This is used by Fequal. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5177 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5178 int |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5179 compare_window_configurations (c1, c2, ignore_positions) |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5180 Lisp_Object c1, c2; |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5181 int ignore_positions; |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5182 { |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5183 register struct save_window_data *d1, *d2; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5184 struct Lisp_Vector *sw1, *sw2; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5185 int i; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5186 |
|
28505
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5187 if (!WINDOW_CONFIGURATIONP (c1)) |
|
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5188 wrong_type_argument (Qwindow_configuration_p, c1); |
|
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5189 if (!WINDOW_CONFIGURATIONP (c2)) |
|
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5190 wrong_type_argument (Qwindow_configuration_p, c2); |
|
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5191 |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5192 d1 = (struct save_window_data *) XVECTOR (c1); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5193 d2 = (struct save_window_data *) XVECTOR (c2); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5194 sw1 = XVECTOR (d1->saved_windows); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5195 sw2 = XVECTOR (d2->saved_windows); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5196 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5197 if (! EQ (d1->frame_width, d2->frame_width)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5198 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5199 if (! EQ (d1->frame_height, d2->frame_height)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5200 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5201 if (! EQ (d1->frame_menu_bar_lines, d2->frame_menu_bar_lines)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5202 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5203 if (! EQ (d1->selected_frame, d2->selected_frame)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5204 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5205 /* Don't compare the current_window field directly. |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5206 Instead see w1_is_current and w2_is_current, below. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5207 if (! EQ (d1->current_buffer, d2->current_buffer)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5208 return 0; |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5209 if (! ignore_positions) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5210 if (! EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window)) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5211 return 0; |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5212 /* Don't compare the root_window field. |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5213 We don't require the two configurations |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5214 to use the same window object, |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5215 and the two root windows must be equivalent |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5216 if everything else compares equal. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5217 if (! EQ (d1->focus_frame, d2->focus_frame)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5218 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5219 if (! EQ (d1->min_width, d2->min_width)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5220 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5221 if (! EQ (d1->min_height, d2->min_height)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5222 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5223 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5224 /* Verify that the two confis have the same number of windows. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5225 if (sw1->size != sw2->size) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5226 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5227 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5228 for (i = 0; i < sw1->size; i++) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5229 { |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5230 struct saved_window *p1, *p2; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5231 int w1_is_current, w2_is_current; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5232 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5233 p1 = SAVED_WINDOW_N (sw1, i); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5234 p2 = SAVED_WINDOW_N (sw2, i); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5235 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5236 /* Verify that the current windows in the two |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5237 configurations correspond to each other. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5238 w1_is_current = EQ (d1->current_window, p1->window); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5239 w2_is_current = EQ (d2->current_window, p2->window); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5240 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5241 if (w1_is_current != w2_is_current) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5242 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5243 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5244 /* Verify that the corresponding windows do match. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5245 if (! EQ (p1->buffer, p2->buffer)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5246 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5247 if (! EQ (p1->left, p2->left)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5248 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5249 if (! EQ (p1->top, p2->top)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5250 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5251 if (! EQ (p1->width, p2->width)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5252 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5253 if (! EQ (p1->height, p2->height)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5254 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5255 if (! EQ (p1->display_table, p2->display_table)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5256 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5257 if (! EQ (p1->parent, p2->parent)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5258 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5259 if (! EQ (p1->prev, p2->prev)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5260 return 0; |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5261 if (! ignore_positions) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5262 { |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5263 if (! EQ (p1->hscroll, p2->hscroll)) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5264 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5265 if (! EQ (p1->start_at_line_beg, p2->start_at_line_beg)) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5266 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5267 if (NILP (Fequal (p1->start, p2->start))) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5268 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5269 if (NILP (Fequal (p1->pointm, p2->pointm))) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5270 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5271 if (NILP (Fequal (p1->mark, p2->mark))) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5272 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5273 } |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5274 } |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5275 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5276 return 1; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5277 } |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5278 |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5279 DEFUN ("compare-window-configurations", Fcompare_window_configurations, |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5280 Scompare_window_configurations, 2, 2, 0, |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5281 "Compare two window configurations as regards the structure of windows.\n\ |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5282 This function ignores details such as the values of point and mark\n\ |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5283 and scrolling positions.") |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5284 (x, y) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5285 Lisp_Object x, y; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5286 { |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5287 if (compare_window_configurations (x, y, 1)) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5288 return Qt; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5289 return Qnil; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5290 } |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5291 |
| 21514 | 5292 void |
| 265 | 5293 init_window_once () |
| 5294 { | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5295 struct frame *f = make_terminal_frame (); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5296 XSETFRAME (selected_frame, f); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5297 Vterminal_frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5298 minibuf_window = f->minibuffer_window; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5299 selected_window = f->selected_window; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5300 last_nonminibuf_frame = f; |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
5301 |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
5302 window_initialized = 1; |
| 265 | 5303 } |
| 5304 | |
| 21514 | 5305 void |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5306 init_window () |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5307 { |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5308 Vwindow_list = Qnil; |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5309 } |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5310 |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5311 void |
| 265 | 5312 syms_of_window () |
| 5313 { | |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5314 Qleft_bitmap_area = intern ("left-bitmap-area"); |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5315 staticpro (&Qleft_bitmap_area); |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5316 Qright_bitmap_area = intern ("right-bitmap-area"); |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5317 staticpro (&Qright_bitmap_area); |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5318 |
|
25540
2b4bdd114899
(Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents:
25517
diff
changeset
|
5319 Qwindow_size_fixed = intern ("window-size-fixed"); |
|
2b4bdd114899
(Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents:
25517
diff
changeset
|
5320 staticpro (&Qwindow_size_fixed); |
| 25268 | 5321 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5322 staticpro (&Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5323 Qwindow_configuration_change_hook |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5324 = intern ("window-configuration-change-hook"); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5325 |
| 265 | 5326 Qwindowp = intern ("windowp"); |
| 5327 staticpro (&Qwindowp); | |
| 5328 | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5329 Qwindow_configuration_p = intern ("window-configuration-p"); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5330 staticpro (&Qwindow_configuration_p); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5331 |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
5332 Qwindow_live_p = intern ("window-live-p"); |
|
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
5333 staticpro (&Qwindow_live_p); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
5334 |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
5335 Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook"); |
|
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
5336 staticpro (&Qtemp_buffer_show_hook); |
|
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
5337 |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5338 staticpro (&Vwindow_list); |
|
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5339 |
| 265 | 5340 DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, |
| 5341 "Non-nil means call as function to display a help buffer.\n\ | |
|
9696
20d9e38be33f
(Vtemp_buffer_show_function): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9624
diff
changeset
|
5342 The function is called with one argument, the buffer to be displayed.\n\ |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
5343 Used by `with-output-to-temp-buffer'.\n\ |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
5344 If this function is used, then it must do the entire job of showing\n\ |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
5345 the buffer; `temp-buffer-show-hook' is not run unless this function runs it."); |
| 265 | 5346 Vtemp_buffer_show_function = Qnil; |
| 5347 | |
| 5348 DEFVAR_LISP ("display-buffer-function", &Vdisplay_buffer_function, | |
| 5349 "If non-nil, function to call to handle `display-buffer'.\n\ | |
| 5350 It will receive two args, the buffer and a flag which if non-nil means\n\ | |
| 5351 that the currently selected window is not acceptable.\n\ | |
| 5352 Commands such as `switch-to-buffer-other-window' and `find-file-other-window'\n\ | |
| 5353 work using this function."); | |
| 5354 Vdisplay_buffer_function = Qnil; | |
| 5355 | |
| 5356 DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window, | |
| 5357 "Non-nil means it is the window that C-M-v in minibuffer should scroll."); | |
| 5358 Vminibuf_scroll_window = Qnil; | |
| 5359 | |
| 5360 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer, | |
| 5361 "If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window."); | |
| 5362 Vother_window_scroll_buffer = Qnil; | |
| 5363 | |
| 769 | 5364 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames, |
| 780 | 5365 "*Non-nil means `display-buffer' should make a separate frame."); |
| 769 | 5366 pop_up_frames = 0; |
| 265 | 5367 |
| 769 | 5368 DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function, |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5369 "Function to call to handle automatic new frame creation.\n\ |
| 769 | 5370 It is called with no arguments and should return a newly created frame.\n\ |
| 265 | 5371 \n\ |
| 769 | 5372 A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ |
| 5373 where `pop-up-frame-alist' would hold the default frame parameters."); | |
| 5374 Vpop_up_frame_function = Qnil; | |
| 265 | 5375 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5376 DEFVAR_LISP ("special-display-buffer-names", &Vspecial_display_buffer_names, |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5377 "*List of buffer names that should have their own special frames.\n\ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5378 Displaying a buffer whose name is in this list makes a special frame for it\n\ |
|
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5379 using `special-display-function'. See also `special-display-regexps'.\n\ |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
5380 \n\ |
|
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5381 An element of the list can be a list instead of just a string.\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5382 There are two ways to use a list as an element:\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5383 (BUFFER FRAME-PARAMETERS...) (BUFFER FUNCTION OTHER-ARGS...)\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5384 In the first case, FRAME-PARAMETERS are used to create the frame.\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5385 In the latter case, FUNCTION is called with BUFFER as the first argument,\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5386 followed by OTHER-ARGS--it can display BUFFER in any way it likes.\n\ |
|
19667
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5387 All this is done by the function found in `special-display-function'.\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5388 \n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5389 If this variable appears \"not to work\", because you add a name to it\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5390 but that buffer still appears in the selected window, look at the\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5391 values of `same-window-buffer-names' and `same-window-regexps'.\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5392 Those variables take precedence over this one."); |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5393 Vspecial_display_buffer_names = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5394 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5395 DEFVAR_LISP ("special-display-regexps", &Vspecial_display_regexps, |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5396 "*List of regexps saying which buffers should have their own special frames.\n\ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5397 If a buffer name matches one of these regexps, it gets its own frame.\n\ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5398 Displaying a buffer whose name is in this list makes a special frame for it\n\ |
|
8991
2a9359b721da
(display-buffer, special-display-buffer-names)
Richard M. Stallman <rms@gnu.org>
parents:
8944
diff
changeset
|
5399 using `special-display-function'.\n\ |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
5400 \n\ |
|
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5401 An element of the list can be a list instead of just a string.\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5402 There are two ways to use a list as an element:\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5403 (REGEXP FRAME-PARAMETERS...) (REGEXP FUNCTION OTHER-ARGS...)\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5404 In the first case, FRAME-PARAMETERS are used to create the frame.\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5405 In the latter case, FUNCTION is called with the buffer as first argument,\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5406 followed by OTHER-ARGS--it can display the buffer in any way it likes.\n\ |
|
19667
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5407 All this is done by the function found in `special-display-function'.\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5408 \n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5409 If this variable appears \"not to work\", because you add a regexp to it\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5410 but the matching buffers still appear in the selected window, look at the\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5411 values of `same-window-buffer-names' and `same-window-regexps'.\n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5412 Those variables take precedence over this one."); |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5413 Vspecial_display_regexps = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5414 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5415 DEFVAR_LISP ("special-display-function", &Vspecial_display_function, |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5416 "Function to call to make a new frame for a special buffer.\n\ |
|
8991
2a9359b721da
(display-buffer, special-display-buffer-names)
Richard M. Stallman <rms@gnu.org>
parents:
8944
diff
changeset
|
5417 It is called with two arguments, the buffer and optional buffer specific\n\ |
|
2a9359b721da
(display-buffer, special-display-buffer-names)
Richard M. Stallman <rms@gnu.org>
parents:
8944
diff
changeset
|
5418 data, and should return a window displaying that buffer.\n\ |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5419 The default value makes a separate frame for the buffer,\n\ |
|
9114
9853955949cf
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9105
diff
changeset
|
5420 using `special-display-frame-alist' to specify the frame parameters.\n\ |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5421 \n\ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5422 A buffer is special if its is listed in `special-display-buffer-names'\n\ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5423 or matches a regexp in `special-display-regexps'."); |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5424 Vspecial_display_function = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5425 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5426 DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names, |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5427 "*List of buffer names that should appear in the selected window.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5428 Displaying one of these buffers using `display-buffer' or `pop-to-buffer'\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5429 switches to it in the selected window, rather than making it appear\n\ |
|
11088
e88e9a016cfa
(syms_of_window): Fix missing \n\.
Karl Heuer <kwzh@gnu.org>
parents:
11003
diff
changeset
|
5430 in some other window.\n\ |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5431 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5432 An element of the list can be a cons cell instead of just a string.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5433 Then the car must be a string, which specifies the buffer name.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5434 This is for compatibility with `special-display-buffer-names';\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5435 the cdr of the cons cell is ignored.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5436 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5437 See also `same-window-regexps'."); |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5438 Vsame_window_buffer_names = Qnil; |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5439 |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5440 DEFVAR_LISP ("same-window-regexps", &Vsame_window_regexps, |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5441 "*List of regexps saying which buffers should appear in the selected window.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5442 If a buffer name matches one of these regexps, then displaying it\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5443 using `display-buffer' or `pop-to-buffer' switches to it\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5444 in the selected window, rather than making it appear in some other window.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5445 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5446 An element of the list can be a cons cell instead of just a string.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5447 Then the car must be a string, which specifies the buffer name.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5448 This is for compatibility with `special-display-buffer-names';\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5449 the cdr of the cons cell is ignored.\n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5450 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5451 See also `same-window-buffer-names'."); |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5452 Vsame_window_regexps = Qnil; |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5453 |
| 265 | 5454 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, |
| 5455 "*Non-nil means display-buffer should make new windows."); | |
| 5456 pop_up_windows = 1; | |
| 5457 | |
| 5458 DEFVAR_INT ("next-screen-context-lines", &next_screen_context_lines, | |
| 5459 "*Number of lines of continuity when scrolling by screenfuls."); | |
| 5460 next_screen_context_lines = 2; | |
| 5461 | |
| 5462 DEFVAR_INT ("split-height-threshold", &split_height_threshold, | |
| 5463 "*display-buffer would prefer to split the largest window if this large.\n\ | |
| 5464 If there is only one window, it is split regardless of this value."); | |
| 5465 split_height_threshold = 500; | |
| 5466 | |
| 5467 DEFVAR_INT ("window-min-height", &window_min_height, | |
| 5468 "*Delete any window less than this tall (including its mode line)."); | |
| 5469 window_min_height = 4; | |
| 5470 | |
| 5471 DEFVAR_INT ("window-min-width", &window_min_width, | |
| 5472 "*Delete any window less than this wide."); | |
| 5473 window_min_width = 10; | |
| 5474 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5475 DEFVAR_LISP ("scroll-preserve-screen-position", |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5476 &Vscroll_preserve_screen_position, |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
5477 "*Nonzero means scroll commands move point to keep its screen line unchanged."); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5478 Vscroll_preserve_screen_position = Qnil; |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
5479 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5480 DEFVAR_LISP ("window-configuration-change-hook", |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5481 &Vwindow_configuration_change_hook, |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5482 "Functions to call when window configuration changes.\n\ |
| 20090 | 5483 The selected frame is the one whose configuration has changed."); |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5484 Vwindow_configuration_change_hook = Qnil; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5485 |
| 265 | 5486 defsubr (&Sselected_window); |
| 5487 defsubr (&Sminibuffer_window); | |
| 5488 defsubr (&Swindow_minibuffer_p); | |
| 5489 defsubr (&Swindowp); | |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
5490 defsubr (&Swindow_live_p); |
| 265 | 5491 defsubr (&Spos_visible_in_window_p); |
| 5492 defsubr (&Swindow_buffer); | |
| 5493 defsubr (&Swindow_height); | |
| 5494 defsubr (&Swindow_width); | |
| 5495 defsubr (&Swindow_hscroll); | |
| 5496 defsubr (&Sset_window_hscroll); | |
|
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
5497 defsubr (&Swindow_redisplay_end_trigger); |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
5498 defsubr (&Sset_window_redisplay_end_trigger); |
| 265 | 5499 defsubr (&Swindow_edges); |
| 432 | 5500 defsubr (&Scoordinates_in_window_p); |
| 5501 defsubr (&Swindow_at); | |
| 265 | 5502 defsubr (&Swindow_point); |
| 5503 defsubr (&Swindow_start); | |
| 5504 defsubr (&Swindow_end); | |
| 5505 defsubr (&Sset_window_point); | |
| 5506 defsubr (&Sset_window_start); | |
| 5507 defsubr (&Swindow_dedicated_p); | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
5508 defsubr (&Sset_window_dedicated_p); |
| 265 | 5509 defsubr (&Swindow_display_table); |
| 5510 defsubr (&Sset_window_display_table); | |
| 5511 defsubr (&Snext_window); | |
| 5512 defsubr (&Sprevious_window); | |
| 5513 defsubr (&Sother_window); | |
| 5514 defsubr (&Sget_lru_window); | |
| 5515 defsubr (&Sget_largest_window); | |
| 5516 defsubr (&Sget_buffer_window); | |
| 5517 defsubr (&Sdelete_other_windows); | |
| 5518 defsubr (&Sdelete_windows_on); | |
| 5519 defsubr (&Sreplace_buffer_in_windows); | |
| 5520 defsubr (&Sdelete_window); | |
| 5521 defsubr (&Sset_window_buffer); | |
| 5522 defsubr (&Sselect_window); | |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
5523 defsubr (&Sspecial_display_p); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
5524 defsubr (&Ssame_window_p); |
| 265 | 5525 defsubr (&Sdisplay_buffer); |
| 5526 defsubr (&Ssplit_window); | |
| 5527 defsubr (&Senlarge_window); | |
| 5528 defsubr (&Sshrink_window); | |
| 5529 defsubr (&Sscroll_up); | |
| 5530 defsubr (&Sscroll_down); | |
| 5531 defsubr (&Sscroll_left); | |
| 5532 defsubr (&Sscroll_right); | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
5533 defsubr (&Sother_window_for_scrolling); |
| 265 | 5534 defsubr (&Sscroll_other_window); |
| 5535 defsubr (&Srecenter); | |
| 5536 defsubr (&Smove_to_window_line); | |
| 5537 defsubr (&Swindow_configuration_p); | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5538 defsubr (&Swindow_configuration_frame); |
| 265 | 5539 defsubr (&Sset_window_configuration); |
| 5540 defsubr (&Scurrent_window_configuration); | |
| 5541 defsubr (&Ssave_window_excursion); | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5542 defsubr (&Sset_window_margins); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5543 defsubr (&Swindow_margins); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5544 defsubr (&Swindow_vscroll); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5545 defsubr (&Sset_window_vscroll); |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5546 defsubr (&Scompare_window_configurations); |
|
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5547 defsubr (&Swindow_list); |
| 265 | 5548 } |
| 5549 | |
| 21514 | 5550 void |
| 265 | 5551 keys_of_window () |
| 5552 { | |
| 5553 initial_define_key (control_x_map, '1', "delete-other-windows"); | |
| 5554 initial_define_key (control_x_map, '2', "split-window"); | |
| 5555 initial_define_key (control_x_map, '0', "delete-window"); | |
| 5556 initial_define_key (control_x_map, 'o', "other-window"); | |
| 5557 initial_define_key (control_x_map, '^', "enlarge-window"); | |
| 5558 initial_define_key (control_x_map, '<', "scroll-left"); | |
| 5559 initial_define_key (control_x_map, '>', "scroll-right"); | |
| 5560 | |
| 5561 initial_define_key (global_map, Ctl ('V'), "scroll-up"); | |
| 5562 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); | |
| 5563 initial_define_key (meta_map, 'v', "scroll-down"); | |
| 5564 | |
| 5565 initial_define_key (global_map, Ctl('L'), "recenter"); | |
| 5566 initial_define_key (meta_map, 'r', "move-to-window-line"); | |
| 5567 } |
