Mercurial > emacs
annotate src/window.c @ 34487:5cdf7acaeb2d
Add obsolete.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 12 Dec 2000 15:11:04 +0000 |
parents | fef41c786c7a |
children | f9d400d4653a |
rev | line source |
---|---|
265 | 1 /* Window creation, deletion and examination for GNU Emacs. |
2 Does not include redisplay. | |
34261
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
3 Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000 |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
4 Free Software Foundation, Inc. |
265 | 5 |
6 This file is part of GNU Emacs. | |
7 | |
8 GNU Emacs is free software; you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
708 | 10 the Free Software Foundation; either version 2, or (at your option) |
265 | 11 any later version. |
12 | |
13 GNU Emacs is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 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
|
20 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
|
21 Boston, MA 02111-1307, USA. */ |
265 | 22 |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4570
diff
changeset
|
23 #include <config.h> |
265 | 24 #include "lisp.h" |
25 #include "buffer.h" | |
31117
f390b90e3495
Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents:
30777
diff
changeset
|
26 #include "keyboard.h" |
769 | 27 #include "frame.h" |
265 | 28 #include "window.h" |
29 #include "commands.h" | |
30 #include "indent.h" | |
31 #include "termchar.h" | |
32 #include "disptab.h" | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
33 #include "dispextern.h" |
18657 | 34 #include "blockinput.h" |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
35 #include "intervals.h" |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
36 |
21825
697991d2a2c4
Conditionally include xterm.h using HAVE_X_WINDOWS.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21533
diff
changeset
|
37 #ifdef HAVE_X_WINDOWS |
21514 | 38 #include "xterm.h" |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
39 #endif /* HAVE_X_WINDOWS */ |
27633
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
40 #ifdef WINDOWSNT |
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
41 #include "w32term.h" |
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
42 #endif |
27956
8d38dbe58989
[MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents:
27869
diff
changeset
|
43 #ifdef MSDOS |
8d38dbe58989
[MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents:
27869
diff
changeset
|
44 #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
|
45 #endif |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32710
diff
changeset
|
46 #ifdef macintosh |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32710
diff
changeset
|
47 #include "macterm.h" |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32710
diff
changeset
|
48 #endif |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
49 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
50 #ifndef max |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
51 #define max(a, b) ((a) < (b) ? (b) : (a)) |
21514 | 52 #endif |
265 | 53 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
54 |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
55 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
|
56 Lisp_Object Qwindow_size_fixed, Qleft_bitmap_area, Qright_bitmap_area; |
25268 | 57 extern Lisp_Object Qheight, Qwidth; |
265 | 58 |
20351 | 59 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
|
60 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
|
61 static int count_windows P_ ((struct window *)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
62 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
|
63 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
|
64 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
|
65 static void window_scroll_line_based P_ ((Lisp_Object, int, int, int)); |
25268 | 66 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
|
67 static int window_min_size P_ ((struct window *, int, int, int *)); |
25268 | 68 static void size_window P_ ((Lisp_Object, int, int, int)); |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
69 static int freeze_window_start P_ ((struct window *, void *)); |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
70 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
|
71 static void enlarge_window P_ ((Lisp_Object, int, int)); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
72 static Lisp_Object window_list P_ ((void)); |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
73 static int add_window_to_list P_ ((struct window *, void *)); |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
74 static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
75 Lisp_Object)); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
76 static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object, |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
77 Lisp_Object, int)); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
78 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
|
79 Lisp_Object *)); |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
80 static int foreach_window_1 P_ ((struct window *, |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
81 int (* fn) (struct window *, void *), |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
82 void *)); |
33619
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
83 static Lisp_Object window_list_1 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
84 |
265 | 85 /* This is the window in which the terminal's cursor should |
86 be left when nothing is being done with it. This must | |
87 always be a leaf window, and its buffer is selected by | |
88 the top level editing loop at the end of each command. | |
89 | |
90 This value is always the same as | |
769 | 91 FRAME_SELECTED_WINDOW (selected_frame). */ |
265 | 92 |
93 Lisp_Object selected_window; | |
94 | |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
95 /* 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
|
96 Functions creating or deleting windows should invalidate this cache |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
97 by setting it to nil. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
98 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
99 Lisp_Object Vwindow_list; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
100 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
101 /* The mini-buffer window of the selected frame. |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
102 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
|
103 by comparing against this; but you can test for mini-bufferness of |
265 | 104 the selected window. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
105 |
265 | 106 Lisp_Object minibuf_window; |
107 | |
108 /* 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
|
109 when the mini-buffer is selected. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
110 |
265 | 111 Lisp_Object Vminibuf_scroll_window; |
112 | |
113 /* 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
|
114 |
265 | 115 Lisp_Object Vother_window_scroll_buffer; |
116 | |
117 /* 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
|
118 |
265 | 119 Lisp_Object Vtemp_buffer_show_function; |
120 | |
121 /* 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
|
122 |
265 | 123 int window_min_height; |
124 int window_min_width; | |
125 | |
126 /* Nonzero implies Fdisplay_buffer should create windows. */ | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
127 |
265 | 128 int pop_up_windows; |
129 | |
769 | 130 /* Nonzero implies make new frames for Fdisplay_buffer. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
131 |
769 | 132 int pop_up_frames; |
265 | 133 |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
134 /* Nonzero means reuse existing frames for displaying buffers. */ |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
135 |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
136 int display_buffer_reuse_frames; |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
137 |
265 | 138 /* 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
|
139 |
769 | 140 Lisp_Object Vpop_up_frame_function; |
265 | 141 |
142 /* Function to call to handle Fdisplay_buffer. */ | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
143 |
265 | 144 Lisp_Object Vdisplay_buffer_function; |
145 | |
34261
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
146 /* Non-nil means that Fdisplay_buffer should even the heights of windows. */ |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
147 |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
148 Lisp_Object Veven_window_heights; |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
149 |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
150 /* 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
|
151 |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
152 Lisp_Object Vspecial_display_buffer_names; |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
153 |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
154 /* 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
|
155 |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
156 Lisp_Object Vspecial_display_regexps; |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
157 |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
158 /* Function to pop up a special frame. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
159 |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
160 Lisp_Object Vspecial_display_function; |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
161 |
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
162 /* 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
|
163 |
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
164 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
|
165 |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
166 /* 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
|
167 |
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
168 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
|
169 |
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
170 /* 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
|
171 |
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
172 Lisp_Object Qtemp_buffer_show_hook; |
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
173 |
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
174 /* Fdisplay_buffer always splits the largest window |
265 | 175 if that window is more than this high. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
176 |
265 | 177 int split_height_threshold; |
178 | |
179 /* 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
|
180 |
265 | 181 int next_screen_context_lines; |
182 | |
183 /* Incremented for each window created. */ | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
184 |
265 | 185 static int sequence_number; |
186 | |
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
187 /* Nonzero after init_window_once has finished. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
188 |
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
189 static int window_initialized; |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
190 |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
191 /* Hook to run when window config changes. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
192 |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
193 Lisp_Object Qwindow_configuration_change_hook; |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
194 Lisp_Object Vwindow_configuration_change_hook; |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
195 |
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
196 /* 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
|
197 at the same screen height as previously. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
198 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
199 Lisp_Object Vscroll_preserve_screen_position; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
200 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
201 #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
|
202 /* 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
|
203 static int inhibit_frame_unsplittable; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
204 #endif /* 0 */ |
17540
eb82c4de9dea
(frame_allow_splitting): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17365
diff
changeset
|
205 |
265 | 206 #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
|
207 |
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
208 extern int scroll_margin; |
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
209 |
14149
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
210 extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; |
265 | 211 |
212 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
|
213 "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
|
214 (object) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
215 Lisp_Object object; |
265 | 216 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
217 return WINDOWP (object) ? Qt : Qnil; |
265 | 218 } |
219 | |
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
220 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
|
221 "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
|
222 (object) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
223 Lisp_Object object; |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
224 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
225 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
|
226 } |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
227 |
265 | 228 Lisp_Object |
229 make_window () | |
230 { | |
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
231 Lisp_Object val; |
265 | 232 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
|
233 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
|
234 int i; |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
235 |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
236 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
|
237 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
|
238 vec->contents[i] = Qnil; |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
239 vec->size = VECSIZE (struct window); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
240 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
|
241 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 XSETFASTINT (p->hscroll, 0); |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
247 p->orig_top = p->orig_height = Qnil; |
265 | 248 p->start = Fmake_marker (); |
249 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
|
250 XSETFASTINT (p->use_time, 0); |
769 | 251 p->frame = Qnil; |
265 | 252 p->display_table = Qnil; |
253 p->dedicated = Qnil; | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
254 p->pseudo_window_p = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
255 bzero (&p->cursor, sizeof (p->cursor)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
256 bzero (&p->last_cursor, sizeof (p->last_cursor)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
257 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
258 p->desired_matrix = p->current_matrix = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
259 p->phys_cursor_type = -1; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
260 p->must_be_updated_p = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
261 XSETFASTINT (p->window_end_vpos, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
262 XSETFASTINT (p->window_end_pos, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
263 p->window_end_valid = Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
264 p->vscroll = 0; |
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
265 XSETWINDOW (val, p); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
266 XSETFASTINT (p->last_point, 0); |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
267 p->frozen_window_start_p = 0; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
268 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
269 Vwindow_list = Qnil; |
265 | 270 return val; |
271 } | |
272 | |
273 DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, | |
274 "Return the window that the cursor now appears in and commands apply to.") | |
275 () | |
276 { | |
277 return selected_window; | |
278 } | |
279 | |
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
280 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
|
281 "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
|
282 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
|
283 used by that frame.") |
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
284 (frame) |
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
285 Lisp_Object frame; |
265 | 286 { |
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
287 if (NILP (frame)) |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
288 frame = selected_frame; |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
289 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
|
290 return FRAME_MINIBUF_WINDOW (XFRAME (frame)); |
265 | 291 } |
292 | |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
293 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, |
265 | 294 "Returns non-nil if WINDOW is a minibuffer window.") |
295 (window) | |
296 Lisp_Object window; | |
297 { | |
298 struct window *w = decode_window (window); | |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
299 return MINI_WINDOW_P (w) ? Qt : Qnil; |
32710
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
300 } |
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
301 |
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
302 |
265 | 303 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, |
32710
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
304 Spos_visible_in_window_p, 0, 3, 0, |
769 | 305 "Return t if position POS is currently on the frame in WINDOW.\n\ |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
306 Return nil if that position is scrolled vertically out of view.\n\ |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
307 If a character is only partially visible, nil is returned, unless the\n\ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
308 optional argument PARTIALLY is non-nil.\n\ |
32937 | 309 POS defaults to point in WINDOW; WINDOW defaults to the selected window.") |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
310 (pos, window, partially) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
311 Lisp_Object pos, window, partially; |
265 | 312 { |
313 register struct window *w; | |
314 register int posint; | |
315 register struct buffer *buf; | |
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
316 struct text_pos top; |
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
317 Lisp_Object in_window; |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
318 int fully_p; |
265 | 319 |
32937 | 320 w = decode_window (window); |
321 buf = XBUFFER (w->buffer); | |
322 SET_TEXT_POS_FROM_MARKER (top, w->start); | |
323 | |
324 if (!NILP (pos)) | |
265 | 325 { |
326 CHECK_NUMBER_COERCE_MARKER (pos, 0); | |
327 posint = XINT (pos); | |
328 } | |
32937 | 329 else if (w == XWINDOW (selected_window)) |
330 posint = PT; | |
331 else | |
332 posint = XMARKER (w->pointm)->charpos; | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
333 |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
334 /* If position is above window start, it's not visible. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
335 if (posint < CHARPOS (top)) |
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
336 in_window = Qnil; |
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
337 else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) |
32710
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
338 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf) |
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
339 && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) |
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
340 { |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
341 /* If frame is up-to-date, and POSINT is < window end pos, use |
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
342 that info. This doesn't work for POSINT == end pos, because |
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
343 the window end pos is actually the position _after_ the last |
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
344 char in the window. */ |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
345 if (NILP (partially)) |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
346 { |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
347 pos_visible_p (w, posint, &fully_p, NILP (partially)); |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
348 in_window = fully_p ? Qt : Qnil; |
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
349 } |
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
350 else |
32710
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
351 in_window = Qt; |
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
352 } |
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
353 else if (posint > BUF_ZV (buf)) |
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
354 in_window = Qnil; |
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
355 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
|
356 /* 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
|
357 in_window = Qnil; |
265 | 358 else |
359 { | |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
360 if (pos_visible_p (w, posint, &fully_p, NILP (partially))) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
361 in_window = !NILP (partially) || fully_p ? Qt : Qnil; |
32710
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
362 else |
cd7dca826a03
(pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents:
32426
diff
changeset
|
363 in_window = Qnil; |
265 | 364 } |
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
365 |
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
366 return in_window; |
265 | 367 } |
32871
361743be1fa8
(pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
32824
diff
changeset
|
368 |
265 | 369 |
370 static struct window * | |
371 decode_window (window) | |
372 register Lisp_Object window; | |
373 { | |
485 | 374 if (NILP (window)) |
265 | 375 return XWINDOW (selected_window); |
376 | |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
377 CHECK_LIVE_WINDOW (window, 0); |
265 | 378 return XWINDOW (window); |
379 } | |
380 | |
381 DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, | |
382 "Return the buffer that WINDOW is displaying.") | |
383 (window) | |
384 Lisp_Object window; | |
385 { | |
386 return decode_window (window)->buffer; | |
387 } | |
388 | |
389 DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, | |
390 "Return the number of lines in WINDOW (including its mode line).") | |
391 (window) | |
392 Lisp_Object window; | |
393 { | |
394 return decode_window (window)->height; | |
395 } | |
396 | |
397 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
|
398 "Return the number of display columns in WINDOW.\n\ |
ed4b06e1975b
(Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6232
diff
changeset
|
399 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
|
400 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
|
401 use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))).") |
265 | 402 (window) |
403 Lisp_Object window; | |
404 { | |
6576
851ee89bae86
(Fwindow_width): Delete unnecessary variable declarations.
Karl Heuer <kwzh@gnu.org>
parents:
6517
diff
changeset
|
405 return make_number (window_internal_width (decode_window (window))); |
265 | 406 } |
407 | |
408 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |
409 "Return the number of columns by which WINDOW is scrolled from left margin.") | |
410 (window) | |
411 Lisp_Object window; | |
412 { | |
413 return decode_window (window)->hscroll; | |
414 } | |
415 | |
416 DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | |
417 "Set number of columns WINDOW is scrolled from left margin to NCOL.\n\ | |
418 NCOL should be zero or positive.") | |
419 (window, ncol) | |
420 register Lisp_Object window, ncol; | |
421 { | |
422 register struct window *w; | |
423 | |
424 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
|
425 if (XINT (ncol) < 0) XSETFASTINT (ncol, 0); |
265 | 426 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
|
427 if (XINT (w->hscroll) != XINT (ncol)) |
25375 | 428 /* Prevent redisplay shortcuts */ |
429 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | |
265 | 430 w->hscroll = ncol; |
431 return ncol; | |
432 } | |
433 | |
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
434 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
|
435 Swindow_redisplay_end_trigger, 0, 1, 0, |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
436 "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
|
437 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
|
438 (window) |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
439 Lisp_Object window; |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
440 { |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
441 return decode_window (window)->redisplay_end_trigger; |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
442 } |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
443 |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
444 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
|
445 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
|
446 "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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 (window, value) |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
453 register Lisp_Object window, value; |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
454 { |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
455 register struct window *w; |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
456 |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
457 w = decode_window (window); |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
458 w->redisplay_end_trigger = value; |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
459 return value; |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
460 } |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
461 |
265 | 462 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, |
463 "Return a list of the edge coordinates of WINDOW.\n\ | |
769 | 464 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame.\n\ |
265 | 465 RIGHT is one more than the rightmost column used by WINDOW,\n\ |
466 and BOTTOM is one more than the bottommost row used by WINDOW\n\ | |
467 and its mode-line.") | |
468 (window) | |
469 Lisp_Object window; | |
470 { | |
471 register struct window *w = decode_window (window); | |
472 | |
473 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
|
474 Fcons (make_number (WINDOW_RIGHT_EDGE (w)), |
265 | 475 Fcons (make_number (XFASTINT (w->top) |
476 + XFASTINT (w->height)), | |
477 Qnil)))); | |
478 } | |
479 | |
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
480 /* Test if the character at column *X, row *Y is within window W. |
432 | 481 If it is not, return 0; |
482 if it is in the window's text area, | |
483 set *x and *y to its location relative to the upper left corner | |
484 of the window, and | |
485 return 1; | |
486 if it is on the window's modeline, return 2; | |
487 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
|
488 return 3. |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
489 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
|
490 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
|
491 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
|
492 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
493 X and Y are frame relative pixel coordinates. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
494 |
432 | 495 static int |
496 coordinates_in_window (w, x, y) | |
497 register struct window *w; | |
498 register int *x, *y; | |
499 { | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
500 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
501 int left_x, right_x, top_y, bottom_y; |
25462
19b101d6ee2a
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
25402
diff
changeset
|
502 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
|
503 |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
504 /* Let's make this a global enum later, instead of using numbers |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
505 everywhere. */ |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
506 enum {ON_NOTHING, ON_TEXT, ON_MODE_LINE, ON_VERTICAL_BORDER, |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
507 ON_HEADER_LINE, ON_LEFT_FRINGE, ON_RIGHT_FRINGE}; |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
508 |
28918
e42cd428f056
(coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents:
28726
diff
changeset
|
509 /* 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
|
510 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
|
511 if (w->pseudo_window_p) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
512 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
513 left_x = 0; |
28918
e42cd428f056
(coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents:
28726
diff
changeset
|
514 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
|
515 top_y = WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
516 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
517 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
518 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
519 { |
27850
3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents:
27848
diff
changeset
|
520 left_x = (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w) |
28004
7e296e4ec801
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
27956
diff
changeset
|
521 - 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
|
522 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
|
523 top_y = (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w) |
28004
7e296e4ec801
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
27956
diff
changeset
|
524 - FRAME_INTERNAL_BORDER_WIDTH_SAFE (f)); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
525 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
526 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
527 |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
528 /* On the mode line or header line? If it's near the start of |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
529 the mode or header line of window that's has a horizontal |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
530 sibling, say it's on the vertical line. That's to be able |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
531 to resize windows horizontally in case we're using toolkit |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
532 scroll bars. */ |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
533 |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
534 if (WINDOW_WANTS_MODELINE_P (w) |
34277
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
535 && *y < bottom_y |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
536 && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
537 { |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
538 if (!WINDOW_RIGHTMOST_P (w) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
539 && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width)) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
540 * CANON_X_UNIT (f))) |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
541 < CANON_X_UNIT (f) / 2)) |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
542 return ON_VERTICAL_BORDER; |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
543 return ON_MODE_LINE; |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
544 } |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
545 |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
546 if (WINDOW_WANTS_HEADER_LINE_P (w) |
34277
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
547 && *y >= top_y |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
548 && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
549 { |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
550 if (!WINDOW_RIGHTMOST_P (w) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
551 && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width)) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
552 * CANON_X_UNIT (f))) |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
553 < CANON_X_UNIT (f) / 2)) |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
554 return ON_VERTICAL_BORDER; |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
555 return ON_HEADER_LINE; |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
556 } |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
557 |
34277
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
558 /* Completely outside anything interesting? */ |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
559 if (*y < top_y |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
560 || *y >= bottom_y |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
561 || *x < (left_x |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
562 - flags_area_width |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
563 - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
564 * CANON_X_UNIT (f))) |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
565 || *x > right_x + flags_area_width) |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
566 return ON_NOTHING; |
a97360f46398
(coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents:
34265
diff
changeset
|
567 |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
568 if (FRAME_WINDOW_P (f)) |
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
569 { |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
570 if (!w->pseudo_window_p |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
571 && !FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
572 && !WINDOW_RIGHTMOST_P (w) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
573 && (abs (*x - right_x - flags_area_width) < CANON_X_UNIT (f) / 2)) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
574 return ON_VERTICAL_BORDER; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
575 |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
576 if (*x < left_x || *x > right_x) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
577 { |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
578 /* Other lines than the mode line don't include flags areas and |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
579 scroll bars on the left. */ |
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
580 |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
581 /* Convert X and Y to window-relative pixel coordinates. */ |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
582 *x -= left_x; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
583 *y -= top_y; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
584 return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
585 } |
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
586 } |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
587 else |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
588 { |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
589 /* Need to say "*x > right_x" rather than >=, since on character |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
590 terminals, the vertical line's x coordinate is right_x. */ |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
591 if (*x < left_x || *x > right_x) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
592 { |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
593 /* Other lines than the mode line don't include flags areas and |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
594 scroll bars on the left. */ |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
595 |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
596 /* Convert X and Y to window-relative pixel coordinates. */ |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
597 *x -= left_x; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
598 *y -= top_y; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
599 return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
600 } |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
601 |
34097
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
602 /* Here, too, "*x > right_x" is because of character terminals. */ |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
603 if (!w->pseudo_window_p |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
604 && !WINDOW_RIGHTMOST_P (w) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
605 && *x > right_x - CANON_X_UNIT (f)) |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
606 /* On the border on the right side of the window? Assume that |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
607 this area begins at RIGHT_X minus a canonical char width. */ |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
608 return ON_VERTICAL_BORDER; |
0225d8e15f2c
(coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents:
34090
diff
changeset
|
609 } |
33957
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
610 |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
611 /* Convert X and Y to window-relative pixel coordinates. */ |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
612 *x -= left_x; |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
613 *y -= top_y; |
1436ae066de4
(coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents:
33619
diff
changeset
|
614 return ON_TEXT; |
432 | 615 } |
616 | |
617 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, | |
618 Scoordinates_in_window_p, 2, 2, 0, | |
619 "Return non-nil if COORDINATES are in WINDOW.\n\ | |
708 | 620 COORDINATES is a cons of the form (X . Y), X and Y being distances\n\ |
769 | 621 measured in characters from the upper-left corner of the frame.\n\ |
708 | 622 (0 . 0) denotes the character in the upper left corner of the\n\ |
769 | 623 frame.\n\ |
432 | 624 If COORDINATES are in the text portion of WINDOW,\n\ |
625 the coordinates relative to the window are returned.\n\ | |
732 | 626 If they are in the mode line of WINDOW, `mode-line' is returned.\n\ |
25546 | 627 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
|
628 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
|
629 `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
|
630 the window, `right-bitmap-area' is returned.\n\ |
432 | 631 If they are on the border between WINDOW and its right sibling,\n\ |
732 | 632 `vertical-line' is returned.") |
432 | 633 (coordinates, window) |
634 register Lisp_Object coordinates, window; | |
635 { | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
636 struct window *w; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
637 struct frame *f; |
432 | 638 int x, y; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
639 Lisp_Object lx, ly; |
432 | 640 |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
641 CHECK_LIVE_WINDOW (window, 0); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
642 w = XWINDOW (window); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
643 f = XFRAME (w->frame); |
432 | 644 CHECK_CONS (coordinates, 1); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
645 lx = Fcar (coordinates); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
646 ly = Fcdr (coordinates); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
647 CHECK_NUMBER_OR_FLOAT (lx, 1); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
648 CHECK_NUMBER_OR_FLOAT (ly, 1); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
649 x = PIXEL_X_FROM_CANON_X (f, lx); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
650 y = PIXEL_Y_FROM_CANON_Y (f, ly); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
651 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
652 switch (coordinates_in_window (w, &x, &y)) |
432 | 653 { |
654 case 0: /* NOT in window at all. */ | |
655 return Qnil; | |
656 | |
657 case 1: /* In text part of window. */ | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
658 /* X and Y are now window relative pixel coordinates. |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
659 Convert them to canonical char units before returning |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
660 them. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
661 return Fcons (CANON_X_FROM_PIXEL_X (f, x), |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
662 CANON_Y_FROM_PIXEL_Y (f, y)); |
432 | 663 |
664 case 2: /* In mode line of window. */ | |
665 return Qmode_line; | |
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
666 |
432 | 667 case 3: /* On right border of window. */ |
732 | 668 return Qvertical_line; |
432 | 669 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
670 case 4: |
25546 | 671 return Qheader_line; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
672 |
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
673 case 5: |
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
674 return Qleft_bitmap_area; |
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
675 |
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
676 case 6: |
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
677 return Qright_bitmap_area; |
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
678 |
432 | 679 default: |
680 abort (); | |
681 } | |
682 } | |
683 | |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
684 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
685 /* Callback for foreach_window, used in window_from_coordinates. |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
686 Check if window W contains coordinates specified by USER_DATA which |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
687 is actually a pointer to a struct check_window_data CW. |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
688 |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
689 Check if window W contains coordinates *CW->x and *CW->y. If it |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
690 does, return W in *CW->window, as Lisp_Object, and return in |
30777 | 691 *CW->part the part of the window under coordinates *X,*Y. Return |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
692 zero from this function to stop iterating over windows. */ |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
693 |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
694 struct check_window_data |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
695 { |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
696 Lisp_Object *window; |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
697 int *x, *y, *part; |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
698 }; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
699 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
700 static int |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
701 check_window_containing (w, user_data) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
702 struct window *w; |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
703 void *user_data; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
704 { |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
705 struct check_window_data *cw = (struct check_window_data *) user_data; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
706 int found; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
707 |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
708 found = coordinates_in_window (w, cw->x, cw->y); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
709 if (found) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
710 { |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
711 *cw->part = found - 1; |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
712 XSETWINDOW (*cw->window, w); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
713 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
714 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
715 return !found; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
716 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
717 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
718 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
719 /* 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
|
720 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
|
721 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
|
722 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
|
723 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
|
724 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
|
725 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
726 This function was previously implemented with a loop cycling over |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
727 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
|
728 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
|
729 implementation of next_window using Vwindow_list, because |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
730 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
|
731 tree of F when this function is called asynchronously from |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
732 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
|
733 case. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
734 |
265 | 735 Lisp_Object |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
736 window_from_coordinates (f, x, y, part, tool_bar_p) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
737 struct frame *f; |
265 | 738 int x, y; |
432 | 739 int *part; |
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
740 int tool_bar_p; |
265 | 741 { |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
742 Lisp_Object window; |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
743 struct check_window_data cw; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
744 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
745 window = Qnil; |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
746 cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part; |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
747 foreach_window (f, check_window_containing, &cw); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
748 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
749 /* 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
|
750 bar exists. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
751 if (NILP (window) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
752 && tool_bar_p |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
753 && WINDOWP (f->tool_bar_window) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
754 && XINT (XWINDOW (f->tool_bar_window)->height) > 0 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
755 && 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
|
756 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
757 *part = 0; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
758 window = f->tool_bar_window; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
759 } |
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
760 |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
761 return window; |
265 | 762 } |
763 | |
681
026f978690be
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
555
diff
changeset
|
764 DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, |
1798 | 765 "Return window containing coordinates X and Y on FRAME.\n\ |
769 | 766 If omitted, FRAME defaults to the currently selected frame.\n\ |
767 The top left corner of the frame is considered to be row 0,\n\ | |
548 | 768 column 0.") |
1798 | 769 (x, y, frame) |
770 Lisp_Object x, y, frame; | |
265 | 771 { |
772 int part; | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
773 struct frame *f; |
265 | 774 |
769 | 775 if (NILP (frame)) |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
776 frame = selected_frame; |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
777 CHECK_LIVE_FRAME (frame, 2); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
778 f = XFRAME (frame); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
779 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
780 /* Check that arguments are integers or floats. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
781 CHECK_NUMBER_OR_FLOAT (x, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
782 CHECK_NUMBER_OR_FLOAT (y, 1); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
783 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
784 return window_from_coordinates (f, |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
785 PIXEL_X_FROM_CANON_X (f, x), |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
786 PIXEL_Y_FROM_CANON_Y (f, y), |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
787 &part, 0); |
265 | 788 } |
789 | |
790 DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | |
791 "Return current value of point in WINDOW.\n\ | |
792 For a nonselected window, this is the value point would have\n\ | |
793 if that window were selected.\n\ | |
794 \n\ | |
795 Note that, when WINDOW is the selected window and its buffer\n\ | |
796 is also currently selected, the value returned is the same as (point).\n\ | |
797 It would be more strictly correct to return the `top-level' value\n\ | |
798 of point, outside of any save-excursion forms.\n\ | |
799 But that is hard to define.") | |
800 (window) | |
801 Lisp_Object window; | |
802 { | |
803 register struct window *w = decode_window (window); | |
804 | |
805 if (w == XWINDOW (selected_window) | |
806 && current_buffer == XBUFFER (w->buffer)) | |
807 return Fpoint (); | |
808 return Fmarker_position (w->pointm); | |
809 } | |
810 | |
811 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
|
812 "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
|
813 This is updated by redisplay or by calling `set-window-start'.") |
265 | 814 (window) |
815 Lisp_Object window; | |
816 { | |
817 return Fmarker_position (decode_window (window)->start); | |
818 } | |
819 | |
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
820 /* 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
|
821 |
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
822 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
|
823 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
|
824 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
|
825 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
|
826 (save-excursion\n\ |
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
827 (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
|
828 (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
|
829 (point))") */ |
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
830 |
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
831 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
|
832 "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
|
833 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
|
834 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
|
835 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
|
836 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
|
837 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
|
838 (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
|
839 Lisp_Object window, update; |
265 | 840 { |
841 Lisp_Object value; | |
842 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
|
843 Lisp_Object buf; |
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
844 |
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
845 buf = w->buffer; |
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
846 CHECK_BUFFER (buf, 0); |
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
847 |
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
848 #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
|
849 /* 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
|
850 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
|
851 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
|
852 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
|
853 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
|
854 return Qnil; |
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
855 #endif |
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
856 |
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
857 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
|
858 && ! (! 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
|
859 && 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
|
860 { |
30743
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
861 struct text_pos startp; |
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
862 struct it it; |
26635
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
863 |
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
864 /* 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
|
865 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
|
866 `-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
|
867 commands. At the end, W->start happened to be BEG, while |
30743
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
868 rmail had already narrowed the buffer. */ |
26635
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
869 if (XMARKER (w->start)->charpos < BEGV) |
30743
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
870 SET_TEXT_POS (startp, BEGV, BEGV_BYTE); |
26635
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
871 else if (XMARKER (w->start)->charpos > ZV) |
30743
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
872 SET_TEXT_POS (startp, ZV, ZV_BYTE); |
26635
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
873 else |
30743
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
874 SET_TEXT_POS_FROM_MARKER (startp, w->start); |
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
875 |
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
876 /* Cannot use Fvertical_motion because that function doesn't |
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
877 cope with variable-height lines. */ |
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
878 start_display (&it, w, startp); |
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
879 move_it_vertically (&it, window_box_height (w)); |
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
880 value = make_number (IT_CHARPOS (it)); |
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
881 } |
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
882 else |
30743
51d0f4273e89
(Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents:
30560
diff
changeset
|
883 XSETINT (value, BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); |
265 | 884 |
885 return value; | |
886 } | |
887 | |
888 DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, | |
889 "Make point value in WINDOW be at position POS in WINDOW's buffer.") | |
890 (window, pos) | |
891 Lisp_Object window, pos; | |
892 { | |
893 register struct window *w = decode_window (window); | |
894 | |
895 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
|
896 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
|
897 && XBUFFER (w->buffer) == current_buffer) |
265 | 898 Fgoto_char (pos); |
899 else | |
900 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
|
901 |
265 | 902 return pos; |
903 } | |
904 | |
905 DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, | |
906 "Make display in WINDOW start at position POS in WINDOW's buffer.\n\ | |
907 Optional third arg NOFORCE non-nil inhibits next redisplay\n\ | |
908 from overriding motion of point in order to display at this exact start.") | |
909 (window, pos, noforce) | |
910 Lisp_Object window, pos, noforce; | |
911 { | |
912 register struct window *w = decode_window (window); | |
913 | |
914 CHECK_NUMBER_COERCE_MARKER (pos, 1); | |
915 set_marker_restricted (w->start, pos, w->buffer); | |
916 /* this is not right, but much easier than doing what is right. */ | |
917 w->start_at_line_beg = Qnil; | |
485 | 918 if (NILP (noforce)) |
265 | 919 w->force_start = Qt; |
920 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
|
921 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
|
922 XSETFASTINT (w->last_overlay_modified, 0); |
338 | 923 if (!EQ (window, selected_window)) |
924 windows_or_buffers_changed++; | |
25387
df0083768b79
(Fset_window_point): Reset Vresize_mini_config.
Gerd Moellmann <gerd@gnu.org>
parents:
25375
diff
changeset
|
925 |
265 | 926 return pos; |
927 } | |
928 | |
929 DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | |
930 1, 1, 0, | |
931 "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
|
932 See also `set-window-dedicated-p'.") |
265 | 933 (window) |
934 Lisp_Object window; | |
935 { | |
936 return decode_window (window)->dedicated; | |
937 } | |
938 | |
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
939 DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, |
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
940 Sset_window_dedicated_p, 2, 2, 0, |
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
941 "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
|
942 If it is dedicated, Emacs will not automatically change\n\ |
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
943 which buffer appears in it.\n\ |
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
944 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
|
945 non-nil means yes.") |
265 | 946 (window, arg) |
947 Lisp_Object window, arg; | |
948 { | |
949 register struct window *w = decode_window (window); | |
950 | |
485 | 951 if (NILP (arg)) |
265 | 952 w->dedicated = Qnil; |
953 else | |
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
954 w->dedicated = Qt; |
265 | 955 |
956 return w->dedicated; | |
957 } | |
958 | |
959 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, | |
960 0, 1, 0, | |
961 "Return the display-table that WINDOW is using.") | |
962 (window) | |
963 Lisp_Object window; | |
964 { | |
965 return decode_window (window)->display_table; | |
966 } | |
967 | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
968 /* 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
|
969 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
|
970 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
|
971 return 0. */ |
265 | 972 |
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
973 struct Lisp_Char_Table * |
265 | 974 window_display_table (w) |
975 struct window *w; | |
976 { | |
30446
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
977 struct Lisp_Char_Table *dp = NULL; |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
978 |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
979 if (DISP_TABLE_P (w->display_table)) |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
980 dp = XCHAR_TABLE (w->display_table); |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
981 else if (BUFFERP (w->buffer)) |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
982 { |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
983 struct buffer *b = XBUFFER (w->buffer); |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
984 |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
985 if (DISP_TABLE_P (b->display_table)) |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
986 dp = XCHAR_TABLE (b->display_table); |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
987 else if (DISP_TABLE_P (Vstandard_display_table)) |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
988 dp = XCHAR_TABLE (Vstandard_display_table); |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
989 } |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
990 |
e3fe041c4e25
(window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents:
30366
diff
changeset
|
991 return dp; |
265 | 992 } |
993 | |
555 | 994 DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, |
265 | 995 "Set WINDOW's display-table to TABLE.") |
996 (window, table) | |
997 register Lisp_Object window, table; | |
998 { | |
999 register struct window *w; | |
1000 | |
1001 w = decode_window (window); | |
1002 w->display_table = table; | |
1003 return table; | |
1004 } | |
1005 | |
1006 /* Record info on buffer window w is displaying | |
1007 when it is about to cease to display that buffer. */ | |
21514 | 1008 static void |
265 | 1009 unshow_buffer (w) |
1010 register struct window *w; | |
1011 { | |
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
1012 Lisp_Object buf; |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1013 struct buffer *b; |
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
1014 |
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
1015 buf = w->buffer; |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1016 b = XBUFFER (buf); |
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1017 if (b != XMARKER (w->pointm)->buffer) |
265 | 1018 abort (); |
1019 | |
5990
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
1020 #if 0 |
265 | 1021 if (w == XWINDOW (selected_window) |
1022 || ! EQ (buf, XWINDOW (selected_window)->buffer)) | |
1023 /* Do this except when the selected window's buffer | |
1024 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
|
1025 #endif |
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
1026 /* 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
|
1027 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
|
1028 Now that this statement is unconditional, |
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
1029 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
|
1030 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
|
1031 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
|
1032 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
|
1033 b->last_window_start = marker_position (w->start); |
265 | 1034 |
1035 /* Point in the selected window's buffer | |
1036 is actually stored in that buffer, and the window's pointm isn't used. | |
1037 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
|
1038 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
|
1039 /* 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
|
1040 && !(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
|
1041 && 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
|
1042 && 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
|
1043 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
|
1044 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
|
1045 XMARKER (w->pointm)->charpos, |
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1046 BUF_ZV (b)), |
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1047 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
|
1048 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
|
1049 BUF_ZV_BYTE (b))); |
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
1050 |
28417
4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents:
28104
diff
changeset
|
1051 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
|
1052 && 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
|
1053 b->last_selected_window = Qnil; |
265 | 1054 } |
1055 | |
1056 /* Put replacement into the window structure in place of old. */ | |
21514 | 1057 static void |
265 | 1058 replace_window (old, replacement) |
1059 Lisp_Object old, replacement; | |
1060 { | |
1061 register Lisp_Object tem; | |
1062 register struct window *o = XWINDOW (old), *p = XWINDOW (replacement); | |
1063 | |
769 | 1064 /* If OLD is its frame's root_window, then replacement is the new |
1065 root_window for that frame. */ | |
265 | 1066 |
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
1067 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) |
769 | 1068 FRAME_ROOT_WINDOW (XFRAME (o->frame)) = replacement; |
265 | 1069 |
1070 p->left = o->left; | |
1071 p->top = o->top; | |
1072 p->width = o->width; | |
1073 p->height = o->height; | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1074 p->desired_matrix = p->current_matrix = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1075 p->vscroll = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1076 bzero (&p->cursor, sizeof (p->cursor)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1077 bzero (&p->last_cursor, sizeof (p->last_cursor)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1078 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1079 p->phys_cursor_type = -1; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1080 p->must_be_updated_p = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1081 p->pseudo_window_p = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1082 XSETFASTINT (p->window_end_vpos, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1083 XSETFASTINT (p->window_end_pos, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1084 p->window_end_valid = Qnil; |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
1085 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
|
1086 p->orig_top = p->orig_height = Qnil; |
265 | 1087 |
1088 p->next = tem = o->next; | |
485 | 1089 if (!NILP (tem)) |
265 | 1090 XWINDOW (tem)->prev = replacement; |
1091 | |
1092 p->prev = tem = o->prev; | |
485 | 1093 if (!NILP (tem)) |
265 | 1094 XWINDOW (tem)->next = replacement; |
1095 | |
1096 p->parent = tem = o->parent; | |
485 | 1097 if (!NILP (tem)) |
265 | 1098 { |
1099 if (EQ (XWINDOW (tem)->vchild, old)) | |
1100 XWINDOW (tem)->vchild = replacement; | |
1101 if (EQ (XWINDOW (tem)->hchild, old)) | |
1102 XWINDOW (tem)->hchild = replacement; | |
1103 } | |
1104 | |
1105 /*** Here, if replacement is a vertical combination | |
1106 and so is its new parent, we should make replacement's | |
1107 children be children of that parent instead. ***/ | |
1108 } | |
1109 | |
1110 DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", | |
1111 "Remove WINDOW from the display. Default is selected window.") | |
1112 (window) | |
1113 register Lisp_Object window; | |
1114 { | |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1115 delete_window (window); |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1116 |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1117 if (! NILP (Vwindow_configuration_change_hook) |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1118 && ! NILP (Vrun_hooks)) |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1119 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1120 |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1121 return Qnil; |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1122 } |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1123 |
20351 | 1124 void |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1125 delete_window (window) |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1126 register Lisp_Object window; |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
1127 { |
265 | 1128 register Lisp_Object tem, parent, sib; |
1129 register struct window *p; | |
1130 register struct window *par; | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1131 FRAME_PTR frame; |
265 | 1132 |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1133 /* 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
|
1134 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
|
1135 so we can't decode_window here. */ |
485 | 1136 if (NILP (window)) |
265 | 1137 window = selected_window; |
1138 else | |
1139 CHECK_WINDOW (window, 0); | |
1140 p = XWINDOW (window); | |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1141 |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1142 /* 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
|
1143 if (NILP (p->buffer) |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1144 && NILP (p->hchild) |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1145 && NILP (p->vchild)) |
17365
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
1146 return; |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1147 |
265 | 1148 parent = p->parent; |
485 | 1149 if (NILP (parent)) |
265 | 1150 error ("Attempt to delete minibuffer or sole ordinary window"); |
1151 par = XWINDOW (parent); | |
1152 | |
1153 windows_or_buffers_changed++; | |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1154 Vwindow_list = Qnil; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1155 frame = XFRAME (WINDOW_FRAME (p)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1156 FRAME_WINDOW_SIZES_CHANGED (frame) = 1; |
265 | 1157 |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1158 /* 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
|
1159 { |
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1160 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
|
1161 |
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1162 /* 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
|
1163 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
|
1164 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
|
1165 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
|
1166 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
|
1167 |
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1168 while (!NILP (pwindow)) |
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1169 { |
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1170 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
|
1171 break; |
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1172 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
|
1173 } |
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1174 |
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1175 if (EQ (window, pwindow)) |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1176 { |
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1177 Lisp_Object alternative; |
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1178 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
|
1179 |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1180 /* 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
|
1181 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
|
1182 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
|
1183 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
|
1184 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
|
1185 if (EQ (window, selected_window)) |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1186 Fselect_window (alternative); |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1187 else |
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1188 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
|
1189 } |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1190 } |
265 | 1191 |
1192 tem = p->buffer; | |
1193 /* tem is null for dummy parent windows | |
1194 (which have inferiors but not any contents themselves) */ | |
485 | 1195 if (!NILP (tem)) |
265 | 1196 { |
1197 unshow_buffer (p); | |
1198 unchain_marker (p->pointm); | |
1199 unchain_marker (p->start); | |
1200 } | |
1201 | |
26761
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1202 /* 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
|
1203 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
|
1204 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
|
1205 processed while we are changing them. */ |
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1206 BLOCK_INPUT; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1207 free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (frame))); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1208 |
265 | 1209 tem = p->next; |
485 | 1210 if (!NILP (tem)) |
265 | 1211 XWINDOW (tem)->prev = p->prev; |
1212 | |
1213 tem = p->prev; | |
485 | 1214 if (!NILP (tem)) |
265 | 1215 XWINDOW (tem)->next = p->next; |
1216 | |
1217 if (EQ (window, par->hchild)) | |
1218 par->hchild = p->next; | |
1219 if (EQ (window, par->vchild)) | |
1220 par->vchild = p->next; | |
1221 | |
1222 /* Find one of our siblings to give our space to. */ | |
1223 sib = p->prev; | |
485 | 1224 if (NILP (sib)) |
265 | 1225 { |
1226 /* If p gives its space to its next sibling, that sibling needs | |
1227 to have its top/left side pulled back to where p's is. | |
1228 set_window_{height,width} will re-position the sibling's | |
1229 children. */ | |
1230 sib = p->next; | |
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
1231 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
|
1232 XWINDOW (sib)->left = p->left; |
265 | 1233 } |
1234 | |
1235 /* Stretch that sibling. */ | |
485 | 1236 if (!NILP (par->vchild)) |
265 | 1237 set_window_height (sib, |
1238 XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height), | |
1239 1); | |
485 | 1240 if (!NILP (par->hchild)) |
265 | 1241 set_window_width (sib, |
1242 XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width), | |
1243 1); | |
1244 | |
1245 /* If parent now has only one child, | |
1246 put the child into the parent's place. */ | |
1247 tem = par->hchild; | |
485 | 1248 if (NILP (tem)) |
265 | 1249 tem = par->vchild; |
485 | 1250 if (NILP (XWINDOW (tem)->next)) |
265 | 1251 replace_window (parent, tem); |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1252 |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1253 /* 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
|
1254 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
|
1255 if (! NILP (p->hchild)) |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1256 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
|
1257 else if (! NILP (p->vchild)) |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1258 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
|
1259 |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1260 /* Mark this window as deleted. */ |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1261 p->buffer = p->hchild = p->vchild = Qnil; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1262 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1263 /* Adjust glyph matrices. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1264 adjust_glyphs (frame); |
26761
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1265 UNBLOCK_INPUT; |
265 | 1266 } |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1267 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1268 |
265 | 1269 |
30037
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 Window List |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1272 ***********************************************************************/ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1273 |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
1274 /* Add window W to *USER_DATA. USER_DATA is actually a Lisp_Object |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
1275 pointer. This is a callback function for foreach_window, used in |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
1276 function window_list. */ |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1277 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1278 static int |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
1279 add_window_to_list (w, user_data) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1280 struct window *w; |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
1281 void *user_data; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1282 { |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
1283 Lisp_Object *list = (Lisp_Object *) user_data; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1284 Lisp_Object window; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1285 XSETWINDOW (window, w); |
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1286 *list = Fcons (window, *list); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1287 return 1; |
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 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1290 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1291 /* 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
|
1292 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
|
1293 list, cache it in Vwindow_list, and return that. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1294 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1295 static Lisp_Object |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1296 window_list () |
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 if (!CONSP (Vwindow_list)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1299 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1300 Lisp_Object tail; |
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1301 |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1302 Vwindow_list = Qnil; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1303 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
|
1304 { |
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1305 Lisp_Object args[2]; |
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1306 |
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1307 /* 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
|
1308 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
|
1309 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
|
1310 args[1] = Qnil; |
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1311 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
|
1312 args[0] = Vwindow_list; |
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1313 args[1] = Fnreverse (args[1]); |
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1314 Vwindow_list = Fnconc (2, args); |
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1315 } |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1316 } |
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 return Vwindow_list; |
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 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1321 |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1322 /* Value is non-zero if WINDOW satisfies the constraints given by |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1323 OWINDOW, MINIBUF and ALL_FRAMES. |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1324 |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1325 MINIBUF t means WINDOW may be minibuffer windows. |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1326 `lambda' means WINDOW may not be a minibuffer window. |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1327 a window means a specific minibuffer window |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1328 |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1329 ALL_FRAMES t means search all frames, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1330 nil means search just current frame, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1331 `visible' means search just visible frames, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1332 0 means search visible and iconified frames, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1333 a window means search the frame that window belongs to, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1334 a frame means consider windows on that frame, only. */ |
30037
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 int |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1337 candidate_window_p (window, owindow, minibuf, all_frames) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1338 Lisp_Object window, owindow, minibuf, all_frames; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1339 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1340 struct window *w = XWINDOW (window); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1341 struct frame *f = XFRAME (w->frame); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1342 int candidate_p = 1; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1343 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1344 if (!BUFFERP (w->buffer)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1345 candidate_p = 0; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1346 else if (MINI_WINDOW_P (w) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1347 && (EQ (minibuf, Qlambda) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1348 || (WINDOWP (minibuf) && !EQ (minibuf, window)))) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1349 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1350 /* If MINIBUF is `lambda' don't consider any mini-windows. |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1351 If it is a window, consider only that one. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1352 candidate_p = 0; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1353 } |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1354 else if (EQ (all_frames, Qt)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1355 candidate_p = 1; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1356 else if (NILP (all_frames)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1357 { |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1358 xassert (WINDOWP (owindow)); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1359 candidate_p = EQ (w->frame, XWINDOW (owindow)->frame); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1360 } |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1361 else if (EQ (all_frames, Qvisible)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1362 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1363 FRAME_SAMPLE_VISIBILITY (f); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1364 candidate_p = FRAME_VISIBLE_P (f); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1365 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1366 else if (INTEGERP (all_frames) && XINT (all_frames) == 0) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1367 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1368 FRAME_SAMPLE_VISIBILITY (f); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1369 candidate_p = FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1370 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1371 else if (WINDOWP (all_frames)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1372 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1373 || EQ (XWINDOW (all_frames)->frame, w->frame) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1374 || EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f))); |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1375 else if (FRAMEP (all_frames)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1376 candidate_p = EQ (all_frames, w->frame); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1377 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1378 return candidate_p; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1379 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1380 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1381 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1382 /* Decode arguments as allowed by Fnext_window, Fprevious_window, and |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1383 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
|
1384 ALL_FRAMES. */ |
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 static void |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1387 decode_next_window_args (window, minibuf, all_frames) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1388 Lisp_Object *window, *minibuf, *all_frames; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1389 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1390 if (NILP (*window)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1391 *window = selected_window; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1392 else |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1393 CHECK_LIVE_WINDOW (*window, 0); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1394 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1395 /* 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
|
1396 does. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1397 if (NILP (*minibuf)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1398 *minibuf = minibuf_level ? minibuf_window : Qlambda; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1399 else if (!EQ (*minibuf, Qt)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1400 *minibuf = Qlambda; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1401 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1402 /* Now *MINIBUF can be t => count all minibuffer windows, `lambda' |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1403 => count none of them, or a specific minibuffer window (the |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1404 active one) to count. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1405 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1406 /* ALL_FRAMES nil doesn't specify which frames to include. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1407 if (NILP (*all_frames)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1408 *all_frames = (!EQ (*minibuf, Qlambda) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1409 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1410 : Qnil); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1411 else if (EQ (*all_frames, Qvisible)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1412 ; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1413 else if (XFASTINT (*all_frames) == 0) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1414 ; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1415 else if (FRAMEP (*all_frames)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1416 ; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1417 else if (!EQ (*all_frames, Qt)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1418 *all_frames = Qnil; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1419 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1420 /* 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
|
1421 search just current frame, `visible' meaning search just visible |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1422 frames, 0 meaning search visible and iconified frames, or a |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1423 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
|
1424 frame, meaning consider windows on that frame, only. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1425 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1426 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1427 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1428 /* 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
|
1429 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
|
1430 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
|
1431 ALL_FRAMES. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1432 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1433 static Lisp_Object |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1434 next_window (window, minibuf, all_frames, next_p) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1435 Lisp_Object window, minibuf, all_frames; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1436 int next_p; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1437 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1438 decode_next_window_args (&window, &minibuf, &all_frames); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1439 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1440 /* 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
|
1441 return the first window on the frame. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1442 if (FRAMEP (all_frames) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1443 && !EQ (all_frames, XWINDOW (window)->frame)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1444 return Fframe_first_window (all_frames); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1445 |
30039
07f23448b6e5
(add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents:
30037
diff
changeset
|
1446 if (next_p) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1447 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1448 Lisp_Object list; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1449 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1450 /* Find WINDOW in the list of all windows. */ |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1451 list = Fmemq (window, window_list ()); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1452 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1453 /* 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
|
1454 if (CONSP (list)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1455 for (list = XCDR (list); CONSP (list); list = XCDR (list)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1456 if (candidate_window_p (XCAR (list), window, minibuf, all_frames)) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1457 break; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1458 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1459 /* 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
|
1460 if (!CONSP (list)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1461 for (list = Vwindow_list; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1462 CONSP (list) && !EQ (XCAR (list), window); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1463 list = XCDR (list)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1464 if (candidate_window_p (XCAR (list), window, minibuf, all_frames)) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1465 break; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1466 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1467 if (CONSP (list)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1468 window = XCAR (list); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1469 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1470 else |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1471 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1472 Lisp_Object candidate, list; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1473 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1474 /* 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
|
1475 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
|
1476 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
|
1477 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
|
1478 candidate = Qnil; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1479 for (list = window_list (); CONSP (list); list = XCDR (list)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1480 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1481 if (EQ (XCAR (list), window)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1482 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1483 if (WINDOWP (candidate)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1484 break; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1485 } |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1486 else if (candidate_window_p (XCAR (list), window, minibuf, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1487 all_frames)) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1488 candidate = XCAR (list); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1489 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1490 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1491 if (WINDOWP (candidate)) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1492 window = candidate; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1493 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1494 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1495 return window; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1496 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1497 |
432 | 1498 |
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1499 /* 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
|
1500 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
|
1501 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
|
1502 |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1503 DEFUN ("next-window", Ffoo, Sfoo, 0, 3, 0, |
432 | 1504 "Return next window after WINDOW in canonical ordering of windows.\n\ |
1505 If omitted, WINDOW defaults to the selected window.\n\ | |
1506 \n\ | |
1507 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
1508 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
1509 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
1510 minibuffer even if it is active.\n\ | |
1511 \n\ | |
769 | 1512 Several frames may share a single minibuffer; if the minibuffer\n\ |
1513 counts, all windows on all frames that share that minibuffer count\n\ | |
8139 | 1514 too. Therefore, `next-window' can be used to iterate through the\n\ |
769 | 1515 set of windows even when the minibuffer is on another frame. If the\n\ |
1516 minibuffer does not count, only windows from WINDOW's frame count.\n\ | |
432 | 1517 \n\ |
769 | 1518 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
1519 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
|
1520 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
|
1521 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
|
1522 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
|
1523 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
|
1524 \n\ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1525 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
|
1526 `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
|
1527 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
|
1528 `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
|
1529 (window, minibuf, all_frames) */ |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1530 |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1531 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
|
1532 0) |
769 | 1533 (window, minibuf, all_frames) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1534 Lisp_Object window, minibuf, all_frames; |
265 | 1535 { |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1536 return next_window (window, minibuf, all_frames, 1); |
265 | 1537 } |
1538 | |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1539 |
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1540 /* 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
|
1541 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
|
1542 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
|
1543 |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1544 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
|
1545 "Return the window preceding WINDOW in canonical ordering of windows.\n\ |
432 | 1546 If omitted, WINDOW defaults to the selected window.\n\ |
1547 \n\ | |
1548 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
1549 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
1550 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
1551 minibuffer even if it is active.\n\ | |
1552 \n\ | |
769 | 1553 Several frames may share a single minibuffer; if the minibuffer\n\ |
1554 counts, all windows on all frames that share that minibuffer count\n\ | |
8139 | 1555 too. Therefore, `previous-window' can be used to iterate through\n\ |
769 | 1556 the set of windows even when the minibuffer is on another frame. If\n\ |
8139 | 1557 the minibuffer does not count, only windows from WINDOW's frame count\n\ |
432 | 1558 \n\ |
769 | 1559 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
1560 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
|
1561 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
|
1562 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
|
1563 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
|
1564 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
|
1565 \n\ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1566 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
|
1567 `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
|
1568 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
|
1569 `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
|
1570 (window, minibuf, all_frames) */ |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1571 |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1572 |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1573 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
|
1574 0) |
769 | 1575 (window, minibuf, all_frames) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1576 Lisp_Object window, minibuf, all_frames; |
265 | 1577 { |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1578 return next_window (window, minibuf, all_frames, 0); |
265 | 1579 } |
1580 | |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1581 |
338 | 1582 DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", |
769 | 1583 "Select the ARG'th different window on this frame.\n\ |
1584 All windows on current frame are arranged in a cyclic order.\n\ | |
265 | 1585 This command selects the window ARG steps away in that order.\n\ |
1586 A negative ARG moves in the opposite order. If the optional second\n\ | |
769 | 1587 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
|
1588 (arg, all_frames) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1589 Lisp_Object arg, all_frames; |
265 | 1590 { |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1591 Lisp_Object window; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1592 int i; |
265 | 1593 |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1594 CHECK_NUMBER (arg, 0); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1595 window = selected_window; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1596 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1597 for (i = XINT (arg); i > 0; --i) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1598 window = Fnext_window (window, Qnil, all_frames); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1599 for (; i < 0; ++i) |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1600 window = Fprevious_window (window, Qnil, all_frames); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1601 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1602 Fselect_window (window); |
265 | 1603 return Qnil; |
1604 } | |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1605 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1606 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1607 DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, |
33619
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1608 "Return a list of windows on FRAME, starting with WINDOW.\n\ |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1609 FRAME nil or omitted means use the selected frame.\n\ |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1610 WINDOW nil or omitted means use the selected window.\n\ |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1611 MINIBUF t means include the minibuffer window, even if it isn't active.\n\ |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1612 MINIBUF nil or omitted means include the minibuffer window only\n\ |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1613 if it's active.\n\ |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1614 MINIBUF neither nil nor t means never include the minibuffer window.") |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1615 (frame, minibuf, window) |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1616 Lisp_Object frame, minibuf, window; |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1617 { |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1618 Lisp_Object list; |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1619 |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1620 if (NILP (window)) |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1621 window = selected_window; |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1622 if (NILP (frame)) |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1623 frame = selected_frame; |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1624 |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1625 if (!EQ (frame, XWINDOW (window)->frame)) |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1626 error ("Window is on a different frame"); |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1627 |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1628 return window_list_1 (window, minibuf, frame); |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1629 } |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1630 |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1631 |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1632 /* Return a list of windows in canonical ordering. Arguments are like |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1633 for `next-window'. */ |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1634 |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1635 static Lisp_Object |
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1636 window_list_1 (window, minibuf, all_frames) |
30265
9b1c8eafe4dc
(Fwindow_list): Declare arg `window'.
Dave Love <fx@gnu.org>
parents:
30102
diff
changeset
|
1637 Lisp_Object window, minibuf, all_frames; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1638 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1639 Lisp_Object tail, list; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1640 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1641 decode_next_window_args (&window, &minibuf, &all_frames); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1642 list = Qnil; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1643 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1644 for (tail = window_list (); CONSP (tail); tail = XCDR (tail)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1645 if (candidate_window_p (XCAR (tail), window, minibuf, all_frames)) |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1646 list = Fcons (XCAR (tail), list); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1647 |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1648 return Fnreverse (list); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1649 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1650 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
1651 |
265 | 1652 |
1653 /* Look at all windows, performing an operation specified by TYPE | |
1654 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
|
1655 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
|
1656 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
|
1657 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
|
1658 a frame, just look at windows on that frame. |
265 | 1659 If MINI is non-zero, perform the operation on minibuffer windows too. |
1660 */ | |
1661 | |
1662 enum window_loop | |
1663 { | |
1664 WINDOW_LOOP_UNUSED, | |
1665 GET_BUFFER_WINDOW, /* Arg is buffer */ | |
1666 GET_LRU_WINDOW, /* Arg is t for full-width windows only */ | |
1667 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ | |
1668 DELETE_BUFFER_WINDOWS, /* Arg is buffer */ | |
1669 GET_LARGEST_WINDOW, | |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1670 UNSHOW_BUFFER, /* Arg is buffer */ |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1671 CHECK_ALL_WINDOWS |
265 | 1672 }; |
1673 | |
1674 static Lisp_Object | |
769 | 1675 window_loop (type, obj, mini, frames) |
265 | 1676 enum window_loop type; |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1677 Lisp_Object obj, frames; |
265 | 1678 int mini; |
1679 { | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1680 Lisp_Object window, windows, best_window, frame_arg; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1681 struct frame *f; |
30102
9406cb07bac7
(window_loop): Add missing gcpro1 local variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30093
diff
changeset
|
1682 struct gcpro gcpro1; |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1683 |
769 | 1684 /* If we're only looping through windows on a particular frame, |
1685 frame points to that frame. If we're looping through windows | |
1686 on all frames, frame is 0. */ | |
1687 if (FRAMEP (frames)) | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1688 f = XFRAME (frames); |
769 | 1689 else if (NILP (frames)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1690 f = SELECTED_FRAME (); |
265 | 1691 else |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1692 f = NULL; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1693 |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1694 if (f) |
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1695 frame_arg = Qlambda; |
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1696 else if (XFASTINT (frames) == 0) |
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1697 frame_arg = frames; |
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1698 else if (EQ (frames, Qvisible)) |
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1699 frame_arg = frames; |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1700 else |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1701 frame_arg = Qt; |
265 | 1702 |
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1703 /* 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
|
1704 Qvisible to consider all visible frames, |
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1705 or Qt otherwise. */ |
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1706 |
265 | 1707 /* 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
|
1708 if (WINDOWP (obj)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1709 window = obj; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1710 else if (f) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1711 window = FRAME_SELECTED_WINDOW (f); |
265 | 1712 else |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1713 window = 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
|
1714 |
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1715 /* 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
|
1716 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
|
1717 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
|
1718 |
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1719 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
|
1720 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
|
1721 |
33619
d0482eab29e1
(Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents:
33463
diff
changeset
|
1722 windows = window_list_1 (window, mini ? Qt : Qnil, frame_arg); |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1723 GCPRO1 (windows); |
265 | 1724 best_window = Qnil; |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1725 |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1726 for (; CONSP (windows); windows = CDR (windows)) |
265 | 1727 { |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1728 struct window *w; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1729 |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1730 window = XCAR (windows); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1731 w = XWINDOW (window); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1732 |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1733 /* Note that we do not pay attention here to whether the frame |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1734 is visible, since Fwindow_list skips non-visible frames if |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1735 that is desired, under the control of frame_arg. */ |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1736 if (!MINI_WINDOW_P (w) |
23728
0d1a0ded9aa1
(temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents:
23410
diff
changeset
|
1737 /* 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
|
1738 || type == UNSHOW_BUFFER |
265 | 1739 || (mini && minibuf_level > 0)) |
1740 switch (type) | |
1741 { | |
1742 case GET_BUFFER_WINDOW: | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1743 if (EQ (w->buffer, obj) |
16522
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1744 /* Don't find any minibuffer window |
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1745 except the one that is currently in use. */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1746 && (MINI_WINDOW_P (w) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1747 ? EQ (window, minibuf_window) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1748 : 1)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1749 { |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1750 UNGCPRO; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1751 return window; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1752 } |
265 | 1753 break; |
1754 | |
1755 case GET_LRU_WINDOW: | |
1756 /* t as arg means consider only full-width windows */ | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1757 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w)) |
265 | 1758 break; |
1759 /* Ignore dedicated windows and minibuffers. */ | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1760 if (MINI_WINDOW_P (w) || !NILP (w->dedicated)) |
265 | 1761 break; |
485 | 1762 if (NILP (best_window) |
265 | 1763 || (XFASTINT (XWINDOW (best_window)->use_time) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1764 > XFASTINT (w->use_time))) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1765 best_window = window; |
265 | 1766 break; |
1767 | |
1768 case DELETE_OTHER_WINDOWS: | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1769 if (!EQ (window, obj)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1770 Fdelete_window (window); |
265 | 1771 break; |
1772 | |
1773 case DELETE_BUFFER_WINDOWS: | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1774 if (EQ (w->buffer, obj)) |
265 | 1775 { |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1776 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1777 |
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1778 /* 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
|
1779 kill the frame. */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1780 if (EQ (window, FRAME_ROOT_WINDOW (f)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1781 && !NILP (w->dedicated) |
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1782 && other_visible_frames (f)) |
265 | 1783 { |
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1784 /* 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
|
1785 There might be one, the minibuffer! */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1786 while (CONSP (XCDR (windows)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1787 && EQ (XWINDOW (XCAR (windows))->frame, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1788 XWINDOW (XCAR (XCDR (windows)))->frame)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1789 windows = XCDR (windows); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1790 |
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1791 /* Now we can safely delete the frame. */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1792 Fdelete_frame (w->frame, Qnil); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1793 } |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1794 else if (NILP (w->parent)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1795 { |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1796 /* If we're deleting the buffer displayed in the |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1797 only window on the frame, find a new buffer to |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1798 display there. */ |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1799 Lisp_Object buffer; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1800 buffer = Fother_buffer (obj, Qnil, w->frame); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1801 if (NILP (buffer)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1802 buffer = Fget_buffer_create (build_string ("*scratch*")); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1803 Fset_window_buffer (window, buffer); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1804 if (EQ (window, selected_window)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1805 Fset_buffer (w->buffer); |
265 | 1806 } |
1807 else | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1808 Fdelete_window (window); |
265 | 1809 } |
1810 break; | |
1811 | |
1812 case GET_LARGEST_WINDOW: | |
1813 { | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1814 /* Ignore dedicated windows and minibuffers. */ |
31393
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1815 if (MINI_WINDOW_P (w) || !NILP (w->dedicated)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1816 break; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1817 |
31393
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1818 if (NILP (best_window)) |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1819 best_window = window; |
31393
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1820 else |
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1821 { |
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1822 struct window *b = XWINDOW (best_window); |
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1823 if (XFASTINT (w->height) * XFASTINT (w->width) |
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1824 > XFASTINT (b->height) * XFASTINT (b->width)) |
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1825 best_window = window; |
9cb95a7ee33e
(window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents:
31117
diff
changeset
|
1826 } |
265 | 1827 } |
1828 break; | |
1829 | |
1830 case UNSHOW_BUFFER: | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1831 if (EQ (w->buffer, obj)) |
265 | 1832 { |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1833 Lisp_Object buffer; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1834 struct frame *f = XFRAME (w->frame); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1835 |
265 | 1836 /* Find another buffer to show in this window. */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1837 buffer = Fother_buffer (obj, Qnil, w->frame); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1838 if (NILP (buffer)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1839 buffer = Fget_buffer_create (build_string ("*scratch*")); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1840 |
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1841 /* 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
|
1842 kill the frame. */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1843 if (EQ (window, FRAME_ROOT_WINDOW (f)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1844 && !NILP (w->dedicated) |
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1845 && other_visible_frames (f)) |
8536
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1846 { |
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1847 /* Skip the other windows on this frame. |
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1848 There might be one, the minibuffer! */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1849 while (CONSP (XCDR (windows)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1850 && EQ (XWINDOW (XCAR (windows))->frame, |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1851 XWINDOW (XCAR (XCDR (windows)))->frame)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1852 windows = XCDR (windows); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1853 |
8536
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1854 /* Now we can safely delete the frame. */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1855 Fdelete_frame (w->frame, Qnil); |
8536
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1856 } |
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1857 else |
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1858 { |
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1859 /* Otherwise show a different buffer in the window. */ |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1860 w->dedicated = Qnil; |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1861 Fset_window_buffer (window, buffer); |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1862 if (EQ (window, selected_window)) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1863 Fset_buffer (w->buffer); |
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1864 } |
265 | 1865 } |
1866 break; | |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1867 |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1868 /* 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
|
1869 case CHECK_ALL_WINDOWS: |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1870 if (! NILP (w->buffer) |
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1871 && NILP (XBUFFER (w->buffer)->name)) |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1872 abort (); |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1873 break; |
31829
43566b0aec59
Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents:
31393
diff
changeset
|
1874 |
43566b0aec59
Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents:
31393
diff
changeset
|
1875 case WINDOW_LOOP_UNUSED: |
43566b0aec59
Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents:
31393
diff
changeset
|
1876 break; |
265 | 1877 } |
1878 } | |
1879 | |
30093
22f8fc642575
(Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents:
30045
diff
changeset
|
1880 UNGCPRO; |
265 | 1881 return best_window; |
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
1882 } |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1883 |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1884 /* 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
|
1885 |
25268 | 1886 void |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1887 check_all_windows () |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1888 { |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1889 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
|
1890 } |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1891 |
265 | 1892 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
1893 "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
|
1894 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
|
1895 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
|
1896 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
|
1897 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
|
1898 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
|
1899 (frame) |
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1900 Lisp_Object frame; |
265 | 1901 { |
1902 register Lisp_Object w; | |
1903 /* 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
|
1904 w = window_loop (GET_LRU_WINDOW, Qt, 0, frame); |
485 | 1905 if (!NILP (w) && !EQ (w, selected_window)) |
265 | 1906 return w; |
1907 /* 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
|
1908 return window_loop (GET_LRU_WINDOW, Qnil, 0, frame); |
265 | 1909 } |
1910 | |
1911 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, | |
1912 "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
|
1913 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
|
1914 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
|
1915 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
|
1916 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
|
1917 If FRAME is a frame, search only that frame.") |
769 | 1918 (frame) |
1919 Lisp_Object frame; | |
265 | 1920 { |
1921 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, | |
769 | 1922 frame); |
265 | 1923 } |
1924 | |
1925 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, | |
1926 "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
|
1927 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
|
1928 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
|
1929 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
|
1930 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
|
1931 If FRAME is a frame, search only that frame.") |
769 | 1932 (buffer, frame) |
1933 Lisp_Object buffer, frame; | |
265 | 1934 { |
1935 buffer = Fget_buffer (buffer); | |
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
1936 if (BUFFERP (buffer)) |
769 | 1937 return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame); |
265 | 1938 else |
1939 return Qnil; | |
1940 } | |
1941 | |
1942 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows, | |
1943 0, 1, "", | |
769 | 1944 "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
|
1945 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
|
1946 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
|
1947 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
|
1948 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
|
1949 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
|
1950 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
|
1951 value is reasonable when this function is called.") |
265 | 1952 (window) |
1953 Lisp_Object window; | |
1954 { | |
1955 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
|
1956 int startpos; |
265 | 1957 int top; |
1958 | |
485 | 1959 if (NILP (window)) |
265 | 1960 window = selected_window; |
1961 else | |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1962 CHECK_LIVE_WINDOW (window, 0); |
265 | 1963 |
1964 w = XWINDOW (window); | |
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1965 |
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1966 startpos = marker_position (w->start); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1967 top = XFASTINT (w->top) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); |
265 | 1968 |
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1969 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
|
1970 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
|
1971 |
2190
482c7827b968
(Fdelete_other_windows): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
1972 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); |
265 | 1973 |
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1974 /* 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
|
1975 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
|
1976 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
|
1977 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
|
1978 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
|
1979 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
|
1980 && 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
|
1981 { |
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1982 struct position pos; |
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1983 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
|
1984 |
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1985 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
|
1986 /* 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
|
1987 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
|
1988 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
|
1989 |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1990 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
|
1991 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
|
1992 || 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
|
1993 : Qnil); |
13198
43d90596da34
(Fdelete_other_windows): Set w->force_start.
Richard M. Stallman <rms@gnu.org>
parents:
13187
diff
changeset
|
1994 /* 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
|
1995 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
|
1996 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
|
1997 |
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1998 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
|
1999 } |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2000 |
265 | 2001 return Qnil; |
2002 } | |
2003 | |
2004 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
|
2005 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
|
2006 "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
|
2007 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
|
2008 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
|
2009 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
|
2010 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
|
2011 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
|
2012 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
|
2013 (buffer, frame) |
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
2014 Lisp_Object buffer, frame; |
265 | 2015 { |
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
2016 /* 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
|
2017 expects. */ |
22223
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
2018 if (NILP (frame)) |
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
2019 frame = Qt; |
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
2020 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
|
2021 frame = Qnil; |
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
2022 |
485 | 2023 if (!NILP (buffer)) |
265 | 2024 { |
2025 buffer = Fget_buffer (buffer); | |
2026 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
|
2027 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame); |
265 | 2028 } |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2029 |
265 | 2030 return Qnil; |
2031 } | |
2032 | |
2033 DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows, | |
2034 Sreplace_buffer_in_windows, | |
2035 1, 1, "bReplace buffer in windows: ", | |
2036 "Replace BUFFER with some other buffer in all windows showing it.") | |
2037 (buffer) | |
2038 Lisp_Object buffer; | |
2039 { | |
485 | 2040 if (!NILP (buffer)) |
265 | 2041 { |
2042 buffer = Fget_buffer (buffer); | |
2043 CHECK_BUFFER (buffer, 0); | |
2044 window_loop (UNSHOW_BUFFER, buffer, 0, Qt); | |
2045 } | |
2046 return Qnil; | |
2047 } | |
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2048 |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2049 /* 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
|
2050 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
|
2051 |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2052 void |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2053 replace_buffer_in_all_windows (buffer) |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2054 Lisp_Object buffer; |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2055 { |
14204
c0b44d3a8312
(replace_buffer_in_all_windows): Don't change selected
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
2056 #ifdef MULTI_KBOARD |
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2057 Lisp_Object tail, frame; |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2058 |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2059 /* 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
|
2060 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
|
2061 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
|
2062 FOR_EACH_FRAME (tail, frame) |
20066
affc9c857428
(replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents:
20046
diff
changeset
|
2063 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
|
2064 #else |
20066
affc9c857428
(replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents:
20046
diff
changeset
|
2065 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
|
2066 #endif |
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
2067 } |
265 | 2068 |
2069 /* 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
|
2070 |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2071 /* 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
|
2072 might crash Emacs. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2073 |
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2074 #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
|
2075 #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
|
2076 |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2077 /* 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
|
2078 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
|
2079 |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2080 static void |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2081 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
|
2082 { |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2083 /* 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
|
2084 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
|
2085 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
|
2086 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
|
2087 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
|
2088 } |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2089 |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2090 /* 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
|
2091 minimum allowable size. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2092 |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2093 void |
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2094 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
|
2095 FRAME_PTR frame; |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2096 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
|
2097 { |
4347
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
2098 /* 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
|
2099 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
|
2100 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
|
2101 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
|
2102 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
|
2103 (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
|
2104 : (! 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
|
2105 : 2 * MIN_SAFE_WINDOW_HEIGHT - 1); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2106 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2107 if (FRAME_TOP_MARGIN (frame) > 0) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2108 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
|
2109 |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2110 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
|
2111 *rows = min_height; |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2112 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
|
2113 *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
|
2114 } |
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2115 |
25254 | 2116 |
25268 | 2117 /* Value is non-zero if window W is fixed-size. WIDTH_P non-zero means |
2118 check if W's width can be changed, otherwise check W's height. | |
2119 CHECK_SIBLINGS_P non-zero means check resizablity of WINDOW's | |
2120 siblings, too. If none of the siblings is resizable, WINDOW isn't | |
2121 either. */ | |
2122 | |
2123 static int | |
2124 window_fixed_size_p (w, width_p, check_siblings_p) | |
2125 struct window *w; | |
2126 int width_p, check_siblings_p; | |
2127 { | |
2128 int fixed_p; | |
2129 struct window *c; | |
2130 | |
2131 if (!NILP (w->hchild)) | |
2132 { | |
2133 c = XWINDOW (w->hchild); | |
2134 | |
2135 if (width_p) | |
2136 { | |
2137 /* A horiz. combination is fixed-width if all of if its | |
2138 children are. */ | |
2139 while (c && window_fixed_size_p (c, width_p, 0)) | |
2140 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2141 fixed_p = c == NULL; | |
2142 } | |
2143 else | |
2144 { | |
2145 /* A horiz. combination is fixed-height if one of if its | |
2146 children is. */ | |
2147 while (c && !window_fixed_size_p (c, width_p, 0)) | |
2148 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2149 fixed_p = c != NULL; | |
2150 } | |
2151 } | |
2152 else if (!NILP (w->vchild)) | |
2153 { | |
2154 c = XWINDOW (w->vchild); | |
2155 | |
2156 if (width_p) | |
2157 { | |
2158 /* A vert. combination is fixed-width if one of if its | |
2159 children is. */ | |
2160 while (c && !window_fixed_size_p (c, width_p, 0)) | |
2161 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2162 fixed_p = c != NULL; | |
2163 } | |
2164 else | |
2165 { | |
2166 /* A vert. combination is fixed-height if all of if its | |
2167 children are. */ | |
2168 while (c && window_fixed_size_p (c, width_p, 0)) | |
2169 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2170 fixed_p = c == NULL; | |
2171 } | |
2172 } | |
2173 else if (BUFFERP (w->buffer)) | |
2174 { | |
25739
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2175 if (w->height_fixed_p && !width_p) |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2176 fixed_p = 1; |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2177 else |
25268 | 2178 { |
25739
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2179 struct buffer *old = current_buffer; |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2180 Lisp_Object val; |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2181 |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2182 current_buffer = XBUFFER (w->buffer); |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2183 val = find_symbol_value (Qwindow_size_fixed); |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2184 current_buffer = old; |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2185 |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2186 fixed_p = 0; |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2187 if (!EQ (val, Qunbound)) |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2188 { |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2189 fixed_p = !NILP (val); |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2190 |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2191 if (fixed_p |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2192 && ((EQ (val, Qheight) && width_p) |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2193 || (EQ (val, Qwidth) && !width_p))) |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2194 fixed_p = 0; |
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2195 } |
25268 | 2196 } |
2197 | |
2198 /* Can't tell if this one is resizable without looking at | |
2199 siblings. If all siblings are fixed-size this one is too. */ | |
2200 if (!fixed_p && check_siblings_p && WINDOWP (w->parent)) | |
2201 { | |
2202 Lisp_Object child; | |
2203 | |
2204 for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev) | |
2205 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) | |
2206 break; | |
2207 | |
2208 if (NILP (child)) | |
2209 for (child = w->next; !NILP (child); child = XWINDOW (child)->next) | |
2210 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) | |
2211 break; | |
2212 | |
2213 if (NILP (child)) | |
2214 fixed_p = 1; | |
2215 } | |
2216 } | |
2217 else | |
2218 fixed_p = 1; | |
2219 | |
2220 return fixed_p; | |
2221 } | |
2222 | |
2223 | |
2224 /* Return the minimum size of window W, not taking fixed-width windows | |
2225 into account. WIDTH_P non-zero means return the minimum width, | |
2226 otherwise return the minimum height. If W is a combination window, | |
2227 compute the minimum size from the minimum sizes of W's children. */ | |
2228 | |
2229 static int | |
2230 window_min_size_1 (w, width_p) | |
25254 | 2231 struct window *w; |
2232 int width_p; | |
2233 { | |
25268 | 2234 struct window *c; |
25254 | 2235 int size; |
2236 | |
25268 | 2237 if (!NILP (w->hchild)) |
2238 { | |
2239 c = XWINDOW (w->hchild); | |
2240 size = 0; | |
2241 | |
2242 if (width_p) | |
2243 { | |
2244 /* The min width of a horizontal combination is | |
2245 the sum of the min widths of its children. */ | |
2246 while (c) | |
2247 { | |
2248 size += window_min_size_1 (c, width_p); | |
2249 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2250 } | |
2251 } | |
2252 else | |
2253 { | |
2254 /* The min height a horizontal combination equals | |
2255 the maximum of all min height of its children. */ | |
2256 while (c) | |
2257 { | |
2258 int min_size = window_min_size_1 (c, width_p); | |
2259 size = max (min_size, size); | |
2260 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2261 } | |
2262 } | |
2263 } | |
2264 else if (!NILP (w->vchild)) | |
2265 { | |
2266 c = XWINDOW (w->vchild); | |
2267 size = 0; | |
2268 | |
2269 if (width_p) | |
2270 { | |
2271 /* The min width of a vertical combination is | |
2272 the maximum of the min widths of its children. */ | |
2273 while (c) | |
2274 { | |
2275 int min_size = window_min_size_1 (c, width_p); | |
2276 size = max (min_size, size); | |
2277 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2278 } | |
2279 } | |
2280 else | |
2281 { | |
2282 /* The min height of a vertical combination equals | |
2283 the sum of the min height of its children. */ | |
2284 while (c) | |
2285 { | |
2286 size += window_min_size_1 (c, width_p); | |
2287 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
2288 } | |
2289 } | |
2290 } | |
25254 | 2291 else |
2292 { | |
25268 | 2293 if (width_p) |
2294 size = window_min_width; | |
25254 | 2295 else |
25268 | 2296 { |
2297 if (MINI_WINDOW_P (w) | |
2298 || (!WINDOW_WANTS_MODELINE_P (w) | |
25546 | 2299 && !WINDOW_WANTS_HEADER_LINE_P (w))) |
25268 | 2300 size = 1; |
2301 else | |
2302 size = window_min_height; | |
2303 } | |
25254 | 2304 } |
2305 | |
2306 return size; | |
2307 } | |
2308 | |
2309 | |
25268 | 2310 /* Return the minimum size of window W, taking fixed-size windows into |
2311 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
|
2312 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
|
2313 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
|
2314 unless FIXED is null. */ |
25268 | 2315 |
2316 static int | |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2317 window_min_size (w, width_p, ignore_fixed_p, fixed) |
25268 | 2318 struct window *w; |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2319 int width_p, ignore_fixed_p, *fixed; |
25268 | 2320 { |
2321 int size, fixed_p; | |
2322 | |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2323 if (ignore_fixed_p) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2324 fixed_p = 0; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2325 else |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2326 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
|
2327 |
25268 | 2328 if (fixed) |
2329 *fixed = fixed_p; | |
2330 | |
2331 if (fixed_p) | |
2332 size = width_p ? XFASTINT (w->width) : XFASTINT (w->height); | |
2333 else | |
2334 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
|
2335 |
25268 | 2336 return size; |
2337 } | |
2338 | |
2339 | |
2340 /* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set | |
2341 WINDOW's width. Resize WINDOW's children, if any, so that they | |
2342 keep their proportionate size relative to WINDOW. Propagate | |
2343 WINDOW's top or left edge position to children. Delete windows | |
2344 that become too small unless NODELETE_P is non-zero. */ | |
2345 | |
2346 static void | |
2347 size_window (window, size, width_p, nodelete_p) | |
2348 Lisp_Object window; | |
2349 int size, width_p, nodelete_p; | |
2350 { | |
2351 struct window *w = XWINDOW (window); | |
2352 struct window *c; | |
2353 Lisp_Object child, *forward, *sideward; | |
2354 int old_size, min_size; | |
2355 | |
2356 check_min_window_sizes (); | |
32824
6521cc146e8e
(size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents:
32800
diff
changeset
|
2357 size = max (0, size); |
25268 | 2358 |
2359 /* If the window has been "too small" at one point, | |
2360 don't delete it for being "too small" in the future. | |
2361 Preserve it as long as that is at all possible. */ | |
2362 if (width_p) | |
2363 { | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2364 old_size = XINT (w->width); |
25268 | 2365 min_size = window_min_width; |
2366 } | |
2367 else | |
2368 { | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2369 old_size = XINT (w->height); |
25268 | 2370 min_size = window_min_height; |
2371 } | |
2372 | |
2373 if (old_size < window_min_width) | |
2374 w->too_small_ok = Qt; | |
2375 | |
2376 /* Maybe delete WINDOW if it's too small. */ | |
2377 if (!nodelete_p && !NILP (w->parent)) | |
2378 { | |
2379 int min_size; | |
2380 | |
2381 if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok)) | |
2382 min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT; | |
2383 else | |
2384 min_size = width_p ? window_min_width : window_min_height; | |
2385 | |
2386 if (size < min_size) | |
2387 { | |
2388 delete_window (window); | |
2389 return; | |
2390 } | |
2391 } | |
2392 | |
2393 /* Set redisplay hints. */ | |
32824
6521cc146e8e
(size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents:
32800
diff
changeset
|
2394 w->last_modified = make_number (0); |
6521cc146e8e
(size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents:
32800
diff
changeset
|
2395 w->last_overlay_modified = make_number (0); |
25268 | 2396 windows_or_buffers_changed++; |
32824
6521cc146e8e
(size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents:
32800
diff
changeset
|
2397 FRAME_WINDOW_SIZES_CHANGED (XFRAME (w->frame)) = 1; |
25268 | 2398 |
2399 if (width_p) | |
2400 { | |
2401 sideward = &w->vchild; | |
2402 forward = &w->hchild; | |
32824
6521cc146e8e
(size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents:
32800
diff
changeset
|
2403 w->width = make_number (size); |
25268 | 2404 } |
2405 else | |
2406 { | |
2407 sideward = &w->hchild; | |
2408 forward = &w->vchild; | |
32824
6521cc146e8e
(size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents:
32800
diff
changeset
|
2409 w->height = make_number (size); |
25268 | 2410 } |
2411 | |
2412 if (!NILP (*sideward)) | |
2413 { | |
2414 for (child = *sideward; !NILP (child); child = c->next) | |
2415 { | |
2416 c = XWINDOW (child); | |
2417 if (width_p) | |
2418 c->left = w->left; | |
2419 else | |
2420 c->top = w->top; | |
2421 size_window (child, size, width_p, nodelete_p); | |
2422 } | |
2423 } | |
2424 else if (!NILP (*forward)) | |
2425 { | |
2426 int fixed_size, each, extra, n; | |
2427 int resize_fixed_p, nfixed; | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2428 int last_pos, first_pos, nchildren, total; |
25268 | 2429 |
2430 /* Determine the fixed-size portion of the this window, and the | |
2431 number of child windows. */ | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2432 fixed_size = nchildren = nfixed = total = 0; |
25268 | 2433 for (child = *forward; !NILP (child); child = c->next, ++nchildren) |
2434 { | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2435 int child_size; |
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2436 |
25268 | 2437 c = XWINDOW (child); |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2438 child_size = width_p ? XINT (c->width) : XINT (c->height); |
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2439 total += child_size; |
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2440 |
25268 | 2441 if (window_fixed_size_p (c, width_p, 0)) |
2442 { | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2443 fixed_size += child_size; |
25268 | 2444 ++nfixed; |
2445 } | |
2446 } | |
2447 | |
2448 /* If the new size is smaller than fixed_size, or if there | |
2449 aren't any resizable windows, allow resizing fixed-size | |
2450 windows. */ | |
2451 resize_fixed_p = nfixed == nchildren || size < fixed_size; | |
2452 | |
2453 /* Compute how many lines/columns to add to each child. The | |
2454 value of extra takes care of rounding errors. */ | |
2455 n = resize_fixed_p ? nchildren : nchildren - nfixed; | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2456 each = (size - total) / n; |
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2457 extra = (size - total) - n * each; |
25268 | 2458 |
2459 /* Compute new children heights and edge positions. */ | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2460 first_pos = width_p ? XINT (w->left) : XINT (w->top); |
25268 | 2461 last_pos = first_pos; |
2462 for (child = *forward; !NILP (child); child = c->next) | |
2463 { | |
2464 int new_size, old_size; | |
2465 | |
2466 c = XWINDOW (child); | |
2467 old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); | |
2468 new_size = old_size; | |
2469 | |
2470 /* The top or left edge position of this child equals the | |
2471 bottom or right edge of its predecessor. */ | |
2472 if (width_p) | |
2473 c->left = make_number (last_pos); | |
2474 else | |
2475 c->top = make_number (last_pos); | |
2476 | |
2477 /* If this child can be resized, do it. */ | |
2478 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) | |
2479 { | |
2480 new_size = old_size + each + extra; | |
2481 extra = 0; | |
2482 } | |
2483 | |
2484 /* Set new height. Note that size_window also propagates | |
2485 edge positions to children, so it's not a no-op if we | |
2486 didn't change the child's size. */ | |
2487 size_window (child, new_size, width_p, 1); | |
2488 | |
2489 /* Remember the bottom/right edge position of this child; it | |
2490 will be used to set the top/left edge of the next child. */ | |
2491 last_pos += new_size; | |
2492 } | |
2493 | |
2494 /* We should have covered the parent exactly with child windows. */ | |
2495 xassert (size == last_pos - first_pos); | |
2496 | |
2497 /* Now delete any children that became too small. */ | |
2498 if (!nodelete_p) | |
2499 for (child = *forward; !NILP (child); child = c->next) | |
2500 { | |
2501 int child_size; | |
2502 c = XWINDOW (child); | |
32928
859adc7ac97d
(size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents:
32871
diff
changeset
|
2503 child_size = width_p ? XINT (c->width) : XINT (c->height); |
25268 | 2504 size_window (child, child_size, width_p, 0); |
2505 } | |
2506 } | |
2507 } | |
2508 | |
2509 /* Set WINDOW's height to HEIGHT, and recursively change the height of | |
2510 WINDOW's children. NODELETE non-zero means don't delete windows | |
2511 that become too small in the process. (The caller should check | |
2512 later and do so if appropriate.) */ | |
265 | 2513 |
20351 | 2514 void |
265 | 2515 set_window_height (window, height, nodelete) |
2516 Lisp_Object window; | |
2517 int height; | |
2518 int nodelete; | |
2519 { | |
25268 | 2520 size_window (window, height, 0, nodelete); |
265 | 2521 } |
2522 | |
25268 | 2523 |
2524 /* Set WINDOW's width to WIDTH, and recursively change the width of | |
2525 WINDOW's children. NODELETE non-zero means don't delete windows | |
2526 that become too small in the process. (The caller should check | |
2527 later and do so if appropriate.) */ | |
265 | 2528 |
20351 | 2529 void |
265 | 2530 set_window_width (window, width, nodelete) |
2531 Lisp_Object window; | |
2532 int width; | |
2533 int nodelete; | |
2534 { | |
25268 | 2535 size_window (window, width, 1, nodelete); |
265 | 2536 } |
25268 | 2537 |
265 | 2538 |
362 | 2539 int window_select_count; |
265 | 2540 |
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2541 Lisp_Object |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2542 Fset_window_buffer_unwind (obuf) |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2543 Lisp_Object obuf; |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2544 { |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2545 Fset_buffer (obuf); |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2546 return Qnil; |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2547 } |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2548 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2549 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2550 /* 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
|
2551 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
|
2552 it's not allowed. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2553 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2554 void |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2555 set_window_buffer (window, buffer, run_hooks_p) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2556 Lisp_Object window, buffer; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2557 int run_hooks_p; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2558 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2559 struct window *w = XWINDOW (window); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2560 struct buffer *b = XBUFFER (buffer); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2561 int count = specpdl_ptr - specpdl; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2562 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2563 w->buffer = buffer; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2564 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2565 if (EQ (window, selected_window)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2566 b->last_selected_window = window; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2567 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2568 /* Update time stamps of buffer display. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2569 if (INTEGERP (b->display_count)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2570 XSETINT (b->display_count, XINT (b->display_count) + 1); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2571 b->display_time = Fcurrent_time (); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2572 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2573 XSETFASTINT (w->window_end_pos, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2574 XSETFASTINT (w->window_end_vpos, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2575 bzero (&w->last_cursor, sizeof w->last_cursor); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2576 w->window_end_valid = Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2577 XSETFASTINT (w->hscroll, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2578 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
|
2579 set_marker_restricted (w->start, |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2580 make_number (b->last_window_start), |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2581 buffer); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2582 w->start_at_line_beg = Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2583 w->force_start = Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2584 XSETFASTINT (w->last_modified, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2585 XSETFASTINT (w->last_overlay_modified, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2586 windows_or_buffers_changed++; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2587 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2588 /* 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
|
2589 If WINDOW is selected, switch permanently. |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2590 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
|
2591 if (EQ (window, selected_window)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2592 Fset_buffer (buffer); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2593 /* We can't check ! NILP (Vwindow_scroll_functions) here |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2594 because that might itself be a local variable. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2595 else if (window_initialized) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2596 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2597 record_unwind_protect (Fset_window_buffer_unwind, Fcurrent_buffer ()); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2598 Fset_buffer (buffer); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2599 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2600 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2601 /* 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
|
2602 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
|
2603 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2604 if (run_hooks_p) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2605 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2606 if (! NILP (Vwindow_scroll_functions)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2607 run_hook_with_args_2 (Qwindow_scroll_functions, window, |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2608 Fmarker_position (w->start)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2609 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2610 if (! NILP (Vwindow_configuration_change_hook) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2611 && ! NILP (Vrun_hooks)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2612 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2613 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2614 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2615 unbind_to (count, Qnil); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2616 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2617 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2618 |
265 | 2619 DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 2, 0, |
2620 "Make WINDOW display BUFFER as its contents.\n\ | |
2621 BUFFER can be a buffer or buffer name.") | |
2622 (window, buffer) | |
2623 register Lisp_Object window, buffer; | |
2624 { | |
2625 register Lisp_Object tem; | |
2626 register struct window *w = decode_window (window); | |
2627 | |
27848
27b993d2ea05
(Fset_window_buffer): Set WINDOW to the window
Gerd Moellmann <gerd@gnu.org>
parents:
27699
diff
changeset
|
2628 XSETWINDOW (window, w); |
265 | 2629 buffer = Fget_buffer (buffer); |
2630 CHECK_BUFFER (buffer, 1); | |
2631 | |
485 | 2632 if (NILP (XBUFFER (buffer)->name)) |
265 | 2633 error ("Attempt to display deleted buffer"); |
2634 | |
2635 tem = w->buffer; | |
485 | 2636 if (NILP (tem)) |
265 | 2637 error ("Window is deleted"); |
2638 else if (! EQ (tem, Qt)) /* w->buffer is t when the window | |
2639 is first being set up. */ | |
2640 { | |
485 | 2641 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
|
2642 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
|
2643 XSTRING (XBUFFER (tem)->name)->data); |
265 | 2644 |
2645 unshow_buffer (w); | |
2646 } | |
2647 | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2648 set_window_buffer (window, buffer, 1); |
265 | 2649 return Qnil; |
2650 } | |
2651 | |
2652 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, | |
2653 "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
|
2654 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
|
2655 Note that the main editor command loop\n\ |
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2656 selects the buffer of the selected window before each command.") |
265 | 2657 (window) |
2658 register Lisp_Object window; | |
2659 { | |
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2660 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
|
2661 } |
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2662 |
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2663 /* 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
|
2664 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
|
2665 |
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2666 static Lisp_Object |
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2667 select_window_1 (window, recordflag) |
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2668 register Lisp_Object window; |
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2669 int recordflag; |
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2670 { |
265 | 2671 register struct window *w; |
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2672 register struct window *ow; |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2673 struct frame *sf; |
265 | 2674 |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2675 CHECK_LIVE_WINDOW (window, 0); |
265 | 2676 |
2677 w = XWINDOW (window); | |
2678 | |
485 | 2679 if (NILP (w->buffer)) |
265 | 2680 error ("Trying to select deleted window or non-leaf window"); |
2681 | |
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2682 XSETFASTINT (w->use_time, ++window_select_count); |
265 | 2683 if (EQ (window, selected_window)) |
2684 return window; | |
2685 | |
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2686 if (!NILP (selected_window)) |
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2687 { |
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2688 ow = XWINDOW (selected_window); |
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2689 if (! NILP (ow->buffer)) |
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2690 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
|
2691 BUF_PT (XBUFFER (ow->buffer)), |
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2692 BUF_PT_BYTE (XBUFFER (ow->buffer))); |
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
2693 } |
265 | 2694 |
2695 selected_window = window; | |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2696 sf = SELECTED_FRAME (); |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2697 if (XFRAME (WINDOW_FRAME (w)) != sf) |
265 | 2698 { |
769 | 2699 XFRAME (WINDOW_FRAME (w))->selected_window = window; |
7080
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2700 /* Use this rather than Fhandle_switch_frame |
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2701 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
|
2702 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
|
2703 frame is active. */ |
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2704 Fselect_frame (WINDOW_FRAME (w), Qnil); |
265 | 2705 } |
2706 else | |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2707 sf->selected_window = window; |
265 | 2708 |
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2709 if (recordflag) |
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2710 record_buffer (w->buffer); |
265 | 2711 Fset_buffer (w->buffer); |
2712 | |
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
2713 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
|
2714 |
265 | 2715 /* Go to the point recorded in the window. |
2716 This is important when the buffer is in more | |
2717 than one window. It also matters when | |
2718 redisplay_window has altered point after scrolling, | |
2719 because it makes the change only in the window. */ | |
2720 { | |
2721 register int new_point = marker_position (w->pointm); | |
2722 if (new_point < BEGV) | |
2723 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
|
2724 else if (new_point > ZV) |
265 | 2725 SET_PT (ZV); |
2726 else | |
2727 SET_PT (new_point); | |
2728 } | |
2729 | |
2730 windows_or_buffers_changed++; | |
2731 return window; | |
2732 } | |
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2733 |
14175
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2734 /* 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
|
2735 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
|
2736 then return WINDOW. |
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2737 |
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2738 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
|
2739 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
|
2740 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
|
2741 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
|
2742 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
|
2743 |
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2744 static Lisp_Object |
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2745 display_buffer_1 (window) |
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2746 Lisp_Object window; |
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2747 { |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2748 Lisp_Object frame = XWINDOW (window)->frame; |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2749 FRAME_PTR f = XFRAME (frame); |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2750 |
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2751 FRAME_SAMPLE_VISIBILITY (f); |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2752 |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2753 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
|
2754 { |
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2755 if (FRAME_ICONIFIED_P (f)) |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2756 Fmake_frame_visible (frame); |
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2757 else if (FRAME_VISIBLE_P (f)) |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2758 Fraise_frame (frame); |
14535
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2759 } |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2760 |
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2761 return window; |
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2762 } |
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2763 |
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2764 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
|
2765 "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
|
2766 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
|
2767 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
|
2768 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
|
2769 (buffer_name) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2770 Lisp_Object buffer_name; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2771 { |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2772 Lisp_Object tem; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2773 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2774 CHECK_STRING (buffer_name, 1); |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2775 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2776 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
|
2777 if (!NILP (tem)) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2778 return Qt; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2779 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2780 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
|
2781 if (!NILP (tem)) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2782 return XCDR (tem); |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2783 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2784 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
|
2785 { |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2786 Lisp_Object car = XCAR (tem); |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2787 if (STRINGP (car) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2788 && 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
|
2789 return Qt; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2790 else if (CONSP (car) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2791 && STRINGP (XCAR (car)) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2792 && 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
|
2793 return XCDR (car); |
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2794 } |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2795 return Qnil; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2796 } |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2797 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2798 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
|
2799 "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
|
2800 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
|
2801 (buffer_name) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2802 Lisp_Object buffer_name; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2803 { |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2804 Lisp_Object tem; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2805 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2806 CHECK_STRING (buffer_name, 1); |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2807 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2808 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
|
2809 if (!NILP (tem)) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2810 return Qt; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2811 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2812 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
|
2813 if (!NILP (tem)) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2814 return Qt; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2815 |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2816 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
|
2817 { |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2818 Lisp_Object car = XCAR (tem); |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2819 if (STRINGP (car) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2820 && 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
|
2821 return Qt; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2822 else if (CONSP (car) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2823 && STRINGP (XCAR (car)) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2824 && 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
|
2825 return Qt; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2826 } |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2827 return Qnil; |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2828 } |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2829 |
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2830 /* Use B so the default is (other-buffer). */ |
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2831 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
|
2832 "BDisplay buffer: \nP", |
265 | 2833 "Make BUFFER appear in some window but don't select it.\n\ |
2834 BUFFER can be a buffer or a buffer name.\n\ | |
2835 If BUFFER is shown already in some window, just use that one,\n\ | |
2836 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
|
2837 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
|
2838 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
|
2839 Returns the window displaying BUFFER.\n\ |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2840 If `display-reuse-frames' is non-nil, and another frame is currently\n\ |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2841 displaying BUFFER, then simply raise that frame.\n\ |
15306
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2842 \n\ |
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2843 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
|
2844 `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
|
2845 buffer names are handled.\n\ |
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2846 \n\ |
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2847 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
|
2848 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
|
2849 If FRAME is t, search all frames.\n\ |
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2850 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
|
2851 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
|
2852 (actually the last nonminibuffer frame),\n\ |
32800
09e092438107
(Fdisplay_buffer): Fix doc.
Kenichi Handa <handa@m17n.org>
parents:
32773
diff
changeset
|
2853 unless `pop-up-frames' or `display-buffer-reuse-frames' is non-nil,\n\ |
34261
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
2854 which means search visible and iconified frames.\n\ |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
2855 \n\ |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
2856 If `even-window-heights' is non-nil, window heights will be evened out\n\ |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
2857 if displaying the buffer causes two vertically\ adjacent windows to be\n\ |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
2858 displayed.") |
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2859 (buffer, not_this_window, frame) |
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2860 register Lisp_Object buffer, not_this_window, frame; |
265 | 2861 { |
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2862 register Lisp_Object window, tem, swp; |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2863 struct frame *f; |
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2864 |
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2865 swp = Qnil; |
265 | 2866 buffer = Fget_buffer (buffer); |
2867 CHECK_BUFFER (buffer, 0); | |
2868 | |
485 | 2869 if (!NILP (Vdisplay_buffer_function)) |
265 | 2870 return call2 (Vdisplay_buffer_function, buffer, not_this_window); |
2871 | |
485 | 2872 if (NILP (not_this_window) |
265 | 2873 && 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
|
2874 return display_buffer_1 (selected_window); |
265 | 2875 |
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2876 /* 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
|
2877 in the selected window. */ |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2878 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
|
2879 { |
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2880 swp = Fsame_window_p (XBUFFER (buffer)->name); |
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2881 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
|
2882 { |
71304a70d0f6
(Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents:
10958
diff
changeset
|
2883 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
|
2884 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
|
2885 } |
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2886 } |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2887 |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2888 /* If the user wants pop-up-frames or display-reuse-frames, then |
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2889 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
|
2890 Otherwise search only the current frame. */ |
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2891 if (! NILP (frame)) |
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2892 tem = frame; |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2893 else if (pop_up_frames |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2894 || display_buffer_reuse_frames |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2895 || last_nonminibuf_frame == 0) |
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2896 XSETFASTINT (tem, 0); |
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2897 else |
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2898 XSETFRAME (tem, last_nonminibuf_frame); |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2899 |
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2900 window = Fget_buffer_window (buffer, tem); |
485 | 2901 if (!NILP (window) |
2902 && (NILP (not_this_window) || !EQ (window, selected_window))) | |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
2903 return display_buffer_1 (window); |
265 | 2904 |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2905 /* Certain buffer names get special handling. */ |
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2906 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
|
2907 { |
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2908 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
|
2909 if (EQ (tem, Qt)) |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2910 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
|
2911 if (CONSP (tem)) |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2912 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
|
2913 } |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2914 |
769 | 2915 /* If there are no frames open that have more than a minibuffer, |
2916 we need to create a new frame. */ | |
2917 if (pop_up_frames || last_nonminibuf_frame == 0) | |
265 | 2918 { |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2919 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
265 | 2920 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
|
2921 return display_buffer_1 (window); |
265 | 2922 } |
2923 | |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2924 f = SELECTED_FRAME (); |
358 | 2925 if (pop_up_windows |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2926 || 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
|
2927 /* 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
|
2928 don't try to reuse its windows. */ |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2929 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated)) |
358 | 2930 { |
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2931 Lisp_Object frames; |
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2932 |
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2933 frames = Qnil; |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2934 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
|
2935 XSETFRAME (frames, last_nonminibuf_frame); |
265 | 2936 /* Don't try to create a window if would get an error */ |
2937 if (split_height_threshold < window_min_height << 1) | |
2938 split_height_threshold = window_min_height << 1; | |
2939 | |
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2940 /* 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
|
2941 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
|
2942 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
|
2943 |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2944 /* 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
|
2945 try other frames. */ |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2946 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
|
2947 { |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2948 /* Try visible frames first. */ |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2949 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
|
2950 /* 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
|
2951 if (NILP (window)) |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2952 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
|
2953 if (NILP (window)) |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2954 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
|
2955 } |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2956 else |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2957 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
|
2958 |
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2959 /* 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
|
2960 split it. */ |
485 | 2961 if (!NILP (window) |
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2962 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
265 | 2963 && 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
|
2964 && WINDOW_FULL_WIDTH_P (XWINDOW (window))) |
265 | 2965 window = Fsplit_window (window, Qnil, Qnil); |
2966 else | |
2967 { | |
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2968 Lisp_Object upper, lower, other; |
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2969 |
769 | 2970 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
|
2971 /* 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
|
2972 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
|
2973 if (!NILP (window) |
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2974 && ! 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
|
2975 && (EQ (window, selected_window) |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2976 || EQ (XWINDOW (window)->parent, Qnil)) |
265 | 2977 && window_height (window) >= window_min_height << 1) |
2978 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
|
2979 /* 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
|
2980 |
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2981 /* Try visible frames first. */ |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2982 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
|
2983 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
|
2984 if (NILP (window)) |
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2985 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
|
2986 /* 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
|
2987 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
|
2988 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
|
2989 if (NILP (window)) |
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2990 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
|
2991 /* Try invisible frames. */ |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2992 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
|
2993 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
|
2994 if (NILP (window)) |
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2995 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
|
2996 /* 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
|
2997 if (NILP (window)) |
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2998 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
|
2999 /* 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
|
3000 even out their heights. */ |
11750
b911d6f75664
(Fdisplay_buffer): Initialize other, upper, lower.
Richard M. Stallman <rms@gnu.org>
parents:
11731
diff
changeset
|
3001 other = upper = lower = Qnil; |
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
3002 if (!NILP (XWINDOW (window)->prev)) |
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
3003 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
|
3004 if (!NILP (XWINDOW (window)->next)) |
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
3005 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
|
3006 if (!NILP (other) |
34261
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
3007 && !NILP (Veven_window_heights) |
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
3008 /* 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
|
3009 && !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
|
3010 && (XFASTINT (XWINDOW (other)->height) |
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
3011 > XFASTINT (XWINDOW (window)->height))) |
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
3012 { |
17365
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
3013 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
|
3014 + XFASTINT (XWINDOW (window)->height)); |
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3015 enlarge_window (upper, |
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3016 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
|
3017 0); |
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
3018 } |
265 | 3019 } |
3020 } | |
3021 else | |
3022 window = Fget_lru_window (Qnil); | |
3023 | |
3024 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
|
3025 return display_buffer_1 (window); |
265 | 3026 } |
3027 | |
3028 void | |
3029 temp_output_buffer_show (buf) | |
3030 register Lisp_Object buf; | |
3031 { | |
3032 register struct buffer *old = current_buffer; | |
3033 register Lisp_Object window; | |
3034 register struct window *w; | |
3035 | |
18493
d65021d5c39e
(temp_output_buffer_show): Copy default-directory from current buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18065
diff
changeset
|
3036 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
|
3037 |
265 | 3038 Fset_buffer (buf); |
10302
34556316a48a
(temp_output_buffer_show): Use BUF_SAVE_MODIFF.
Richard M. Stallman <rms@gnu.org>
parents:
10043
diff
changeset
|
3039 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; |
265 | 3040 BEGV = BEG; |
3041 ZV = Z; | |
3042 SET_PT (BEG); | |
25375 | 3043 XBUFFER (buf)->prevent_redisplay_optimizations_p = 1; |
265 | 3044 set_buffer_internal (old); |
3045 | |
3046 if (!EQ (Vtemp_buffer_show_function, Qnil)) | |
3047 call1 (Vtemp_buffer_show_function, buf); | |
3048 else | |
3049 { | |
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
3050 window = Fdisplay_buffer (buf, Qnil, Qnil); |
265 | 3051 |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
3052 if (!EQ (XWINDOW (window)->frame, selected_frame)) |
769 | 3053 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
265 | 3054 Vminibuf_scroll_window = window; |
3055 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
|
3056 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
|
3057 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
|
3058 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
|
3059 |
22149
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
3060 /* 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
|
3061 and it sbuffer current. */ |
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3062 if (!NILP (Vrun_hooks)) |
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
3063 { |
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3064 Lisp_Object tem; |
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3065 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
|
3066 if (!NILP (tem)) |
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
3067 { |
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3068 tem = Fsymbol_value (Qtemp_buffer_show_hook); |
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3069 if (!NILP (tem)) |
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3070 { |
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3071 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
|
3072 Lisp_Object prev_window; |
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
3073 prev_window = selected_window; |
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3074 |
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3075 /* 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
|
3076 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
|
3077 select_window_1 (window, 0); |
22149
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
3078 Fset_buffer (w->buffer); |
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3079 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
|
3080 select_window_1 (prev_window, 0); |
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3081 unbind_to (count, Qnil); |
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3082 } |
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
3083 } |
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
3084 } |
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
3085 } |
265 | 3086 } |
3087 | |
21514 | 3088 static void |
265 | 3089 make_dummy_parent (window) |
3090 Lisp_Object window; | |
3091 { | |
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
3092 Lisp_Object new; |
265 | 3093 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
|
3094 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
|
3095 int i; |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
3096 |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
3097 o = XWINDOW (window); |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
3098 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
|
3099 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
|
3100 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
|
3101 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
|
3102 p = (struct window *)vec; |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
3103 XSETWINDOW (new, p); |
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
3104 |
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3105 XSETFASTINT (p->sequence_number, ++sequence_number); |
265 | 3106 |
3107 /* Put new into window structure in place of window */ | |
3108 replace_window (window, new); | |
3109 | |
3110 o->next = Qnil; | |
3111 o->prev = Qnil; | |
3112 o->vchild = Qnil; | |
3113 o->hchild = Qnil; | |
3114 o->parent = new; | |
3115 | |
3116 p->start = Qnil; | |
3117 p->pointm = Qnil; | |
3118 p->buffer = Qnil; | |
3119 } | |
3120 | |
3121 DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", | |
3122 "Split WINDOW, putting SIZE lines in the first of the pair.\n\ | |
3123 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
|
3124 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
|
3125 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
|
3126 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
|
3127 (window, size, horflag) |
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3128 Lisp_Object window, size, horflag; |
265 | 3129 { |
3130 register Lisp_Object new; | |
3131 register struct window *o, *p; | |
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3132 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
|
3133 register int size_int; |
265 | 3134 |
485 | 3135 if (NILP (window)) |
265 | 3136 window = selected_window; |
3137 else | |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3138 CHECK_LIVE_WINDOW (window, 0); |
265 | 3139 |
3140 o = XWINDOW (window); | |
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3141 fo = XFRAME (WINDOW_FRAME (o)); |
265 | 3142 |
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3143 if (NILP (size)) |
265 | 3144 { |
485 | 3145 if (!NILP (horflag)) |
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3146 /* 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
|
3147 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
|
3148 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
|
3149 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
|
3150 size_int = (XFASTINT (o->width) + 1) >> 1; |
265 | 3151 else |
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3152 size_int = XFASTINT (o->height) >> 1; |
265 | 3153 } |
3154 else | |
3155 { | |
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3156 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
|
3157 size_int = XINT (size); |
265 | 3158 } |
3159 | |
3160 if (MINI_WINDOW_P (o)) | |
3161 error ("Attempt to split minibuffer window"); | |
25268 | 3162 else if (window_fixed_size_p (o, !NILP (horflag), 0)) |
3163 error ("Attempt to split fixed-size window"); | |
265 | 3164 |
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
3165 check_min_window_sizes (); |
265 | 3166 |
485 | 3167 if (NILP (horflag)) |
265 | 3168 { |
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3169 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
|
3170 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
|
3171 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
|
3172 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
|
3173 XFASTINT (o->height) - size_int); |
485 | 3174 if (NILP (o->parent) |
3175 || NILP (XWINDOW (o->parent)->vchild)) | |
265 | 3176 { |
3177 make_dummy_parent (window); | |
3178 new = o->parent; | |
3179 XWINDOW (new)->vchild = window; | |
3180 } | |
3181 } | |
3182 else | |
3183 { | |
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
3184 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
|
3185 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
|
3186 |
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
3187 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
|
3188 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
|
3189 XFASTINT (o->width) - size_int); |
485 | 3190 if (NILP (o->parent) |
3191 || NILP (XWINDOW (o->parent)->hchild)) | |
265 | 3192 { |
3193 make_dummy_parent (window); | |
3194 new = o->parent; | |
3195 XWINDOW (new)->hchild = window; | |
3196 } | |
3197 } | |
3198 | |
3199 /* Now we know that window's parent is a vertical combination | |
3200 if we are dividing vertically, or a horizontal combination | |
3201 if we are making side-by-side windows */ | |
3202 | |
3203 windows_or_buffers_changed++; | |
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3204 FRAME_WINDOW_SIZES_CHANGED (fo) = 1; |
265 | 3205 new = make_window (); |
3206 p = XWINDOW (new); | |
3207 | |
769 | 3208 p->frame = o->frame; |
265 | 3209 p->next = o->next; |
485 | 3210 if (!NILP (p->next)) |
265 | 3211 XWINDOW (p->next)->prev = new; |
3212 p->prev = window; | |
3213 o->next = new; | |
3214 p->parent = o->parent; | |
3215 p->buffer = Qt; | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3216 p->window_end_valid = Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3217 bzero (&p->last_cursor, sizeof p->last_cursor); |
265 | 3218 |
769 | 3219 /* Apportion the available frame space among the two new windows */ |
265 | 3220 |
485 | 3221 if (!NILP (horflag)) |
265 | 3222 { |
3223 p->height = o->height; | |
3224 p->top = o->top; | |
15902
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
3225 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
|
3226 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
|
3227 XSETFASTINT (p->left, XFASTINT (o->left) + size_int); |
265 | 3228 } |
3229 else | |
3230 { | |
3231 p->left = o->left; | |
3232 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
|
3233 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
|
3234 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
|
3235 XSETFASTINT (p->top, XFASTINT (o->top) + size_int); |
265 | 3236 } |
3237 | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3238 /* Adjust glyph matrices. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3239 adjust_glyphs (fo); |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3240 Fset_window_buffer (new, o->buffer); |
265 | 3241 return new; |
3242 } | |
3243 | |
3244 DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p", | |
3245 "Make current window ARG lines bigger.\n\ | |
3246 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
|
3247 (arg, side) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3248 register Lisp_Object arg, side; |
265 | 3249 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3250 CHECK_NUMBER (arg, 0); |
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3251 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
|
3252 |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3253 if (! NILP (Vwindow_configuration_change_hook)) |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3254 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3255 |
265 | 3256 return Qnil; |
3257 } | |
3258 | |
3259 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", | |
3260 "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
|
3261 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
|
3262 (arg, side) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3263 register Lisp_Object arg, side; |
265 | 3264 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3265 CHECK_NUMBER (arg, 0); |
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3266 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
|
3267 |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3268 if (! NILP (Vwindow_configuration_change_hook)) |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3269 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3270 |
265 | 3271 return Qnil; |
3272 } | |
3273 | |
3274 int | |
3275 window_height (window) | |
3276 Lisp_Object window; | |
3277 { | |
3278 register struct window *p = XWINDOW (window); | |
3279 return XFASTINT (p->height); | |
3280 } | |
3281 | |
3282 int | |
3283 window_width (window) | |
3284 Lisp_Object window; | |
3285 { | |
3286 register struct window *p = XWINDOW (window); | |
3287 return XFASTINT (p->width); | |
3288 } | |
3289 | |
25254 | 3290 |
265 | 3291 #define CURBEG(w) \ |
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3292 *(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top)) |
265 | 3293 |
3294 #define CURSIZE(w) \ | |
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3295 *(widthflag ? &(XWINDOW (w)->width) : &(XWINDOW (w)->height)) |
265 | 3296 |
25268 | 3297 |
3298 /* Enlarge selected_window by DELTA. WIDTHFLAG non-zero means | |
3299 increase its width. Siblings of the selected window are resized to | |
3300 fullfil the size request. If they become too small in the process, | |
3301 they will be deleted. */ | |
265 | 3302 |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3303 static void |
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3304 enlarge_window (window, delta, widthflag) |
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3305 Lisp_Object window; |
25268 | 3306 int delta, widthflag; |
265 | 3307 { |
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3308 Lisp_Object parent, next, prev; |
25268 | 3309 struct window *p; |
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3310 Lisp_Object *sizep; |
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3311 int maximum; |
20351 | 3312 int (*sizefun) P_ ((Lisp_Object)) |
3313 = widthflag ? window_width : window_height; | |
25268 | 3314 void (*setsizefun) P_ ((Lisp_Object, int, int)) |
20351 | 3315 = (widthflag ? set_window_width : set_window_height); |
25268 | 3316 |
3317 /* Check values of window_min_width and window_min_height for | |
3318 validity. */ | |
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
3319 check_min_window_sizes (); |
265 | 3320 |
25268 | 3321 /* Give up if this window cannot be resized. */ |
3322 if (window_fixed_size_p (XWINDOW (window), widthflag, 1)) | |
3323 error ("Window is not resizable"); | |
3324 | |
3325 /* Find the parent of the selected window. */ | |
265 | 3326 while (1) |
3327 { | |
3328 p = XWINDOW (window); | |
3329 parent = p->parent; | |
25268 | 3330 |
485 | 3331 if (NILP (parent)) |
265 | 3332 { |
3333 if (widthflag) | |
3334 error ("No other window to side of this one"); | |
3335 break; | |
3336 } | |
25268 | 3337 |
3338 if (widthflag | |
3339 ? !NILP (XWINDOW (parent)->hchild) | |
485 | 3340 : !NILP (XWINDOW (parent)->vchild)) |
265 | 3341 break; |
25268 | 3342 |
265 | 3343 window = parent; |
3344 } | |
3345 | |
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3346 sizep = &CURSIZE (window); |
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3347 |
265 | 3348 { |
3349 register int maxdelta; | |
3350 | |
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3351 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep) |
25254 | 3352 : !NILP (p->next) ? ((*sizefun) (p->next) |
3353 - 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
|
3354 widthflag, 0, 0)) |
25254 | 3355 : !NILP (p->prev) ? ((*sizefun) (p->prev) |
3356 - 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
|
3357 widthflag, 0, 0)) |
769 | 3358 /* This is a frame with only one window, a minibuffer-only |
3359 or a minibufferless frame. */ | |
432 | 3360 : (delta = 0)); |
265 | 3361 |
3362 if (delta > maxdelta) | |
3363 /* This case traps trying to make the minibuffer | |
769 | 3364 the full frame, or make the only window aside from the |
3365 minibuffer the full frame. */ | |
265 | 3366 delta = maxdelta; |
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3367 } |
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3368 |
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3369 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
|
3370 { |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3371 delete_window (window); |
432 | 3372 return; |
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3373 } |
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3374 |
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3375 if (delta == 0) |
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3376 return; |
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3377 |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3378 /* 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
|
3379 maximum = 0; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3380 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) |
25254 | 3381 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
|
3382 widthflag, 0, 0); |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3383 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) |
25254 | 3384 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
|
3385 widthflag, 0, 0); |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3386 |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3387 /* 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
|
3388 if (delta <= maximum) |
265 | 3389 { |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3390 Lisp_Object first_unaffected; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3391 Lisp_Object first_affected; |
25268 | 3392 int fixed_p; |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3393 |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3394 next = p->next; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3395 prev = p->prev; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3396 first_affected = window; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3397 /* 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
|
3398 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
|
3399 and take as much as we can get without deleting that sibling. */ |
25268 | 3400 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
|
3401 { |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3402 if (! NILP (next)) |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3403 { |
25254 | 3404 int this_one = ((*sizefun) (next) |
25268 | 3405 - window_min_size (XWINDOW (next), |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3406 widthflag, 0, &fixed_p)); |
25268 | 3407 if (!fixed_p) |
3408 { | |
3409 if (this_one > delta) | |
3410 this_one = delta; | |
3411 | |
3412 (*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
|
3413 (*setsizefun) (window, XINT (*sizep) + this_one, 0); |
25268 | 3414 |
3415 delta -= this_one; | |
3416 } | |
3417 | |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3418 next = XWINDOW (next)->next; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3419 } |
25268 | 3420 |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3421 if (delta == 0) |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3422 break; |
25268 | 3423 |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3424 if (! NILP (prev)) |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3425 { |
25254 | 3426 int this_one = ((*sizefun) (prev) |
25268 | 3427 - window_min_size (XWINDOW (prev), |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3428 widthflag, 0, &fixed_p)); |
25268 | 3429 if (!fixed_p) |
3430 { | |
3431 if (this_one > delta) | |
3432 this_one = delta; | |
3433 | |
3434 first_affected = prev; | |
3435 | |
3436 (*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
|
3437 (*setsizefun) (window, XINT (*sizep) + this_one, 0); |
25268 | 3438 |
3439 delta -= this_one; | |
3440 } | |
3441 | |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3442 prev = XWINDOW (prev)->prev; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3443 } |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3444 } |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3445 |
25268 | 3446 xassert (delta == 0); |
3447 | |
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3448 /* 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
|
3449 based on the new sizes. */ |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3450 first_unaffected = next; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3451 prev = first_affected; |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3452 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
|
3453 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
|
3454 { |
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3455 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
|
3456 /* 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
|
3457 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
|
3458 (*setsizefun) (next, (*sizefun) (next), 0); |
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3459 } |
265 | 3460 } |
3461 else | |
3462 { | |
3463 register int delta1; | |
3464 register int opht = (*sizefun) (parent); | |
3465 | |
3466 /* If trying to grow this window to or beyond size of the parent, | |
3467 make delta1 so big that, on shrinking back down, | |
3468 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
|
3469 if (opht <= XINT (*sizep) + delta) |
265 | 3470 delta1 = opht * opht * 2; |
3471 else | |
25268 | 3472 { |
3473 /* Otherwise, make delta1 just right so that if we add | |
3474 delta1 lines to this window and to the parent, and then | |
3475 shrink the parent back to its original size, the new | |
3476 proportional size of this window will increase by delta. | |
3477 | |
3478 The function size_window will compute the new height h' | |
3479 of the window from delta1 as: | |
3480 | |
3481 e = delta1/n | |
3482 x = delta1 - delta1/n * n for the 1st resizable child | |
3483 h' = h + e + x | |
3484 | |
3485 where n is the number of children that can be resized. | |
3486 We can ignore x by choosing a delta1 that is a multiple of | |
3487 n. We want the height of this window to come out as | |
3488 | |
3489 h' = h + delta | |
3490 | |
3491 So, delta1 must be | |
3492 | |
3493 h + e = h + delta | |
3494 delta1/n = delta | |
3495 delta1 = n * delta. | |
3496 | |
3497 The number of children n rquals the number of resizable | |
3498 children of this window + 1 because we know window itself | |
3499 is resizable (otherwise we would have signalled an error. */ | |
3500 | |
3501 struct window *w = XWINDOW (window); | |
3502 Lisp_Object s; | |
3503 int n = 1; | |
3504 | |
3505 for (s = w->next; !NILP (s); s = XWINDOW (s)->next) | |
3506 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) | |
3507 ++n; | |
3508 for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev) | |
3509 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) | |
3510 ++n; | |
3511 | |
3512 delta1 = n * delta; | |
3513 } | |
265 | 3514 |
3515 /* Add delta1 lines or columns to this window, and to the parent, | |
3516 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
|
3517 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
|
3518 (*setsizefun) (window, XINT (*sizep) + delta1, 0); |
265 | 3519 |
3520 /* Squeeze out delta1 lines or columns from our parent, | |
3521 shriking this window and siblings proportionately. | |
3522 This brings parent back to correct size. | |
3523 Delta1 was calculated so this makes this window the desired size, | |
3524 taking it all out of the siblings. */ | |
3525 (*setsizefun) (parent, opht, 0); | |
3526 } | |
3527 | |
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3528 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
|
3529 XSETFASTINT (p->last_overlay_modified, 0); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3530 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3531 /* Adjust glyph matrices. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3532 adjust_glyphs (XFRAME (WINDOW_FRAME (XWINDOW (window)))); |
265 | 3533 } |
25254 | 3534 |
265 | 3535 #undef CURBEG |
3536 #undef CURSIZE | |
3537 | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3538 |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3539 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3540 /*********************************************************************** |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3541 Resizing Mini-Windows |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3542 ***********************************************************************/ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3543 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3544 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
|
3545 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3546 enum save_restore_action |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3547 { |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3548 CHECK_ORIG_SIZES, |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3549 SAVE_ORIG_SIZES, |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3550 RESTORE_ORIG_SIZES |
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 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3553 static int save_restore_orig_size P_ ((struct window *, |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3554 enum save_restore_action)); |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3555 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3556 /* 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
|
3557 from lowest windows first. */ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3558 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3559 static void |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3560 shrink_window_lowest_first (w, height) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3561 struct window *w; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3562 int height; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3563 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3564 struct window *c; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3565 Lisp_Object child; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3566 int old_height; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3567 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3568 xassert (!MINI_WINDOW_P (w)); |
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 /* Set redisplay hints. */ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3571 XSETFASTINT (w->last_modified, 0); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3572 XSETFASTINT (w->last_overlay_modified, 0); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3573 windows_or_buffers_changed++; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3574 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
|
3575 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3576 old_height = XFASTINT (w->height); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3577 XSETFASTINT (w->height, height); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3578 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3579 if (!NILP (w->hchild)) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3580 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3581 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
|
3582 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3583 c = XWINDOW (child); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3584 c->top = w->top; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3585 shrink_window_lowest_first (c, height); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3586 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3587 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3588 else if (!NILP (w->vchild)) |
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 Lisp_Object last_child; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3591 int delta = old_height - height; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3592 int last_top; |
31829
43566b0aec59
Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents:
31393
diff
changeset
|
3593 |
43566b0aec59
Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents:
31393
diff
changeset
|
3594 last_child = Qnil; |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3595 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3596 /* 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
|
3597 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
|
3598 backwards. */ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3599 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
|
3600 last_child = child; |
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 /* 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
|
3603 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
|
3604 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3605 int this_one; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3606 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3607 c = XWINDOW (child); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3608 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
|
3609 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3610 if (this_one > delta) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3611 this_one = delta; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3612 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3613 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
|
3614 delta -= this_one; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3615 } |
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 /* Compute new positions. */ |
28463
4591d285fb65
* window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents:
28417
diff
changeset
|
3618 last_top = XINT (w->top); |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3619 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
|
3620 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3621 c = XWINDOW (child); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3622 c->top = make_number (last_top); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3623 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
|
3624 last_top += XFASTINT (c->height); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3625 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3626 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3627 } |
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 |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3630 /* 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
|
3631 rooted at W. ACTION says what to do. |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3632 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3633 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
|
3634 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
|
3635 non-zero if they are valid. |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3636 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3637 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
|
3638 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
|
3639 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3640 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
|
3641 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
|
3642 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3643 static int |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3644 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
|
3645 struct window *w; |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3646 enum save_restore_action action; |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3647 { |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3648 int success_p = 1; |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3649 |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3650 while (w) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3651 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3652 if (!NILP (w->hchild)) |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3653 { |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3654 if (!save_restore_orig_size (XWINDOW (w->hchild), action)) |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3655 success_p = 0; |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3656 } |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3657 else if (!NILP (w->vchild)) |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3658 { |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3659 if (!save_restore_orig_size (XWINDOW (w->vchild), action)) |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3660 success_p = 0; |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3661 } |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3662 |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3663 switch (action) |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3664 { |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3665 case CHECK_ORIG_SIZES: |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3666 if (!INTEGERP (w->orig_top) || !INTEGERP (w->orig_height)) |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3667 return 0; |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3668 break; |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3669 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3670 case SAVE_ORIG_SIZES: |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3671 w->orig_top = w->top; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3672 w->orig_height = w->height; |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3673 XSETFASTINT (w->last_modified, 0); |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3674 XSETFASTINT (w->last_overlay_modified, 0); |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3675 break; |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3676 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3677 case RESTORE_ORIG_SIZES: |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3678 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
|
3679 w->top = w->orig_top; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3680 w->height = w->orig_height; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3681 w->orig_height = w->orig_top = Qnil; |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3682 XSETFASTINT (w->last_modified, 0); |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3683 XSETFASTINT (w->last_overlay_modified, 0); |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3684 break; |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3685 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3686 default: |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3687 abort (); |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3688 } |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3689 |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3690 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
|
3691 } |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3692 |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3693 return success_p; |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3694 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3695 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3696 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3697 /* 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
|
3698 without deleting other windows. */ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3699 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3700 void |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3701 grow_mini_window (w, delta) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3702 struct window *w; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3703 int delta; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3704 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3705 struct frame *f = XFRAME (w->frame); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3706 struct window *root; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3707 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3708 xassert (MINI_WINDOW_P (w)); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3709 xassert (delta >= 0); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3710 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3711 /* 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
|
3712 validity. */ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3713 check_min_window_sizes (); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3714 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3715 /* 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
|
3716 other windows. */ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3717 root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3718 if (delta) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3719 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3720 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
|
3721 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
|
3722 delta = XFASTINT (root->height) - min_height; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3723 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3724 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3725 if (delta) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3726 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3727 /* 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
|
3728 if (!save_restore_orig_size (root, CHECK_ORIG_SIZES)) |
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3729 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
|
3730 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3731 /* Shrink other windows. */ |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3732 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
|
3733 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3734 /* 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
|
3735 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
|
3736 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
|
3737 XSETFASTINT (w->last_modified, 0); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3738 XSETFASTINT (w->last_overlay_modified, 0); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3739 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3740 adjust_glyphs (f); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3741 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3742 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3743 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3744 |
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3745 /* 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
|
3746 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
|
3747 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
|
3748 line. */ |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3749 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3750 void |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3751 shrink_mini_window (w) |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3752 struct window *w; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3753 { |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3754 struct frame *f = XFRAME (w->frame); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3755 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
|
3756 |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3757 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
|
3758 { |
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3759 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
|
3760 adjust_glyphs (f); |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3761 FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3762 windows_or_buffers_changed = 1; |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3763 } |
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3764 else if (XFASTINT (w->height) > 1) |
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3765 { |
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3766 Lisp_Object window; |
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3767 XSETWINDOW (window, w); |
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3768 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
|
3769 } |
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3770 } |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3771 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3772 |
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3773 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3774 /* 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
|
3775 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
|
3776 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
|
3777 the frame are cleared. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3778 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3779 void |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3780 mark_window_cursors_off (w) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3781 struct window *w; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3782 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3783 while (w) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3784 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3785 if (!NILP (w->hchild)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3786 mark_window_cursors_off (XWINDOW (w->hchild)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3787 else if (!NILP (w->vchild)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3788 mark_window_cursors_off (XWINDOW (w->vchild)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3789 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3790 w->phys_cursor_on_p = 0; |
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 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
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 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3796 |
265 | 3797 /* Return number of lines of text (not counting mode line) in W. */ |
3798 | |
3799 int | |
3800 window_internal_height (w) | |
3801 struct window *w; | |
3802 { | |
3803 int ht = XFASTINT (w->height); | |
3804 | |
3805 if (MINI_WINDOW_P (w)) | |
3806 return ht; | |
3807 | |
485 | 3808 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild) |
3809 || !NILP (w->next) || !NILP (w->prev) | |
769 | 3810 || FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (w)))) |
265 | 3811 return ht - 1; |
3812 | |
3813 return ht; | |
3814 } | |
3815 | |
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3816 |
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3817 /* 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
|
3818 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
|
3819 separating W from the sibling to its right. */ |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3820 |
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3821 int |
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3822 window_internal_width (w) |
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3823 struct window *w; |
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3824 { |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3825 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
|
3826 int width = XINT (w->width); |
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3827 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1931
diff
changeset
|
3828 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3829 /* Scroll bars occupy a few columns. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3830 width -= FRAME_SCROLL_BAR_COLS (f); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3831 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
|
3832 /* The column of `|' characters separating side-by-side windows |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3833 occupies one column only. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3834 width -= 1; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3835 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3836 /* 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
|
3837 are used to display bitmaps there. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3838 if (FRAME_WINDOW_P (f)) |
25462
19b101d6ee2a
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
25402
diff
changeset
|
3839 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
|
3840 |
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
3841 return width; |
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3842 } |
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3843 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3844 |
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 Window Scrolling |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3847 ***********************************************************************/ |
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 /* 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
|
3850 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
|
3851 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
|
3852 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
|
3853 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
|
3854 respectively. */ |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3855 |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3856 static void |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3857 window_scroll (window, n, whole, noerror) |
265 | 3858 Lisp_Object window; |
3859 int n; | |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3860 int whole; |
522 | 3861 int noerror; |
265 | 3862 { |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3863 /* 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
|
3864 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
|
3865 if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3866 window_scroll_pixel_based (window, n, whole, noerror); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3867 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3868 window_scroll_line_based (window, n, whole, noerror); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3869 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3870 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3871 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3872 /* 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
|
3873 heights. See the comment of window_scroll for parameter |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3874 descriptions. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3875 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3876 static void |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3877 window_scroll_pixel_based (window, n, whole, noerror) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3878 Lisp_Object window; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3879 int n; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3880 int whole; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3881 int noerror; |
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 struct it it; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3884 struct window *w = XWINDOW (window); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3885 struct text_pos start; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3886 Lisp_Object tem; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3887 int this_scroll_margin; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3888 int preserve_y; |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3889 /* True if we fiddled the window vscroll field without really scrolling. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3890 int vscrolled = 0; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3891 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3892 SET_TEXT_POS_FROM_MARKER (start, w->start); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3893 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3894 /* 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
|
3895 the screen. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3896 XSETFASTINT (tem, PT); |
32773
a7fdbf39d4de
(window_scroll_pixel_based, window_scroll_line_based):
Miles Bader <miles@gnu.org>
parents:
32752
diff
changeset
|
3897 tem = Fpos_visible_in_window_p (tem, window, Qnil); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3898 if (NILP (tem)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3899 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3900 /* 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
|
3901 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
|
3902 results for variable height lines. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3903 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
|
3904 it.current_y = it.last_visible_y; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3905 move_it_vertically (&it, -it.last_visible_y / 2); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3906 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3907 /* 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
|
3908 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
|
3909 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
|
3910 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
|
3911 start of the line containing PT in this case. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3912 if (it.current_y <= 0) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3913 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3914 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
|
3915 move_it_vertically (&it, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3916 it.current_y = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3917 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3918 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3919 start = it.current.pos; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3920 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3921 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3922 /* 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
|
3923 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
|
3924 if (!NILP (Vscroll_preserve_screen_position)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3925 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3926 start_display (&it, w, start); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3927 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
|
3928 preserve_y = it.current_y; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3929 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3930 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3931 preserve_y = -1; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3932 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3933 /* 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
|
3934 backward. The result is the new window start. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3935 start_display (&it, w, start); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3936 if (whole) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3937 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3938 int screen_full = (it.last_visible_y |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3939 - next_screen_context_lines * CANON_Y_UNIT (it.f)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3940 int direction = n < 0 ? -1 : 1; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3941 move_it_vertically (&it, direction * screen_full); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3942 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3943 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3944 move_it_by_lines (&it, n, 1); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3945 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3946 /* End if we end up at ZV or BEGV. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3947 if ((n > 0 && IT_CHARPOS (it) == ZV) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3948 || (n < 0 && IT_CHARPOS (it) == CHARPOS (start))) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3949 { |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3950 if (IT_CHARPOS (it) == ZV) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3951 { |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3952 if (it.current_y + it.max_ascent + it.max_descent |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3953 > it.last_visible_y) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3954 /* The last line was only partially visible, make it fully |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3955 visible. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3956 w->vscroll = |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3957 it.last_visible_y |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3958 - it.current_y + it.max_ascent + it.max_descent; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3959 else if (noerror) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3960 return; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3961 else |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3962 Fsignal (Qend_of_buffer, Qnil); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3963 } |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3964 else |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3965 { |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3966 if (w->vscroll != 0) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3967 /* The first line was only partially visible, make it fully |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3968 visible. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3969 w->vscroll = 0; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3970 else if (noerror) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3971 return; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3972 else |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3973 Fsignal (Qbeginning_of_buffer, Qnil); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3974 } |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3975 |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3976 /* If control gets here, then we vscrolled. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3977 |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3978 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3979 |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3980 /* Don't try to change the window start below. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3981 vscrolled = 1; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3982 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3983 |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3984 if (! vscrolled) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3985 { |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3986 /* Set the window start, and set up the window for redisplay. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3987 set_marker_restricted (w->start, make_number (IT_CHARPOS (it)), |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3988 w->buffer); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3989 w->start_at_line_beg = Fbolp (); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3990 w->update_mode_line = Qt; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3991 XSETFASTINT (w->last_modified, 0); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3992 XSETFASTINT (w->last_overlay_modified, 0); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3993 /* Set force_start so that redisplay_window will run the |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3994 window-scroll-functions. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3995 w->force_start = Qt; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
3996 } |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3997 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3998 it.current_y = it.vpos = 0; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3999 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4000 /* Preserve the screen position if we must. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4001 if (preserve_y >= 0) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4002 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4003 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
|
4004 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4005 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4006 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4007 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4008 /* Move PT out of scroll margins. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4009 this_scroll_margin = max (0, scroll_margin); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4010 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
|
4011 this_scroll_margin *= CANON_Y_UNIT (it.f); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4012 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4013 if (n > 0) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4014 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4015 /* 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
|
4016 in the scroll margin at the top. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4017 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
|
4018 while (it.current_y < this_scroll_margin) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4019 move_it_by_lines (&it, 1, 1); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4020 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4021 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4022 else if (n < 0) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4023 { |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4024 int charpos, bytepos; |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4025 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4026 /* 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
|
4027 in the scroll margin at the bottom. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4028 move_it_to (&it, PT, -1, |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4029 it.last_visible_y - this_scroll_margin - 1, -1, |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4030 MOVE_TO_POS | MOVE_TO_Y); |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4031 |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4032 /* Save our position, in case it's correct. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4033 charpos = IT_CHARPOS (it); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4034 bytepos = IT_BYTEPOS (it); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4035 |
34381
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4036 /* See if point is on a partially visible line at the end. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4037 move_it_by_lines (&it, 1, 1); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4038 if (it.current_y > it.last_visible_y) |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4039 /* The last line was only partially visible, so back up two |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4040 lines to make sure we're on a fully visible line. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4041 { |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4042 move_it_by_lines (&it, -2, 0); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4043 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4044 } |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4045 else |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4046 /* No, the position we saved is OK, so use it. */ |
f9d7bc96177b
(Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents:
34277
diff
changeset
|
4047 SET_PT_BOTH (charpos, bytepos); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4048 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4049 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4050 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4051 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4052 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4053 /* 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
|
4054 See the comment of window_scroll for parameter descriptions. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4055 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4056 static void |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4057 window_scroll_line_based (window, n, whole, noerror) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4058 Lisp_Object window; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4059 int n; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4060 int whole; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4061 int noerror; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4062 { |
265 | 4063 register struct window *w = XWINDOW (window); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4064 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
|
4065 register int pos, pos_byte; |
265 | 4066 register int ht = window_internal_height (w); |
4067 register Lisp_Object tem; | |
4068 int lose; | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4069 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
|
4070 int startpos; |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4071 struct position posit; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4072 int original_vpos; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4073 |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4074 startpos = marker_position (w->start); |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4075 |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4076 posit = *compute_motion (startpos, 0, 0, 0, |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4077 PT, ht, 0, |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4078 window_internal_width (w), XINT (w->hscroll), |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4079 0, w); |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4080 original_vpos = posit.vpos; |
13102
960db92441d8
(window_scroll): Always set force_start.
Richard M. Stallman <rms@gnu.org>
parents:
12981
diff
changeset
|
4081 |
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4082 XSETFASTINT (tem, PT); |
32773
a7fdbf39d4de
(window_scroll_pixel_based, window_scroll_line_based):
Miles Bader <miles@gnu.org>
parents:
32752
diff
changeset
|
4083 tem = Fpos_visible_in_window_p (tem, window, Qnil); |
265 | 4084 |
485 | 4085 if (NILP (tem)) |
265 | 4086 { |
6341
dfc758dd2b08
(window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents:
6326
diff
changeset
|
4087 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
|
4088 startpos = PT; |
265 | 4089 } |
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
|
4090 |
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
|
4091 SET_PT (startpos); |
7347 | 4092 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
|
4093 Fvertical_motion (make_number (n), window); |
7347 | 4094 pos = PT; |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4095 pos_byte = PT_BYTE; |
265 | 4096 bolp = Fbolp (); |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4097 SET_PT_BOTH (opoint, opoint_byte); |
265 | 4098 |
4099 if (lose) | |
522 | 4100 { |
4101 if (noerror) | |
4102 return; | |
4103 else | |
4104 Fsignal (Qbeginning_of_buffer, Qnil); | |
4105 } | |
265 | 4106 |
4107 if (pos < ZV) | |
4108 { | |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4109 int this_scroll_margin = scroll_margin; |
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4110 |
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4111 /* 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
|
4112 if (this_scroll_margin < 0) |
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4113 this_scroll_margin = 0; |
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4114 |
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4115 if (XINT (w->height) < 4 * scroll_margin) |
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4116 this_scroll_margin = XINT (w->height) / 4; |
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4117 |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4118 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); |
265 | 4119 w->start_at_line_beg = bolp; |
4120 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
|
4121 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
|
4122 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
|
4123 /* 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
|
4124 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
|
4125 w->force_start = Qt; |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4126 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4127 if (whole && !NILP (Vscroll_preserve_screen_position)) |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4128 { |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4129 SET_PT_BOTH (pos, pos_byte); |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4130 Fvertical_motion (make_number (original_vpos), window); |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4131 } |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4132 /* 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
|
4133 that it is outside the scroll margin. */ |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4134 else if (n > 0) |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4135 { |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4136 int top_margin; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4137 |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4138 if (this_scroll_margin > 0) |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4139 { |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4140 SET_PT_BOTH (pos, pos_byte); |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4141 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
|
4142 top_margin = PT; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4143 } |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4144 else |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4145 top_margin = pos; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4146 |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4147 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
|
4148 SET_PT_BOTH (opoint, opoint_byte); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4149 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
|
4150 { |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4151 SET_PT_BOTH (pos, pos_byte); |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4152 Fvertical_motion (make_number (original_vpos), window); |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4153 } |
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4154 else |
20046
8baac8399a29
(window_scroll): When scrolling forward and point is
Karl Heuer <kwzh@gnu.org>
parents:
19667
diff
changeset
|
4155 SET_PT (top_margin); |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4156 } |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4157 else if (n < 0) |
265 | 4158 { |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4159 int bottom_margin; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4160 |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4161 /* 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
|
4162 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
|
4163 SET_PT_BOTH (pos, pos_byte); |
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
4164 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
|
4165 if (XFASTINT (tem) == ht - this_scroll_margin) |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4166 bottom_margin = PT; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4167 else |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4168 bottom_margin = PT + 1; |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4169 |
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4170 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
|
4171 SET_PT_BOTH (opoint, opoint_byte); |
265 | 4172 else |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4173 { |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4174 if (!NILP (Vscroll_preserve_screen_position)) |
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4175 { |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4176 SET_PT_BOTH (pos, pos_byte); |
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4177 Fvertical_motion (make_number (original_vpos), window); |
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4178 } |
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4179 else |
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
4180 Fvertical_motion (make_number (-1), window); |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4181 } |
265 | 4182 } |
4183 } | |
4184 else | |
522 | 4185 { |
4186 if (noerror) | |
4187 return; | |
4188 else | |
4189 Fsignal (Qend_of_buffer, Qnil); | |
4190 } | |
265 | 4191 } |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4192 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4193 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4194 /* 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
|
4195 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
|
4196 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
|
4197 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
|
4198 up. This is the guts of Fscroll_up and Fscroll_down. */ |
265 | 4199 |
4200 static void | |
4201 scroll_command (n, direction) | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4202 Lisp_Object n; |
265 | 4203 int direction; |
4204 { | |
4205 register int defalt; | |
4206 int count = specpdl_ptr - specpdl; | |
4207 | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4208 xassert (abs (direction) == 1); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4209 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4210 /* 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
|
4211 the moment. But don't screw up if window_scroll gets an error. */ |
265 | 4212 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
548 | 4213 { |
4214 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
4215 Fset_buffer (XWINDOW (selected_window)->buffer); | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4216 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4217 /* Make redisplay consider other windows than just selected_window. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4218 ++windows_or_buffers_changed; |
548 | 4219 } |
265 | 4220 |
4221 defalt = (window_internal_height (XWINDOW (selected_window)) | |
4222 - next_screen_context_lines); | |
4223 defalt = direction * (defalt < 1 ? 1 : defalt); | |
4224 | |
485 | 4225 if (NILP (n)) |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4226 window_scroll (selected_window, defalt, 1, 0); |
265 | 4227 else if (EQ (n, Qminus)) |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4228 window_scroll (selected_window, - defalt, 1, 0); |
265 | 4229 else |
4230 { | |
4231 n = Fprefix_numeric_value (n); | |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4232 window_scroll (selected_window, XINT (n) * direction, 0, 0); |
265 | 4233 } |
548 | 4234 |
4235 unbind_to (count, Qnil); | |
265 | 4236 } |
4237 | |
4238 DEFUN ("scroll-up", Fscroll_up, Sscroll_up, 0, 1, "P", | |
4239 "Scroll text of current window upward ARG lines; or near full screen if no ARG.\n\ | |
4240 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
|
4241 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
|
4242 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
|
4243 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
|
4244 (arg) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4245 Lisp_Object arg; |
265 | 4246 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4247 scroll_command (arg, 1); |
265 | 4248 return Qnil; |
4249 } | |
4250 | |
4251 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
|
4252 "Scroll text of current window down ARG lines; or near full screen if no ARG.\n\ |
265 | 4253 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
|
4254 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
|
4255 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
|
4256 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
|
4257 (arg) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4258 Lisp_Object arg; |
265 | 4259 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4260 scroll_command (arg, -1); |
265 | 4261 return Qnil; |
4262 } | |
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4263 |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4264 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
|
4265 "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
|
4266 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
|
4267 specifies the window.\n\ |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4268 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
|
4269 showing that buffer is used.") |
8059
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
4270 () |
265 | 4271 { |
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4272 Lisp_Object window; |
265 | 4273 |
4274 if (MINI_WINDOW_P (XWINDOW (selected_window)) | |
485 | 4275 && !NILP (Vminibuf_scroll_window)) |
265 | 4276 window = Vminibuf_scroll_window; |
4277 /* If buffer is specified, scroll that buffer. */ | |
485 | 4278 else if (!NILP (Vother_window_scroll_buffer)) |
265 | 4279 { |
4280 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); | |
485 | 4281 if (NILP (window)) |
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
4282 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt, Qnil); |
265 | 4283 } |
4284 else | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4285 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4286 /* 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
|
4287 frame. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4288 window = Fnext_window (selected_window, Qnil, Qnil); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4289 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4290 if (EQ (window, selected_window)) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4291 /* 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
|
4292 visible frame. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4293 do |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4294 window = Fnext_window (window, Qnil, Qt); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4295 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
|
4296 && ! EQ (window, selected_window)); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4297 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4298 |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4299 CHECK_LIVE_WINDOW (window, 0); |
265 | 4300 |
4301 if (EQ (window, selected_window)) | |
4302 error ("There is no other window"); | |
4303 | |
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4304 return window; |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4305 } |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4306 |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4307 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
|
4308 "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
|
4309 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
|
4310 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
|
4311 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
|
4312 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
|
4313 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
|
4314 \n\ |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4315 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
|
4316 specifies the window to scroll.\n\ |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4317 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
|
4318 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
|
4319 (arg) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4320 register Lisp_Object arg; |
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4321 { |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4322 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
|
4323 register int defalt; |
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4324 register struct window *w; |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4325 register int count = specpdl_ptr - specpdl; |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4326 |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4327 window = Fother_window_for_scrolling (); |
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4328 |
265 | 4329 w = XWINDOW (window); |
10373
c5c1ffa3755e
(Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents:
10302
diff
changeset
|
4330 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
|
4331 if (defalt < 1) defalt = 1; |
265 | 4332 |
4333 /* Don't screw up if window_scroll gets an error. */ | |
4334 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
|
4335 ++windows_or_buffers_changed; |
265 | 4336 |
4337 Fset_buffer (w->buffer); | |
4338 SET_PT (marker_position (w->pointm)); | |
4339 | |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4340 if (NILP (arg)) |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4341 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
|
4342 else if (EQ (arg, Qminus)) |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4343 window_scroll (window, -defalt, 1, 1); |
265 | 4344 else |
4345 { | |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4346 if (CONSP (arg)) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4347 arg = Fcar (arg); |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4348 CHECK_NUMBER (arg, 0); |
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4349 window_scroll (window, XINT (arg), 0, 1); |
265 | 4350 } |
4351 | |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4352 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
|
4353 unbind_to (count, Qnil); |
265 | 4354 |
4355 return Qnil; | |
4356 } | |
4357 | |
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
4358 DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P", |
265 | 4359 "Scroll selected window display ARG columns left.\n\ |
4360 Default for ARG is window width minus 2.") | |
4361 (arg) | |
4362 register Lisp_Object arg; | |
4363 { | |
4364 | |
485 | 4365 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
|
4366 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
265 | 4367 else |
4368 arg = Fprefix_numeric_value (arg); | |
4369 | |
4370 return | |
4371 Fset_window_hscroll (selected_window, | |
4372 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
4373 + XINT (arg))); | |
4374 } | |
4375 | |
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
4376 DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P", |
265 | 4377 "Scroll selected window display ARG columns right.\n\ |
4378 Default for ARG is window width minus 2.") | |
4379 (arg) | |
4380 register Lisp_Object arg; | |
4381 { | |
485 | 4382 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
|
4383 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
265 | 4384 else |
4385 arg = Fprefix_numeric_value (arg); | |
4386 | |
4387 return | |
4388 Fset_window_hscroll (selected_window, | |
4389 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
4390 - XINT (arg))); | |
4391 } | |
4392 | |
4393 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", | |
769 | 4394 "Center point in window and redisplay frame. With ARG, put point on line ARG.\n\ |
265 | 4395 The desired position of point is always relative to the current window.\n\ |
769 | 4396 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
|
4397 If ARG is omitted or nil, erases the entire frame and then\n\ |
769 | 4398 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
|
4399 (arg) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4400 register Lisp_Object arg; |
265 | 4401 { |
4402 register struct window *w = XWINDOW (selected_window); | |
4403 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
|
4404 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
|
4405 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
|
4406 struct buffer *obuf = current_buffer; |
265 | 4407 |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4408 if (NILP (arg)) |
265 | 4409 { |
769 | 4410 extern int frame_garbaged; |
26873
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4411 int i; |
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4412 |
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4413 /* Invalidate pixel data calculated for all compositions. */ |
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4414 for (i = 0; i < n_compositions; i++) |
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4415 composition_table[i]->font = NULL; |
265 | 4416 |
25402
857e8b5b1194
(Frecenter): Clear frame if called with nil or no arg.
Gerd Moellmann <gerd@gnu.org>
parents:
25387
diff
changeset
|
4417 Fredraw_frame (w->frame); |
769 | 4418 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
|
4419 XSETFASTINT (arg, ht / 2); |
265 | 4420 } |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4421 else if (CONSP (arg)) /* Just C-u. */ |
265 | 4422 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4423 XSETFASTINT (arg, ht / 2); |
265 | 4424 } |
4425 else | |
4426 { | |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4427 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
|
4428 CHECK_NUMBER (arg, 0); |
265 | 4429 } |
4430 | |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4431 if (XINT (arg) < 0) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4432 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
|
4433 |
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4434 set_buffer_internal (buf); |
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15905
diff
changeset
|
4435 pos = *vmotion (PT, - XINT (arg), w); |
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
4436 |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4437 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
|
4438 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
|
4439 || FETCH_BYTE (pos.bytepos - 1) == '\n') |
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
4440 ? Qt : Qnil); |
265 | 4441 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
|
4442 set_buffer_internal (obuf); |
265 | 4443 |
4444 return Qnil; | |
4445 } | |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4446 |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4447 |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4448 /* 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
|
4449 as opposed to its height. */ |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4450 |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4451 static int |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4452 displayed_window_lines (w) |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4453 struct window *w; |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4454 { |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4455 struct it it; |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4456 struct text_pos start; |
29488
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4457 int height = window_box_height (w); |
33059
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4458 struct buffer *old_buffer; |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4459 int bottom_y; |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4460 |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4461 if (XBUFFER (w->buffer) != current_buffer) |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4462 { |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4463 old_buffer = current_buffer; |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4464 set_buffer_internal (XBUFFER (w->buffer)); |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4465 } |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4466 else |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4467 old_buffer = NULL; |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4468 |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4469 SET_TEXT_POS_FROM_MARKER (start, w->start); |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4470 start_display (&it, w, start); |
29488
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4471 move_it_vertically (&it, height); |
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4472 |
33059
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4473 if (old_buffer) |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4474 set_buffer_internal (old_buffer); |
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4475 |
34416
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4476 bottom_y = it.current_y + it.max_ascent + it.max_descent; |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4477 |
34417
fef41c786c7a
(displayed_window_lines): Fix off-by-one error.
Miles Bader <miles@gnu.org>
parents:
34416
diff
changeset
|
4478 if (bottom_y > it.current_y && bottom_y <= it.last_visible_y) |
34416
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4479 /* Hit a line without a terminating newline. */ |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4480 it.vpos++; |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4481 |
29488
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4482 /* Add in empty lines at the bottom of the window. */ |
33059
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4483 if (bottom_y < height) |
29488
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4484 { |
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4485 struct frame *f = XFRAME (w->frame); |
33059
8fab1b57781b
(displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents:
32937
diff
changeset
|
4486 int rest = height - bottom_y; |
34409
eaeb04956022
(displayed_window_lines): Don't round up when converting empty space at
Miles Bader <miles@gnu.org>
parents:
34384
diff
changeset
|
4487 int lines = rest / CANON_Y_UNIT (f); |
29488
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4488 it.vpos += lines; |
4eef390d6155
(displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents:
29485
diff
changeset
|
4489 } |
34384
9669bb49fca2
(Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents:
34381
diff
changeset
|
4490 |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4491 return it.vpos; |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4492 } |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4493 |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4494 |
34416
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4495 DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4496 0, 1, 0, |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4497 "Return the height in lines of the text display area of WINDOW.\n\ |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4498 This doesn't include the mode-line (or header-line if any) or any\n\ |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4499 partial-height lines in the text display area.") |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4500 (window) |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4501 Lisp_Object window; |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4502 { |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4503 struct window *w = decode_window (window); |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4504 int pixel_height = window_box_height (w); |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4505 int line_height = pixel_height / CANON_Y_UNIT (XFRAME (w->frame)); |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4506 return make_number (line_height); |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4507 } |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4508 |
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
4509 |
265 | 4510 |
4511 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, | |
4512 1, 1, "P", | |
4513 "Position point relative to window.\n\ | |
8411
9a68cba600fc
(Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8366
diff
changeset
|
4514 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
|
4515 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
|
4516 zero means top of window, negative means relative to bottom of window.") |
265 | 4517 (arg) |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4518 Lisp_Object arg; |
265 | 4519 { |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4520 struct window *w = XWINDOW (selected_window); |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4521 int lines, start; |
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
4522 Lisp_Object window; |
265 | 4523 |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4524 window = selected_window; |
265 | 4525 start = marker_position (w->start); |
4526 if (start < BEGV || start > ZV) | |
4527 { | |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4528 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
|
4529 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
|
4530 set_marker_both (w->start, w->buffer, PT, PT_BYTE); |
265 | 4531 w->start_at_line_beg = Fbolp (); |
4532 w->force_start = Qt; | |
4533 } | |
4534 else | |
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4535 Fgoto_char (w->start); |
265 | 4536 |
29485
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4537 lines = displayed_window_lines (w); |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4538 if (NILP (arg)) |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4539 XSETFASTINT (arg, lines / 2); |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4540 else |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4541 { |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4542 arg = Fprefix_numeric_value (arg); |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4543 if (XINT (arg) < 0) |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4544 XSETINT (arg, XINT (arg) + lines); |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4545 } |
362c61b5411b
(displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28918
diff
changeset
|
4546 |
34384
9669bb49fca2
(Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents:
34381
diff
changeset
|
4547 if (w->vscroll) |
9669bb49fca2
(Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents:
34381
diff
changeset
|
4548 /* Skip past a partially visible first line. */ |
9669bb49fca2
(Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents:
34381
diff
changeset
|
4549 XSETINT (arg, XINT (arg) + 1); |
9669bb49fca2
(Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents:
34381
diff
changeset
|
4550 |
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
4551 return Fvertical_motion (arg, window); |
265 | 4552 } |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4553 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4554 |
265 | 4555 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4556 /*********************************************************************** |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4557 Window Configuration |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4558 ***********************************************************************/ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4559 |
265 | 4560 struct save_window_data |
4561 { | |
15712
a272ccf6c225
(struct save_window_data, struct saved_window): First
Karl Heuer <kwzh@gnu.org>
parents:
15385
diff
changeset
|
4562 EMACS_INT size_from_Lisp_Vector_struct; |
265 | 4563 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
|
4564 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
|
4565 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
|
4566 Lisp_Object selected_frame; |
265 | 4567 Lisp_Object current_window; |
4568 Lisp_Object current_buffer; | |
4569 Lisp_Object minibuf_scroll_window; | |
4570 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
|
4571 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
|
4572 /* 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
|
4573 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
|
4574 Lisp_Object min_width, min_height; |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4575 /* 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
|
4576 for one window. */ |
265 | 4577 Lisp_Object saved_windows; |
4578 }; | |
1326
709532b86646
* window.c (SAVE_WINDOW_DATA_SIZE): Define this using sizeof,
Jim Blandy <jimb@redhat.com>
parents:
1325
diff
changeset
|
4579 |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4580 /* This is saved as a Lisp_Vector */ |
265 | 4581 struct saved_window |
4582 { | |
4583 /* 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
|
4584 EMACS_INT size_from_Lisp_Vector_struct; |
265 | 4585 struct Lisp_Vector *next_from_Lisp_Vector_struct; |
4586 | |
4587 Lisp_Object window; | |
4588 Lisp_Object buffer, start, pointm, mark; | |
4589 Lisp_Object left, top, width, height, hscroll; | |
4590 Lisp_Object parent, prev; | |
4591 Lisp_Object start_at_line_beg; | |
4592 Lisp_Object display_table; | |
34090
7721faa485ea
(struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
33957
diff
changeset
|
4593 Lisp_Object orig_top, orig_height; |
265 | 4594 }; |
34090
7721faa485ea
(struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
33957
diff
changeset
|
4595 #define SAVED_WINDOW_VECTOR_SIZE 16 /* Arg to Fmake_vector */ |
265 | 4596 |
4597 #define SAVED_WINDOW_N(swv,n) \ | |
4598 ((struct saved_window *) (XVECTOR ((swv)->contents[(n)]))) | |
4599 | |
4600 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
|
4601 "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
|
4602 (object) |
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4603 Lisp_Object object; |
265 | 4604 { |
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4605 if (WINDOW_CONFIGURATIONP (object)) |
265 | 4606 return Qt; |
4607 return Qnil; | |
4608 } | |
4609 | |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4610 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
|
4611 "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
|
4612 (config) |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4613 Lisp_Object config; |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4614 { |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4615 register struct save_window_data *data; |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4616 struct Lisp_Vector *saved_windows; |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4617 |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4618 if (! WINDOW_CONFIGURATIONP (config)) |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4619 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
|
4620 |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4621 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
|
4622 saved_windows = XVECTOR (data->saved_windows); |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4623 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
|
4624 } |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4625 |
2297
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
4626 DEFUN ("set-window-configuration", Fset_window_configuration, |
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
4627 Sset_window_configuration, 1, 1, 0, |
265 | 4628 "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\ |
4629 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
|
4630 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
|
4631 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
|
4632 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
|
4633 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
|
4634 (configuration) |
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
4635 Lisp_Object configuration; |
265 | 4636 { |
4637 register struct save_window_data *data; | |
4638 struct Lisp_Vector *saved_windows; | |
4639 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
|
4640 Lisp_Object frame; |
769 | 4641 FRAME_PTR f; |
18657 | 4642 int old_point = -1; |
265 | 4643 |
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
4644 while (!WINDOW_CONFIGURATIONP (configuration)) |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4645 wrong_type_argument (Qwindow_configuration_p, configuration); |
265 | 4646 |
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
4647 data = (struct save_window_data *) XVECTOR (configuration); |
265 | 4648 saved_windows = XVECTOR (data->saved_windows); |
4649 | |
4650 new_current_buffer = data->current_buffer; | |
485 | 4651 if (NILP (XBUFFER (new_current_buffer)->name)) |
265 | 4652 new_current_buffer = Qnil; |
18657 | 4653 else |
4654 { | |
4655 if (XBUFFER (new_current_buffer) == current_buffer) | |
4656 old_point = PT; | |
4657 } | |
265 | 4658 |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4659 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
|
4660 f = XFRAME (frame); |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4661 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4662 /* 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
|
4663 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
|
4664 if (FRAME_LIVE_P (f)) |
265 | 4665 { |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4666 register struct window *w; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4667 register struct saved_window *p; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4668 struct window *root_window; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4669 struct window **leaf_windows; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4670 int n_leaf_windows; |
33277
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4671 int k, i, n; |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4672 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4673 /* 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
|
4674 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
|
4675 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
|
4676 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
|
4677 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
|
4678 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
|
4679 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
|
4680 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
|
4681 |
18657 | 4682 /* The mouse highlighting code could get screwed up |
4683 if it runs during this. */ | |
4684 BLOCK_INPUT; | |
4685 | |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4686 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
|
4687 || 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
|
4688 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
|
4689 XFASTINT (data->frame_width), 0, 0, 0); |
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
4690 #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
|
4691 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
|
4692 != previous_frame_menu_bar_lines) |
21533
b7df83bf15ff
(Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents:
21514
diff
changeset
|
4693 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
|
4694 #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
|
4695 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
|
4696 != 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
|
4697 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
|
4698 #endif |
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4699 #endif |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4700 |
27869
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4701 /* "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
|
4702 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
|
4703 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
|
4704 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
|
4705 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
|
4706 { |
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4707 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
|
4708 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
|
4709 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
|
4710 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
|
4711 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
|
4712 } |
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4713 |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4714 windows_or_buffers_changed++; |
10666
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
4715 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
|
4716 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4717 /* Problem: Freeing all matrices and later allocating them again |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4718 is a serious redisplay flickering problem. What we would |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4719 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
|
4720 below. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4721 root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4722 leaf_windows |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4723 = (struct window **) alloca (count_windows (root_window) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4724 * sizeof (struct window *)); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4725 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
|
4726 |
8931
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4727 /* 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
|
4728 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
|
4729 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
|
4730 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
|
4731 |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4732 /* Kludge Alert! |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4733 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
|
4734 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
|
4735 |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4736 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
|
4737 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
|
4738 dead. */ |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4739 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
|
4740 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4741 for (k = 0; k < saved_windows->size; k++) |
265 | 4742 { |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4743 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
|
4744 w = XWINDOW (p->window); |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4745 w->next = Qnil; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4746 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4747 if (!NILP (p->parent)) |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4748 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
|
4749 XFASTINT (p->parent))->window; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4750 else |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4751 w->parent = Qnil; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4752 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4753 if (!NILP (p->prev)) |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4754 { |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4755 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
|
4756 XFASTINT (p->prev))->window; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4757 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
|
4758 } |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4759 else |
265 | 4760 { |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4761 w->prev = Qnil; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4762 if (!NILP (w->parent)) |
265 | 4763 { |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4764 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
|
4765 { |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4766 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
|
4767 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
|
4768 } |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4769 else |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4770 { |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4771 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
|
4772 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
|
4773 } |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4774 } |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4775 } |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4776 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4777 /* 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
|
4778 restore it now. */ |
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
4779 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
|
4780 w->buffer = w->height; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4781 w->left = p->left; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4782 w->top = p->top; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4783 w->width = p->width; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4784 w->height = p->height; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4785 w->hscroll = p->hscroll; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4786 w->display_table = p->display_table; |
34090
7721faa485ea
(struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
33957
diff
changeset
|
4787 w->orig_top = p->orig_top; |
7721faa485ea
(struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
33957
diff
changeset
|
4788 w->orig_height = p->orig_height; |
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4789 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
|
4790 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
|
4791 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4792 /* 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
|
4793 if (NILP (p->buffer)) |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4794 w->buffer = p->buffer; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4795 else |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4796 { |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4797 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
|
4798 /* 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
|
4799 { |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4800 w->buffer = p->buffer; |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4801 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
|
4802 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
|
4803 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
|
4804 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
|
4805 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
|
4806 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4807 /* 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
|
4808 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
|
4809 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
|
4810 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
|
4811 && 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
|
4812 Fgoto_char (w->pointm); |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4813 } |
3535
581c09f72dbd
(Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents:
3354
diff
changeset
|
4814 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
|
4815 /* 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
|
4816 { |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4817 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
|
4818 /* 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
|
4819 range. */ |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4820 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
|
4821 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
|
4822 w->start_at_line_beg = Qt; |
265 | 4823 } |
4824 else | |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4825 /* 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
|
4826 are real. */ |
265 | 4827 { |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4828 /* 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
|
4829 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
|
4830 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
|
4831 w->buffer); |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4832 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
|
4833 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
|
4834 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
|
4835 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
|
4836 w->start_at_line_beg = Qt; |
265 | 4837 } |
4838 } | |
4839 } | |
1237
3929b2135e58
* window.c (delete_all_subwindows): Save the window's buffer in
Jim Blandy <jimb@redhat.com>
parents:
1123
diff
changeset
|
4840 |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4841 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
|
4842 /* 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
|
4843 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
|
4844 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
|
4845 near the beginning of this function. */ |
1322db65a230
(select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents:
27850
diff
changeset
|
4846 selected_window = Qnil; |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4847 Fselect_window (data->current_window); |
17678
c13cd575945a
(Fset_window_configuration): Set last_selected_window
Richard M. Stallman <rms@gnu.org>
parents:
17628
diff
changeset
|
4848 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
|
4849 = selected_window; |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4850 |
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4851 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
|
4852 || (FRAMEP (data->focus_frame) |
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4853 && FRAME_LIVE_P (XFRAME (data->focus_frame)))) |
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4854 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
|
4855 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4856 #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
|
4857 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
|
4858 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
|
4859 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
|
4860 Qnil, 0); |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4861 #endif |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4862 |
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4863 /* 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
|
4864 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
|
4865 || 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
|
4866 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
|
4867 0, 0, 0); |
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
4868 #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
|
4869 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
|
4870 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
|
4871 make_number (0)); |
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4872 #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
|
4873 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
|
4874 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
|
4875 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
|
4876 #endif |
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4877 #endif |
18657 | 4878 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4879 /* Now, free glyph matrices in windows that were not reused. */ |
33277
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4880 for (i = n = 0; i < n_leaf_windows; ++i) |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4881 { |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4882 if (NILP (leaf_windows[i]->buffer)) |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4883 { |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4884 /* Assert it's not reused as a combination. */ |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4885 xassert (NILP (leaf_windows[i]->hchild) |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4886 && NILP (leaf_windows[i]->vchild)); |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4887 free_window_matrices (leaf_windows[i]); |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4888 SET_FRAME_GARBAGED (f); |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4889 } |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4890 else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4891 ++n; |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4892 } |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4893 |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4894 /* If more than one window shows the new and old current buffer, |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4895 don't try to preserve point in that buffer. */ |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4896 if (old_point > 0 && n > 1) |
8239087d52c5
(Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents:
33255
diff
changeset
|
4897 old_point = -1; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4898 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4899 adjust_glyphs (f); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4900 |
18657 | 4901 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
|
4902 |
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4903 /* 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
|
4904 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
|
4905 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
|
4906 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
|
4907 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
|
4908 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
|
4909 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
|
4910 |
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4911 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
|
4912 && ! 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
|
4913 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
265 | 4914 } |
4915 | |
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4916 if (!NILP (new_current_buffer)) |
18657 | 4917 { |
4918 Fset_buffer (new_current_buffer); | |
4919 | |
4920 /* If the buffer that is current now is the same | |
4921 that was current before setting the window configuration, | |
4922 don't alter its PT. */ | |
4923 if (old_point >= 0) | |
4924 SET_PT (old_point); | |
4925 } | |
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4926 |
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4927 /* 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
|
4928 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
|
4929 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
|
4930 |
265 | 4931 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
|
4932 |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4933 return (FRAME_LIVE_P (f) ? Qt : Qnil); |
265 | 4934 } |
4935 | |
769 | 4936 /* Mark all windows now on frame as deleted |
265 | 4937 by setting their buffers to nil. */ |
4938 | |
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4939 void |
265 | 4940 delete_all_subwindows (w) |
4941 register struct window *w; | |
4942 { | |
485 | 4943 if (!NILP (w->next)) |
265 | 4944 delete_all_subwindows (XWINDOW (w->next)); |
485 | 4945 if (!NILP (w->vchild)) |
265 | 4946 delete_all_subwindows (XWINDOW (w->vchild)); |
485 | 4947 if (!NILP (w->hchild)) |
265 | 4948 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
|
4949 |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4950 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
|
4951 |
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4952 if (!NILP (w->buffer)) |
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4953 unshow_buffer (w); |
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4954 |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4955 /* 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
|
4956 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
|
4957 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
|
4958 vchild or hchild set. */ |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4959 w->buffer = Qnil; |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4960 w->vchild = Qnil; |
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4961 w->hchild = Qnil; |
30045
ff2db81c11c1
(delete_all_subwindows): Reset Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
30039
diff
changeset
|
4962 |
ff2db81c11c1
(delete_all_subwindows): Reset Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
30039
diff
changeset
|
4963 Vwindow_list = Qnil; |
265 | 4964 } |
4965 | |
4966 static int | |
4967 count_windows (window) | |
4968 register struct window *window; | |
4969 { | |
4970 register int count = 1; | |
485 | 4971 if (!NILP (window->next)) |
265 | 4972 count += count_windows (XWINDOW (window->next)); |
485 | 4973 if (!NILP (window->vchild)) |
265 | 4974 count += count_windows (XWINDOW (window->vchild)); |
485 | 4975 if (!NILP (window->hchild)) |
265 | 4976 count += count_windows (XWINDOW (window->hchild)); |
4977 return count; | |
4978 } | |
4979 | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4980 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4981 /* 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
|
4982 Value is last index + 1. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4983 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4984 static int |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4985 get_leaf_windows (w, flat, i) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4986 struct window *w; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4987 struct window **flat; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4988 int i; |
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 while (w) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4991 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4992 if (!NILP (w->hchild)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4993 i = get_leaf_windows (XWINDOW (w->hchild), flat, i); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4994 else if (!NILP (w->vchild)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4995 i = get_leaf_windows (XWINDOW (w->vchild), flat, i); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4996 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4997 flat[i++] = w; |
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 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5000 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5001 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5002 return i; |
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 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5006 /* 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
|
5007 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
|
5008 can be returned. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5009 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5010 struct glyph * |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5011 get_phys_cursor_glyph (w) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5012 struct window *w; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5013 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5014 struct glyph_row *row; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5015 struct glyph *glyph; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5016 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5017 if (w->phys_cursor.vpos >= 0 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5018 && w->phys_cursor.vpos < w->current_matrix->nrows |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5019 && (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
|
5020 row->enabled_p) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5021 && row->used[TEXT_AREA] > w->phys_cursor.hpos) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5022 glyph = row->glyphs[TEXT_AREA] + w->phys_cursor.hpos; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5023 else |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5024 glyph = NULL; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5025 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5026 return glyph; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5027 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5028 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5029 |
265 | 5030 static int |
5031 save_window_save (window, vector, i) | |
5032 Lisp_Object window; | |
5033 struct Lisp_Vector *vector; | |
5034 int i; | |
5035 { | |
5036 register struct saved_window *p; | |
5037 register struct window *w; | |
5038 register Lisp_Object tem; | |
5039 | |
485 | 5040 for (;!NILP (window); window = w->next) |
265 | 5041 { |
5042 p = SAVED_WINDOW_N (vector, i); | |
5043 w = XWINDOW (window); | |
5044 | |
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
5045 XSETFASTINT (w->temslot, i++); |
265 | 5046 p->window = window; |
5047 p->buffer = w->buffer; | |
5048 p->left = w->left; | |
5049 p->top = w->top; | |
5050 p->width = w->width; | |
5051 p->height = w->height; | |
5052 p->hscroll = w->hscroll; | |
5053 p->display_table = w->display_table; | |
34090
7721faa485ea
(struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
33957
diff
changeset
|
5054 p->orig_top = w->orig_top; |
7721faa485ea
(struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
33957
diff
changeset
|
5055 p->orig_height = w->orig_height; |
485 | 5056 if (!NILP (w->buffer)) |
265 | 5057 { |
5058 /* Save w's value of point in the window configuration. | |
5059 If w is the selected window, then get the value of point | |
5060 from the buffer; pointm is garbage in the selected window. */ | |
5061 if (EQ (window, selected_window)) | |
5062 { | |
5063 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
|
5064 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
|
5065 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
|
5066 BUF_PT_BYTE (XBUFFER (w->buffer))); |
265 | 5067 } |
5068 else | |
12981
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
5069 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
|
5070 |
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
5071 p->start = Fcopy_marker (w->start, Qnil); |
265 | 5072 p->start_at_line_beg = w->start_at_line_beg; |
5073 | |
5074 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
|
5075 p->mark = Fcopy_marker (tem, Qnil); |
265 | 5076 } |
5077 else | |
5078 { | |
5079 p->pointm = Qnil; | |
5080 p->start = Qnil; | |
5081 p->mark = Qnil; | |
5082 p->start_at_line_beg = Qnil; | |
5083 } | |
5084 | |
485 | 5085 if (NILP (w->parent)) |
265 | 5086 p->parent = Qnil; |
5087 else | |
5088 p->parent = XWINDOW (w->parent)->temslot; | |
5089 | |
485 | 5090 if (NILP (w->prev)) |
265 | 5091 p->prev = Qnil; |
5092 else | |
5093 p->prev = XWINDOW (w->prev)->temslot; | |
5094 | |
485 | 5095 if (!NILP (w->vchild)) |
265 | 5096 i = save_window_save (w->vchild, vector, i); |
485 | 5097 if (!NILP (w->hchild)) |
265 | 5098 i = save_window_save (w->hchild, vector, i); |
5099 } | |
5100 | |
5101 return i; | |
5102 } | |
5103 | |
16485
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
5104 DEFUN ("current-window-configuration", Fcurrent_window_configuration, |
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
5105 Scurrent_window_configuration, 0, 1, 0, |
769 | 5106 "Return an object representing the current window configuration of FRAME.\n\ |
5107 If FRAME is nil or omitted, use the selected frame.\n\ | |
265 | 5108 This describes the number of windows, their sizes and current buffers,\n\ |
5109 and for each displayed buffer, where display starts, and the positions of\n\ | |
5110 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
|
5111 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
|
5112 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
|
5113 redirection (see `redirect-frame-focus').") |
769 | 5114 (frame) |
5115 Lisp_Object frame; | |
265 | 5116 { |
5117 register Lisp_Object tem; | |
5118 register int n_windows; | |
5119 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
|
5120 register struct Lisp_Vector *vec; |
265 | 5121 register int i; |
769 | 5122 FRAME_PTR f; |
265 | 5123 |
769 | 5124 if (NILP (frame)) |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5125 frame = selected_frame; |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5126 CHECK_LIVE_FRAME (frame, 0); |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5127 f = XFRAME (frame); |
358 | 5128 |
769 | 5129 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
|
5130 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
|
5131 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
|
5132 vec->contents[i] = Qnil; |
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
5133 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
|
5134 data = (struct save_window_data *)vec; |
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
5135 |
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
5136 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
|
5137 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
|
5138 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
|
5139 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
|
5140 data->selected_frame = selected_frame; |
769 | 5141 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
|
5142 XSETBUFFER (data->current_buffer, current_buffer); |
265 | 5143 data->minibuf_scroll_window = Vminibuf_scroll_window; |
769 | 5144 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
|
5145 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
|
5146 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
|
5147 XSETINT (data->min_width, window_min_width); |
265 | 5148 tem = Fmake_vector (make_number (n_windows), Qnil); |
5149 data->saved_windows = tem; | |
5150 for (i = 0; i < n_windows; i++) | |
5151 XVECTOR (tem)->contents[i] | |
5152 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil); | |
34090
7721faa485ea
(struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
33957
diff
changeset
|
5153 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); |
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
5154 XSETWINDOW_CONFIGURATION (tem, data); |
265 | 5155 return (tem); |
5156 } | |
5157 | |
5158 DEFUN ("save-window-excursion", Fsave_window_excursion, Ssave_window_excursion, | |
5159 0, UNEVALLED, 0, | |
5160 "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
|
5161 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
|
5162 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
|
5163 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
|
5164 Also restore which buffer is current.\n\ |
265 | 5165 Does not restore the value of point in current buffer.") |
5166 (args) | |
5167 Lisp_Object args; | |
5168 { | |
5169 register Lisp_Object val; | |
5170 register int count = specpdl_ptr - specpdl; | |
5171 | |
5172 record_unwind_protect (Fset_window_configuration, | |
358 | 5173 Fcurrent_window_configuration (Qnil)); |
265 | 5174 val = Fprogn (args); |
5175 return unbind_to (count, val); | |
5176 } | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5177 |
265 | 5178 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5179 /*********************************************************************** |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5180 Marginal Areas |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5181 ***********************************************************************/ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5182 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5183 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
|
5184 2, 3, 0, |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5185 "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
|
5186 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
|
5187 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
|
5188 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
|
5189 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
|
5190 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
|
5191 (window, left, right) |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5192 Lisp_Object window, left, right; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5193 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5194 struct window *w = decode_window (window); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5195 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5196 if (!NILP (left)) |
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
5197 CHECK_NUMBER_OR_FLOAT (left, 1); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5198 if (!NILP (right)) |
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
5199 CHECK_NUMBER_OR_FLOAT (right, 2); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5200 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5201 /* 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
|
5202 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
|
5203 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
|
5204 || (FLOATP (left) && XFLOAT_DATA (left) <= 0)) |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5205 XSETFASTINT (left, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5206 if (INTEGERP (left) && XFASTINT (left) == 0) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5207 left = Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5208 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5209 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
|
5210 || (FLOATP (right) && XFLOAT_DATA (right) <= 0)) |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5211 XSETFASTINT (right, 0); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5212 if (INTEGERP (right) && XFASTINT (right) == 0) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5213 right = Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5214 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5215 w->left_margin_width = left; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5216 w->right_margin_width = right; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5217 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5218 ++windows_or_buffers_changed; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5219 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5220 return Qnil; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5221 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5222 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5223 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5224 DEFUN ("window-margins", Fwindow_margins, Swindow_margins, |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5225 0, 1, 0, |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5226 "Get width of marginal areas of window WINDOW.\n\ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5227 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
|
5228 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
|
5229 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
|
5230 as nil.") |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5231 (window) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5232 Lisp_Object window; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5233 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5234 struct window *w = decode_window (window); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5235 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
|
5236 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5237 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5238 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5239 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5240 /*********************************************************************** |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5241 Smooth scrolling |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5242 ***********************************************************************/ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5243 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5244 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
|
5245 "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
|
5246 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
|
5247 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
|
5248 (window) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5249 Lisp_Object window; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5250 { |
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5251 Lisp_Object result; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5252 struct frame *f; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5253 struct window *w; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5254 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5255 if (NILP (window)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5256 window = selected_window; |
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5257 else |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5258 CHECK_WINDOW (window, 0); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5259 w = XWINDOW (window); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5260 f = XFRAME (w->frame); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5261 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5262 if (FRAME_WINDOW_P (f)) |
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5263 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
|
5264 else |
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5265 result = make_number (0); |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5266 return result; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5267 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5268 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5269 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5270 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
|
5271 2, 2, 0, |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5272 "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
|
5273 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
|
5274 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
|
5275 (window, vscroll) |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5276 Lisp_Object window, vscroll; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5277 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5278 struct window *w; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5279 struct frame *f; |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5280 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5281 if (NILP (window)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5282 window = selected_window; |
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5283 else |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5284 CHECK_WINDOW (window, 0); |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5285 CHECK_NUMBER_OR_FLOAT (vscroll, 1); |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5286 |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5287 w = XWINDOW (window); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5288 f = XFRAME (w->frame); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5289 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5290 if (FRAME_WINDOW_P (f)) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5291 { |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5292 int old_dy = w->vscroll; |
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5293 |
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5294 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
|
5295 w->vscroll = min (w->vscroll, 0); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5296 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5297 /* 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
|
5298 area becomes larger than before. */ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5299 if (w->vscroll < 0 && w->vscroll < old_dy) |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5300 adjust_glyphs (f); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5301 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5302 /* Prevent redisplay shortcuts. */ |
25375 | 5303 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5304 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5305 |
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
5306 return Fwindow_vscroll (window); |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5307 } |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5308 |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5309 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5310 /* 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
|
5311 first argument being a pointer to the leaf window, and with |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5312 additional argument USER_DATA. Stops when FN returns 0. */ |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5313 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5314 void |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5315 foreach_window (f, fn, user_data) |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5316 struct frame *f; |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5317 int (* fn) P_ ((struct window *, void *)); |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5318 void *user_data; |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5319 { |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5320 foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data); |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5321 } |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5322 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5323 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5324 /* 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
|
5325 reachable from W. FN is called with the first argument being a |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5326 pointer to the leaf window, and with additional argument USER_DATA. |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5327 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
|
5328 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5329 static int |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5330 foreach_window_1 (w, fn, user_data) |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5331 struct window *w; |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5332 int (* fn) P_ ((struct window *, void *)); |
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5333 void *user_data; |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5334 { |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5335 int cont; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5336 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5337 for (cont = 1; w && cont;) |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5338 { |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5339 if (!NILP (w->hchild)) |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5340 cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5341 else if (!NILP (w->vchild)) |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5342 cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); |
30366
8dd313fc287d
(foreach_window_1): Fix typo reversing an if-condition.
Gerd Moellmann <gerd@gnu.org>
parents:
30362
diff
changeset
|
5343 else |
8dd313fc287d
(foreach_window_1): Fix typo reversing an if-condition.
Gerd Moellmann <gerd@gnu.org>
parents:
30362
diff
changeset
|
5344 cont = fn (w, user_data); |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5345 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5346 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5347 } |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5348 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5349 return cont; |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5350 } |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5351 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5352 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5353 /* Freeze or unfreeze the window start of W if unless it is a |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5354 mini-window or the selected window. FREEZE_P non-null means freeze |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5355 the window start. */ |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5356 |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5357 static int |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5358 freeze_window_start (w, freeze_p) |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5359 struct window *w; |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5360 void *freeze_p; |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5361 { |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5362 if (w == XWINDOW (selected_window) |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5363 || MINI_WINDOW_P (w) |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5364 || (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
|
5365 && ! NILP (Vminibuf_scroll_window) |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5366 && w == XWINDOW (Vminibuf_scroll_window))) |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5367 freeze_p = NULL; |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5368 |
30362
fc017b1b2a7d
(foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents:
30265
diff
changeset
|
5369 w->frozen_window_start_p = freeze_p != NULL; |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5370 return 1; |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5371 } |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5372 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5373 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5374 /* 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
|
5375 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
|
5376 means freeze the window start. */ |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5377 |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5378 void |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5379 freeze_window_starts (f, freeze_p) |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5380 struct frame *f; |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5381 int freeze_p; |
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5382 { |
31903
3e0a1f91c149
(freeze_window_starts): Construct last argument for
Gerd Moellmann <gerd@gnu.org>
parents:
31829
diff
changeset
|
5383 foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0)); |
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5384 } |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5385 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5386 |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5387 /*********************************************************************** |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5388 Initialization |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5389 ***********************************************************************/ |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5390 |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5391 /* Return 1 if window configurations C1 and C2 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5392 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
|
5393 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5394 int |
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5395 compare_window_configurations (c1, c2, ignore_positions) |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5396 Lisp_Object c1, c2; |
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5397 int ignore_positions; |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5398 { |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5399 register struct save_window_data *d1, *d2; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5400 struct Lisp_Vector *sw1, *sw2; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5401 int i; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5402 |
28505
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5403 if (!WINDOW_CONFIGURATIONP (c1)) |
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5404 wrong_type_argument (Qwindow_configuration_p, c1); |
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5405 if (!WINDOW_CONFIGURATIONP (c2)) |
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5406 wrong_type_argument (Qwindow_configuration_p, c2); |
b5a7eb24964c
(compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents:
28463
diff
changeset
|
5407 |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5408 d1 = (struct save_window_data *) XVECTOR (c1); |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5409 d2 = (struct save_window_data *) XVECTOR (c2); |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5410 sw1 = XVECTOR (d1->saved_windows); |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5411 sw2 = XVECTOR (d2->saved_windows); |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5412 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5413 if (! EQ (d1->frame_width, d2->frame_width)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5414 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5415 if (! EQ (d1->frame_height, d2->frame_height)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5416 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5417 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
|
5418 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5419 if (! EQ (d1->selected_frame, d2->selected_frame)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5420 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5421 /* Don't compare the current_window field directly. |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5422 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
|
5423 if (! EQ (d1->current_buffer, d2->current_buffer)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5424 return 0; |
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5425 if (! ignore_positions) |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5426 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
|
5427 return 0; |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5428 /* Don't compare the root_window field. |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5429 We don't require the two configurations |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5430 to use the same window object, |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5431 and the two root windows must be equivalent |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5432 if everything else compares equal. */ |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5433 if (! EQ (d1->focus_frame, d2->focus_frame)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5434 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5435 if (! EQ (d1->min_width, d2->min_width)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5436 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5437 if (! EQ (d1->min_height, d2->min_height)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5438 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5439 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5440 /* 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
|
5441 if (sw1->size != sw2->size) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5442 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5443 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5444 for (i = 0; i < sw1->size; i++) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5445 { |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5446 struct saved_window *p1, *p2; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5447 int w1_is_current, w2_is_current; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5448 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5449 p1 = SAVED_WINDOW_N (sw1, i); |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5450 p2 = SAVED_WINDOW_N (sw2, i); |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5451 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5452 /* Verify that the current windows in the two |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5453 configurations correspond to each other. */ |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5454 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
|
5455 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
|
5456 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5457 if (w1_is_current != w2_is_current) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5458 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5459 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5460 /* Verify that the corresponding windows do match. */ |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5461 if (! EQ (p1->buffer, p2->buffer)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5462 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5463 if (! EQ (p1->left, p2->left)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5464 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5465 if (! EQ (p1->top, p2->top)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5466 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5467 if (! EQ (p1->width, p2->width)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5468 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5469 if (! EQ (p1->height, p2->height)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5470 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5471 if (! EQ (p1->display_table, p2->display_table)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5472 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5473 if (! EQ (p1->parent, p2->parent)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5474 return 0; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5475 if (! EQ (p1->prev, p2->prev)) |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5476 return 0; |
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5477 if (! ignore_positions) |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5478 { |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5479 if (! EQ (p1->hscroll, p2->hscroll)) |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5480 return 0; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5481 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
|
5482 return 0; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5483 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
|
5484 return 0; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5485 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
|
5486 return 0; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5487 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
|
5488 return 0; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5489 } |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5490 } |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5491 |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5492 return 1; |
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5493 } |
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5494 |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5495 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
|
5496 Scompare_window_configurations, 2, 2, 0, |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5497 "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
|
5498 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
|
5499 and scrolling positions.") |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5500 (x, y) |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5501 Lisp_Object x, y; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5502 { |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5503 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
|
5504 return Qt; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5505 return Qnil; |
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5506 } |
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5507 |
21514 | 5508 void |
265 | 5509 init_window_once () |
5510 { | |
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5511 struct frame *f = make_terminal_frame (); |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5512 XSETFRAME (selected_frame, f); |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5513 Vterminal_frame = selected_frame; |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5514 minibuf_window = f->minibuffer_window; |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5515 selected_window = f->selected_window; |
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5516 last_nonminibuf_frame = f; |
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
5517 |
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
5518 window_initialized = 1; |
265 | 5519 } |
5520 | |
21514 | 5521 void |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5522 init_window () |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5523 { |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5524 Vwindow_list = Qnil; |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5525 } |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5526 |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5527 void |
265 | 5528 syms_of_window () |
5529 { | |
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5530 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
|
5531 staticpro (&Qleft_bitmap_area); |
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5532 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
|
5533 staticpro (&Qright_bitmap_area); |
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5534 |
25540
2b4bdd114899
(Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents:
25517
diff
changeset
|
5535 Qwindow_size_fixed = intern ("window-size-fixed"); |
2b4bdd114899
(Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents:
25517
diff
changeset
|
5536 staticpro (&Qwindow_size_fixed); |
25268 | 5537 |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5538 staticpro (&Qwindow_configuration_change_hook); |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5539 Qwindow_configuration_change_hook |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5540 = intern ("window-configuration-change-hook"); |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5541 |
265 | 5542 Qwindowp = intern ("windowp"); |
5543 staticpro (&Qwindowp); | |
5544 | |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5545 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
|
5546 staticpro (&Qwindow_configuration_p); |
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5547 |
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
5548 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
|
5549 staticpro (&Qwindow_live_p); |
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
5550 |
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
5551 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
|
5552 staticpro (&Qtemp_buffer_show_hook); |
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
5553 |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5554 staticpro (&Vwindow_list); |
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5555 |
265 | 5556 DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, |
5557 "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
|
5558 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
|
5559 Used by `with-output-to-temp-buffer'.\n\ |
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
5560 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
|
5561 the buffer; `temp-buffer-show-hook' is not run unless this function runs it."); |
265 | 5562 Vtemp_buffer_show_function = Qnil; |
5563 | |
5564 DEFVAR_LISP ("display-buffer-function", &Vdisplay_buffer_function, | |
5565 "If non-nil, function to call to handle `display-buffer'.\n\ | |
5566 It will receive two args, the buffer and a flag which if non-nil means\n\ | |
5567 that the currently selected window is not acceptable.\n\ | |
5568 Commands such as `switch-to-buffer-other-window' and `find-file-other-window'\n\ | |
5569 work using this function."); | |
5570 Vdisplay_buffer_function = Qnil; | |
5571 | |
34261
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
5572 DEFVAR_LISP ("even-window-heights", &Veven_window_heights, |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
5573 "*If non-nil, `display-buffer' should even the window heights.\n\ |
34265 | 5574 If nil, `display-buffer' will leave the window configuration alone."); |
34261
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
5575 Veven_window_heights = Qt; |
c50a8c8171b7
(Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
34097
diff
changeset
|
5576 |
265 | 5577 DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window, |
5578 "Non-nil means it is the window that C-M-v in minibuffer should scroll."); | |
5579 Vminibuf_scroll_window = Qnil; | |
5580 | |
5581 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer, | |
5582 "If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window."); | |
5583 Vother_window_scroll_buffer = Qnil; | |
5584 | |
769 | 5585 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames, |
780 | 5586 "*Non-nil means `display-buffer' should make a separate frame."); |
769 | 5587 pop_up_frames = 0; |
265 | 5588 |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
5589 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames, |
30777 | 5590 "*Non-nil means `display-buffer' should reuse frames.\n\ |
30560
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
5591 If the buffer in question is already displayed in a frame, raise that frame."); |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
5592 display_buffer_reuse_frames = 0; |
e4ba830b426d
(display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
30446
diff
changeset
|
5593 |
769 | 5594 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
|
5595 "Function to call to handle automatic new frame creation.\n\ |
769 | 5596 It is called with no arguments and should return a newly created frame.\n\ |
265 | 5597 \n\ |
769 | 5598 A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ |
5599 where `pop-up-frame-alist' would hold the default frame parameters."); | |
5600 Vpop_up_frame_function = Qnil; | |
265 | 5601 |
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5602 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
|
5603 "*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
|
5604 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
|
5605 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
|
5606 \n\ |
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5607 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
|
5608 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
|
5609 (BUFFER FRAME-PARAMETERS...) (BUFFER FUNCTION OTHER-ARGS...)\n\ |
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5610 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
|
5611 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
|
5612 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
|
5613 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
|
5614 \n\ |
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5615 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
|
5616 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
|
5617 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
|
5618 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
|
5619 Vspecial_display_buffer_names = Qnil; |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5620 |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5621 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
|
5622 "*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
|
5623 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
|
5624 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
|
5625 using `special-display-function'.\n\ |
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
5626 \n\ |
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5627 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
|
5628 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
|
5629 (REGEXP FRAME-PARAMETERS...) (REGEXP FUNCTION OTHER-ARGS...)\n\ |
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5630 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
|
5631 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
|
5632 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
|
5633 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
|
5634 \n\ |
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5635 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
|
5636 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
|
5637 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
|
5638 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
|
5639 Vspecial_display_regexps = Qnil; |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5640 |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5641 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
|
5642 "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
|
5643 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
|
5644 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
|
5645 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
|
5646 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
|
5647 \n\ |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5648 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
|
5649 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
|
5650 Vspecial_display_function = Qnil; |
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5651 |
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5652 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
|
5653 "*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
|
5654 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
|
5655 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
|
5656 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
|
5657 \n\ |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5658 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
|
5659 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
|
5660 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
|
5661 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
|
5662 \n\ |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5663 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
|
5664 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
|
5665 |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5666 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
|
5667 "*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
|
5668 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
|
5669 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
|
5670 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
|
5671 \n\ |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5672 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
|
5673 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
|
5674 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
|
5675 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
|
5676 \n\ |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5677 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
|
5678 Vsame_window_regexps = Qnil; |
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5679 |
265 | 5680 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, |
5681 "*Non-nil means display-buffer should make new windows."); | |
5682 pop_up_windows = 1; | |
5683 | |
5684 DEFVAR_INT ("next-screen-context-lines", &next_screen_context_lines, | |
5685 "*Number of lines of continuity when scrolling by screenfuls."); | |
5686 next_screen_context_lines = 2; | |
5687 | |
5688 DEFVAR_INT ("split-height-threshold", &split_height_threshold, | |
5689 "*display-buffer would prefer to split the largest window if this large.\n\ | |
5690 If there is only one window, it is split regardless of this value."); | |
5691 split_height_threshold = 500; | |
5692 | |
5693 DEFVAR_INT ("window-min-height", &window_min_height, | |
5694 "*Delete any window less than this tall (including its mode line)."); | |
5695 window_min_height = 4; | |
5696 | |
5697 DEFVAR_INT ("window-min-width", &window_min_width, | |
5698 "*Delete any window less than this wide."); | |
5699 window_min_width = 10; | |
5700 | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5701 DEFVAR_LISP ("scroll-preserve-screen-position", |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5702 &Vscroll_preserve_screen_position, |
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
5703 "*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
|
5704 Vscroll_preserve_screen_position = Qnil; |
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
5705 |
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5706 DEFVAR_LISP ("window-configuration-change-hook", |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5707 &Vwindow_configuration_change_hook, |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5708 "Functions to call when window configuration changes.\n\ |
20090 | 5709 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
|
5710 Vwindow_configuration_change_hook = Qnil; |
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5711 |
265 | 5712 defsubr (&Sselected_window); |
5713 defsubr (&Sminibuffer_window); | |
5714 defsubr (&Swindow_minibuffer_p); | |
5715 defsubr (&Swindowp); | |
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
5716 defsubr (&Swindow_live_p); |
265 | 5717 defsubr (&Spos_visible_in_window_p); |
5718 defsubr (&Swindow_buffer); | |
5719 defsubr (&Swindow_height); | |
5720 defsubr (&Swindow_width); | |
5721 defsubr (&Swindow_hscroll); | |
5722 defsubr (&Sset_window_hscroll); | |
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
5723 defsubr (&Swindow_redisplay_end_trigger); |
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
5724 defsubr (&Sset_window_redisplay_end_trigger); |
265 | 5725 defsubr (&Swindow_edges); |
432 | 5726 defsubr (&Scoordinates_in_window_p); |
5727 defsubr (&Swindow_at); | |
265 | 5728 defsubr (&Swindow_point); |
5729 defsubr (&Swindow_start); | |
5730 defsubr (&Swindow_end); | |
5731 defsubr (&Sset_window_point); | |
5732 defsubr (&Sset_window_start); | |
5733 defsubr (&Swindow_dedicated_p); | |
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
5734 defsubr (&Sset_window_dedicated_p); |
265 | 5735 defsubr (&Swindow_display_table); |
5736 defsubr (&Sset_window_display_table); | |
5737 defsubr (&Snext_window); | |
5738 defsubr (&Sprevious_window); | |
5739 defsubr (&Sother_window); | |
5740 defsubr (&Sget_lru_window); | |
5741 defsubr (&Sget_largest_window); | |
5742 defsubr (&Sget_buffer_window); | |
5743 defsubr (&Sdelete_other_windows); | |
5744 defsubr (&Sdelete_windows_on); | |
5745 defsubr (&Sreplace_buffer_in_windows); | |
5746 defsubr (&Sdelete_window); | |
5747 defsubr (&Sset_window_buffer); | |
5748 defsubr (&Sselect_window); | |
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
5749 defsubr (&Sspecial_display_p); |
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
5750 defsubr (&Ssame_window_p); |
265 | 5751 defsubr (&Sdisplay_buffer); |
5752 defsubr (&Ssplit_window); | |
5753 defsubr (&Senlarge_window); | |
5754 defsubr (&Sshrink_window); | |
5755 defsubr (&Sscroll_up); | |
5756 defsubr (&Sscroll_down); | |
5757 defsubr (&Sscroll_left); | |
5758 defsubr (&Sscroll_right); | |
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
5759 defsubr (&Sother_window_for_scrolling); |
265 | 5760 defsubr (&Sscroll_other_window); |
5761 defsubr (&Srecenter); | |
34416
0d16962724cb
(displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents:
34409
diff
changeset
|
5762 defsubr (&Swindow_text_height); |
265 | 5763 defsubr (&Smove_to_window_line); |
5764 defsubr (&Swindow_configuration_p); | |
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5765 defsubr (&Swindow_configuration_frame); |
265 | 5766 defsubr (&Sset_window_configuration); |
5767 defsubr (&Scurrent_window_configuration); | |
5768 defsubr (&Ssave_window_excursion); | |
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5769 defsubr (&Sset_window_margins); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5770 defsubr (&Swindow_margins); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5771 defsubr (&Swindow_vscroll); |
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5772 defsubr (&Sset_window_vscroll); |
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5773 defsubr (&Scompare_window_configurations); |
30037
79b4fa5288c3
(Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
29488
diff
changeset
|
5774 defsubr (&Swindow_list); |
265 | 5775 } |
5776 | |
21514 | 5777 void |
265 | 5778 keys_of_window () |
5779 { | |
5780 initial_define_key (control_x_map, '1', "delete-other-windows"); | |
5781 initial_define_key (control_x_map, '2', "split-window"); | |
5782 initial_define_key (control_x_map, '0', "delete-window"); | |
5783 initial_define_key (control_x_map, 'o', "other-window"); | |
5784 initial_define_key (control_x_map, '^', "enlarge-window"); | |
5785 initial_define_key (control_x_map, '<', "scroll-left"); | |
5786 initial_define_key (control_x_map, '>', "scroll-right"); | |
5787 | |
5788 initial_define_key (global_map, Ctl ('V'), "scroll-up"); | |
5789 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); | |
5790 initial_define_key (meta_map, 'v', "scroll-down"); | |
5791 | |
5792 initial_define_key (global_map, Ctl('L'), "recenter"); | |
5793 initial_define_key (meta_map, 'r', "move-to-window-line"); | |
5794 } |