Mercurial > emacs
annotate src/window.c @ 27850:3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
into account.
| author | Gerd Moellmann <gerd@gnu.org> |
|---|---|
| date | Fri, 25 Feb 2000 10:38:54 +0000 |
| parents | 27b993d2ea05 |
| children | 1322db65a230 |
| rev | line source |
|---|---|
| 265 | 1 /* Window creation, deletion and examination for GNU Emacs. |
| 2 Does not include redisplay. | |
| 20708 | 3 Copyright (C) 1985,86,87,93,94,95,96,97,1998 Free Software Foundation, Inc. |
| 265 | 4 |
| 5 This file is part of GNU Emacs. | |
| 6 | |
| 7 GNU Emacs is free software; you can redistribute it and/or modify | |
| 8 it under the terms of the GNU General Public License as published by | |
| 708 | 9 the Free Software Foundation; either version 2, or (at your option) |
| 265 | 10 any later version. |
| 11 | |
| 12 GNU Emacs is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
| 18 along with GNU Emacs; see the file COPYING. If not, write to | |
|
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14175
diff
changeset
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14175
diff
changeset
|
20 Boston, MA 02111-1307, USA. */ |
| 265 | 21 |
|
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4570
diff
changeset
|
22 #include <config.h> |
| 265 | 23 #include "lisp.h" |
| 24 #include "buffer.h" | |
| 769 | 25 #include "frame.h" |
| 265 | 26 #include "window.h" |
| 27 #include "commands.h" | |
| 28 #include "indent.h" | |
| 29 #include "termchar.h" | |
| 30 #include "disptab.h" | |
| 522 | 31 #include "keyboard.h" |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
32 #include "dispextern.h" |
| 18657 | 33 #include "blockinput.h" |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
34 #include "intervals.h" |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
35 |
|
21825
697991d2a2c4
Conditionally include xterm.h using HAVE_X_WINDOWS.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21533
diff
changeset
|
36 #ifdef HAVE_X_WINDOWS |
| 21514 | 37 #include "xterm.h" |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
38 #endif /* HAVE_X_WINDOWS */ |
|
27633
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
39 #ifdef WINDOWSNT |
|
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
40 #include "w32term.h" |
|
ab6c81c6edf8
[WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents:
27553
diff
changeset
|
41 #endif |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
42 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
43 #ifndef max |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
44 #define max(a, b) ((a) < (b) ? (b) : (a)) |
| 21514 | 45 #endif |
| 265 | 46 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
47 |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
48 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
|
49 Lisp_Object Qwindow_size_fixed, Qleft_bitmap_area, Qright_bitmap_area; |
| 25268 | 50 extern Lisp_Object Qheight, Qwidth; |
| 265 | 51 |
| 20351 | 52 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
|
53 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
|
54 static int count_windows P_ ((struct window *)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 static void window_scroll_line_based P_ ((Lisp_Object, int, int, int)); |
| 25268 | 59 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
|
60 static int window_min_size P_ ((struct window *, int, int, int *)); |
| 25268 | 61 static void size_window P_ ((Lisp_Object, int, int, int)); |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
62 static void foreach_window_1 P_ ((struct window *, void (*fn) (), int, int, |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
63 int, int)); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
64 static void freeze_window_start P_ ((struct window *, int)); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
65 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
|
66 static void enlarge_window P_ ((Lisp_Object, int, int)); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
67 |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
68 |
| 265 | 69 /* This is the window in which the terminal's cursor should |
| 70 be left when nothing is being done with it. This must | |
| 71 always be a leaf window, and its buffer is selected by | |
| 72 the top level editing loop at the end of each command. | |
| 73 | |
| 74 This value is always the same as | |
| 769 | 75 FRAME_SELECTED_WINDOW (selected_frame). */ |
| 265 | 76 |
| 77 Lisp_Object selected_window; | |
| 78 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
79 /* The mini-buffer window of the selected frame. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
80 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
|
81 by comparing against this; but you can test for mini-bufferness of |
| 265 | 82 the selected window. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
83 |
| 265 | 84 Lisp_Object minibuf_window; |
| 85 | |
| 86 /* 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
|
87 when the mini-buffer is selected. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
88 |
| 265 | 89 Lisp_Object Vminibuf_scroll_window; |
| 90 | |
| 91 /* 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
|
92 |
| 265 | 93 Lisp_Object Vother_window_scroll_buffer; |
| 94 | |
| 95 /* 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
|
96 |
| 265 | 97 Lisp_Object Vtemp_buffer_show_function; |
| 98 | |
| 99 /* 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
|
100 |
| 265 | 101 int window_min_height; |
| 102 int window_min_width; | |
| 103 | |
| 104 /* Nonzero implies Fdisplay_buffer should create windows. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
105 |
| 265 | 106 int pop_up_windows; |
| 107 | |
| 769 | 108 /* Nonzero implies make new frames for Fdisplay_buffer. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
109 |
| 769 | 110 int pop_up_frames; |
| 265 | 111 |
| 112 /* 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
|
113 |
| 769 | 114 Lisp_Object Vpop_up_frame_function; |
| 265 | 115 |
| 116 /* Function to call to handle Fdisplay_buffer. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
117 |
| 265 | 118 Lisp_Object Vdisplay_buffer_function; |
| 119 | |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
120 /* 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
|
121 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
122 Lisp_Object Vspecial_display_buffer_names; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
123 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
124 /* 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
|
125 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
126 Lisp_Object Vspecial_display_regexps; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
127 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
128 /* Function to pop up a special frame. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
129 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
130 Lisp_Object Vspecial_display_function; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
131 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
132 /* 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
|
133 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
134 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
|
135 |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
136 /* 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
|
137 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
138 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
|
139 |
|
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
140 /* 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
|
141 |
|
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
142 Lisp_Object Qtemp_buffer_show_hook; |
|
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
143 |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
144 /* Fdisplay_buffer always splits the largest window |
| 265 | 145 if that window is more than this high. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
146 |
| 265 | 147 int split_height_threshold; |
| 148 | |
| 149 /* 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
|
150 |
| 265 | 151 int next_screen_context_lines; |
| 152 | |
| 153 /* Incremented for each window created. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
154 |
| 265 | 155 static int sequence_number; |
| 156 | |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
157 /* Nonzero after init_window_once has finished. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
158 |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
159 static int window_initialized; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
160 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
161 /* Hook to run when window config changes. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
162 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
163 Lisp_Object Qwindow_configuration_change_hook; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
164 Lisp_Object Vwindow_configuration_change_hook; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
165 |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
166 /* 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
|
167 at the same screen height as previously. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
168 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
169 Lisp_Object Vscroll_preserve_screen_position; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
170 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
171 #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
|
172 /* 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
|
173 static int inhibit_frame_unsplittable; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
174 #endif /* 0 */ |
|
17540
eb82c4de9dea
(frame_allow_splitting): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17365
diff
changeset
|
175 |
| 265 | 176 #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
|
177 |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
178 extern int scroll_margin; |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
179 |
|
14149
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
180 extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; |
| 265 | 181 |
| 182 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
|
183 "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
|
184 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
185 Lisp_Object object; |
| 265 | 186 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
187 return WINDOWP (object) ? Qt : Qnil; |
| 265 | 188 } |
| 189 | |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
190 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
|
191 "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
|
192 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
193 Lisp_Object object; |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
194 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
195 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
|
196 } |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
197 |
| 265 | 198 Lisp_Object |
| 199 make_window () | |
| 200 { | |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
201 Lisp_Object val; |
| 265 | 202 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
|
203 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
|
204 int i; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
205 |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
206 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
|
207 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
|
208 vec->contents[i] = Qnil; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
209 vec->size = VECSIZE (struct window); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 XSETFASTINT (p->hscroll, 0); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
217 p->orig_top = p->orig_height = Qnil; |
| 265 | 218 p->start = Fmake_marker (); |
| 219 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
|
220 XSETFASTINT (p->use_time, 0); |
| 769 | 221 p->frame = Qnil; |
| 265 | 222 p->display_table = Qnil; |
| 223 p->dedicated = Qnil; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
224 p->pseudo_window_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
225 bzero (&p->cursor, sizeof (p->cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
226 bzero (&p->last_cursor, sizeof (p->last_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
227 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
228 p->desired_matrix = p->current_matrix = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
229 p->phys_cursor_type = -1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
230 p->must_be_updated_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
231 XSETFASTINT (p->window_end_vpos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
232 XSETFASTINT (p->window_end_pos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
233 p->window_end_valid = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
234 p->vscroll = 0; |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
235 XSETWINDOW (val, p); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
236 XSETFASTINT (p->last_point, 0); |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
237 p->frozen_window_start_p = 0; |
| 265 | 238 return val; |
| 239 } | |
| 240 | |
| 241 DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, | |
| 242 "Return the window that the cursor now appears in and commands apply to.") | |
| 243 () | |
| 244 { | |
| 245 return selected_window; | |
| 246 } | |
| 247 | |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
248 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
|
249 "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
|
250 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
|
251 used by that frame.") |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
252 (frame) |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
253 Lisp_Object frame; |
| 265 | 254 { |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
255 if (NILP (frame)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
256 frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
257 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
|
258 return FRAME_MINIBUF_WINDOW (XFRAME (frame)); |
| 265 | 259 } |
| 260 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
261 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, |
| 265 | 262 "Returns non-nil if WINDOW is a minibuffer window.") |
| 263 (window) | |
| 264 Lisp_Object window; | |
| 265 { | |
| 266 struct window *w = decode_window (window); | |
| 267 return (MINI_WINDOW_P (w) ? Qt : Qnil); | |
| 268 } | |
| 269 | |
| 270 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | |
| 271 Spos_visible_in_window_p, 0, 2, 0, | |
| 769 | 272 "Return t if position POS is currently on the frame in WINDOW.\n\ |
| 265 | 273 Returns nil if that position is scrolled vertically out of view.\n\ |
| 274 POS defaults to point; WINDOW, to the selected window.") | |
| 275 (pos, window) | |
| 276 Lisp_Object pos, window; | |
| 277 { | |
| 278 register struct window *w; | |
| 279 register int posint; | |
| 280 register struct buffer *buf; | |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
281 struct text_pos top; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
282 Lisp_Object in_window; |
| 265 | 283 |
| 485 | 284 if (NILP (pos)) |
| 7347 | 285 posint = PT; |
| 265 | 286 else |
| 287 { | |
| 288 CHECK_NUMBER_COERCE_MARKER (pos, 0); | |
| 289 posint = XINT (pos); | |
| 290 } | |
| 291 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
292 w = decode_window (window); |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
293 buf = XBUFFER (w->buffer); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
294 SET_TEXT_POS_FROM_MARKER (top, w->start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
295 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
296 /* If position above window, it's not visible. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
297 if (posint < CHARPOS (top)) |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
298 in_window = Qnil; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
299 else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
300 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
301 && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
302 /* If frame is up to date, and POSINT is < window end pos, use |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
303 that info. This doesn't work for POSINT == end pos, because |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
304 the window end pos is actually the position _after_ the last |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
305 char in the window. */ |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
306 in_window = Qt; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
307 else if (posint > BUF_ZV (buf)) |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
308 in_window = Qnil; |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
309 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
|
310 /* 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
|
311 in_window = Qnil; |
| 265 | 312 else |
| 313 { | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
314 struct it it; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
315 start_display (&it, w, top); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
316 move_it_to (&it, posint, 0, it.last_visible_y, -1, |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
317 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
318 in_window = IT_CHARPOS (it) == posint ? Qt : Qnil; |
| 265 | 319 } |
|
25300
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
320 |
|
096b78b6cc2e
(Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
25268
diff
changeset
|
321 return in_window; |
| 265 | 322 } |
| 323 | |
| 324 static struct window * | |
| 325 decode_window (window) | |
| 326 register Lisp_Object window; | |
| 327 { | |
| 485 | 328 if (NILP (window)) |
| 265 | 329 return XWINDOW (selected_window); |
| 330 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
331 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 332 return XWINDOW (window); |
| 333 } | |
| 334 | |
| 335 DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, | |
| 336 "Return the buffer that WINDOW is displaying.") | |
| 337 (window) | |
| 338 Lisp_Object window; | |
| 339 { | |
| 340 return decode_window (window)->buffer; | |
| 341 } | |
| 342 | |
| 343 DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, | |
| 344 "Return the number of lines in WINDOW (including its mode line).") | |
| 345 (window) | |
| 346 Lisp_Object window; | |
| 347 { | |
| 348 return decode_window (window)->height; | |
| 349 } | |
| 350 | |
| 351 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
|
352 "Return the number of display columns in WINDOW.\n\ |
|
ed4b06e1975b
(Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6232
diff
changeset
|
353 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
|
354 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
|
355 use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))).") |
| 265 | 356 (window) |
| 357 Lisp_Object window; | |
| 358 { | |
|
6576
851ee89bae86
(Fwindow_width): Delete unnecessary variable declarations.
Karl Heuer <kwzh@gnu.org>
parents:
6517
diff
changeset
|
359 return make_number (window_internal_width (decode_window (window))); |
| 265 | 360 } |
| 361 | |
| 362 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |
| 363 "Return the number of columns by which WINDOW is scrolled from left margin.") | |
| 364 (window) | |
| 365 Lisp_Object window; | |
| 366 { | |
| 367 return decode_window (window)->hscroll; | |
| 368 } | |
| 369 | |
| 370 DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | |
| 371 "Set number of columns WINDOW is scrolled from left margin to NCOL.\n\ | |
| 372 NCOL should be zero or positive.") | |
| 373 (window, ncol) | |
| 374 register Lisp_Object window, ncol; | |
| 375 { | |
| 376 register struct window *w; | |
| 377 | |
| 378 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
|
379 if (XINT (ncol) < 0) XSETFASTINT (ncol, 0); |
| 265 | 380 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
|
381 if (XINT (w->hscroll) != XINT (ncol)) |
| 25375 | 382 /* Prevent redisplay shortcuts */ |
| 383 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | |
| 265 | 384 w->hscroll = ncol; |
| 385 return ncol; | |
| 386 } | |
| 387 | |
|
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
388 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
|
389 Swindow_redisplay_end_trigger, 0, 1, 0, |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
390 "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
|
391 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
|
392 (window) |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
393 Lisp_Object window; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
394 { |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
395 return decode_window (window)->redisplay_end_trigger; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
396 } |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
397 |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
398 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
|
399 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
|
400 "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
|
401 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
|
402 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
|
403 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
|
404 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
|
405 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
|
406 (window, value) |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
407 register Lisp_Object window, value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
408 { |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
409 register struct window *w; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
410 |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
411 w = decode_window (window); |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
412 w->redisplay_end_trigger = value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
413 return value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
414 } |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
415 |
| 265 | 416 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, |
| 417 "Return a list of the edge coordinates of WINDOW.\n\ | |
| 769 | 418 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame.\n\ |
| 265 | 419 RIGHT is one more than the rightmost column used by WINDOW,\n\ |
| 420 and BOTTOM is one more than the bottommost row used by WINDOW\n\ | |
| 421 and its mode-line.") | |
| 422 (window) | |
| 423 Lisp_Object window; | |
| 424 { | |
| 425 register struct window *w = decode_window (window); | |
| 426 | |
| 427 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
|
428 Fcons (make_number (WINDOW_RIGHT_EDGE (w)), |
| 265 | 429 Fcons (make_number (XFASTINT (w->top) |
| 430 + XFASTINT (w->height)), | |
| 431 Qnil)))); | |
| 432 } | |
| 433 | |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
434 /* Test if the character at column *X, row *Y is within window W. |
| 432 | 435 If it is not, return 0; |
| 436 if it is in the window's text area, | |
| 437 set *x and *y to its location relative to the upper left corner | |
| 438 of the window, and | |
| 439 return 1; | |
| 440 if it is on the window's modeline, return 2; | |
| 441 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
|
442 return 3. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
443 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
|
444 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
|
445 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
|
446 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
447 X and Y are frame relative pixel coordinates. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
448 |
| 432 | 449 static int |
| 450 coordinates_in_window (w, x, y) | |
| 451 register struct window *w; | |
| 452 register int *x, *y; | |
| 453 { | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
454 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
455 int left_x, right_x, top_y, bottom_y; |
|
25462
19b101d6ee2a
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
25402
diff
changeset
|
456 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
|
457 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
458 if (w->pseudo_window_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
459 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
460 left_x = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
461 right_x = XFASTINT (w->width) * CANON_Y_UNIT (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
462 top_y = WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
463 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
464 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
465 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
466 { |
|
27850
3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents:
27848
diff
changeset
|
467 left_x = (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w) |
|
3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents:
27848
diff
changeset
|
468 - FRAME_INTERNAL_BORDER_WIDTH (f)); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
469 right_x = WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X (w); |
|
27850
3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents:
27848
diff
changeset
|
470 top_y = (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w) |
|
3c13fcdeb63a
(coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents:
27848
diff
changeset
|
471 - FRAME_INTERNAL_BORDER_WIDTH (f)); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
472 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
473 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
474 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
475 if (*y < top_y |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
476 || *y >= bottom_y |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
477 || *x < (left_x |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
478 - flags_area_width |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
479 - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
480 * CANON_X_UNIT (f))) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
481 || *x > right_x + flags_area_width) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
482 /* Completely outside anything interesting. */ |
| 432 | 483 return 0; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
484 else if (WINDOW_WANTS_MODELINE_P (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
485 && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
486 /* On the mode line. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
487 return 2; |
| 25546 | 488 else if (WINDOW_WANTS_HEADER_LINE_P (w) |
| 489 && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)) | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
490 /* On the top line. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
491 return 4; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
492 else if (*x < left_x || *x >= right_x) |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
493 { |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
494 /* Other lines than the mode line don't include flags areas and |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
495 scroll bars on the left. */ |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
496 |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
497 /* Convert X and Y to window-relative pixel coordinates. */ |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
498 *x -= left_x; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
499 *y -= top_y; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
500 return *x < left_x ? 5 : 6; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
501 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
502 else if (!w->pseudo_window_p |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
503 && !WINDOW_RIGHTMOST_P (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
504 && *x >= right_x - CANON_X_UNIT (f)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
505 /* On the border on the right side of the window? Assume that |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
506 this area begins at RIGHT_X minus a canonical char width. */ |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
507 return 3; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
508 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
509 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
510 /* Convert X and Y to window-relative pixel coordinates. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
511 *x -= left_x; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
512 *y -= top_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
513 return 1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
514 } |
| 432 | 515 } |
| 516 | |
| 517 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, | |
| 518 Scoordinates_in_window_p, 2, 2, 0, | |
| 519 "Return non-nil if COORDINATES are in WINDOW.\n\ | |
| 708 | 520 COORDINATES is a cons of the form (X . Y), X and Y being distances\n\ |
| 769 | 521 measured in characters from the upper-left corner of the frame.\n\ |
| 708 | 522 (0 . 0) denotes the character in the upper left corner of the\n\ |
| 769 | 523 frame.\n\ |
| 432 | 524 If COORDINATES are in the text portion of WINDOW,\n\ |
| 525 the coordinates relative to the window are returned.\n\ | |
| 732 | 526 If they are in the mode line of WINDOW, `mode-line' is returned.\n\ |
| 25546 | 527 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
|
528 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
|
529 `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
|
530 the window, `right-bitmap-area' is returned.\n\ |
| 432 | 531 If they are on the border between WINDOW and its right sibling,\n\ |
| 732 | 532 `vertical-line' is returned.") |
| 432 | 533 (coordinates, window) |
| 534 register Lisp_Object coordinates, window; | |
| 535 { | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
536 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
537 struct frame *f; |
| 432 | 538 int x, y; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
539 Lisp_Object lx, ly; |
| 432 | 540 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
541 CHECK_LIVE_WINDOW (window, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
542 w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
543 f = XFRAME (w->frame); |
| 432 | 544 CHECK_CONS (coordinates, 1); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
545 lx = Fcar (coordinates); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
546 ly = Fcdr (coordinates); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
547 CHECK_NUMBER_OR_FLOAT (lx, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
548 CHECK_NUMBER_OR_FLOAT (ly, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
549 x = PIXEL_X_FROM_CANON_X (f, lx); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
550 y = PIXEL_Y_FROM_CANON_Y (f, ly); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
551 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
552 switch (coordinates_in_window (w, &x, &y)) |
| 432 | 553 { |
| 554 case 0: /* NOT in window at all. */ | |
| 555 return Qnil; | |
| 556 | |
| 557 case 1: /* In text part of window. */ | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
558 /* X and Y are now window relative pixel coordinates. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
559 Convert them to canonical char units before returning |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
560 them. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
561 return Fcons (CANON_X_FROM_PIXEL_X (f, x), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
562 CANON_Y_FROM_PIXEL_Y (f, y)); |
| 432 | 563 |
| 564 case 2: /* In mode line of window. */ | |
| 565 return Qmode_line; | |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
566 |
| 432 | 567 case 3: /* On right border of window. */ |
| 732 | 568 return Qvertical_line; |
| 432 | 569 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
570 case 4: |
| 25546 | 571 return Qheader_line; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
572 |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
573 case 5: |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
574 return Qleft_bitmap_area; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
575 |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
576 case 6: |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
577 return Qright_bitmap_area; |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
578 |
| 432 | 579 default: |
| 580 abort (); | |
| 581 } | |
| 582 } | |
| 583 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
584 /* 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
|
585 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
|
586 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
|
587 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
|
588 there is no window under X, Y return nil and leave *PART |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
589 unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
590 |
| 265 | 591 Lisp_Object |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
592 window_from_coordinates (frame, x, y, part, tool_bar_p) |
| 769 | 593 FRAME_PTR frame; |
| 265 | 594 int x, y; |
| 432 | 595 int *part; |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
596 int tool_bar_p; |
| 265 | 597 { |
| 598 register Lisp_Object tem, first; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
599 int found; |
| 265 | 600 |
| 769 | 601 tem = first = FRAME_SELECTED_WINDOW (frame); |
| 265 | 602 |
| 432 | 603 do |
| 265 | 604 { |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
605 found = coordinates_in_window (XWINDOW (tem), &x, &y); |
| 265 | 606 |
| 607 if (found) | |
| 608 { | |
| 432 | 609 *part = found - 1; |
| 265 | 610 return tem; |
| 611 } | |
| 612 | |
| 432 | 613 tem = Fnext_window (tem, Qt, Qlambda); |
| 265 | 614 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
615 while (!EQ (tem, first)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
616 |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
617 /* See if it's in the tool bar window, if a tool bar exists. */ |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
618 if (tool_bar_p |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
619 && WINDOWP (frame->tool_bar_window) |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
620 && XFASTINT (XWINDOW (frame->tool_bar_window)->height) |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
621 && coordinates_in_window (XWINDOW (frame->tool_bar_window), &x, &y)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
622 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
623 *part = 0; |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25540
diff
changeset
|
624 return frame->tool_bar_window; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
625 } |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
626 |
| 432 | 627 return Qnil; |
| 265 | 628 } |
| 629 | |
|
681
026f978690be
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
555
diff
changeset
|
630 DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, |
| 1798 | 631 "Return window containing coordinates X and Y on FRAME.\n\ |
| 769 | 632 If omitted, FRAME defaults to the currently selected frame.\n\ |
| 633 The top left corner of the frame is considered to be row 0,\n\ | |
| 548 | 634 column 0.") |
| 1798 | 635 (x, y, frame) |
| 636 Lisp_Object x, y, frame; | |
| 265 | 637 { |
| 638 int part; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
639 struct frame *f; |
| 265 | 640 |
| 769 | 641 if (NILP (frame)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
642 frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
643 CHECK_LIVE_FRAME (frame, 2); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
644 f = XFRAME (frame); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
645 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
646 /* Check that arguments are integers or floats. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
647 CHECK_NUMBER_OR_FLOAT (x, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
648 CHECK_NUMBER_OR_FLOAT (y, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
649 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
650 return window_from_coordinates (f, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
651 PIXEL_X_FROM_CANON_X (f, x), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
652 PIXEL_Y_FROM_CANON_Y (f, y), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
653 &part, 0); |
| 265 | 654 } |
| 655 | |
| 656 DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | |
| 657 "Return current value of point in WINDOW.\n\ | |
| 658 For a nonselected window, this is the value point would have\n\ | |
| 659 if that window were selected.\n\ | |
| 660 \n\ | |
| 661 Note that, when WINDOW is the selected window and its buffer\n\ | |
| 662 is also currently selected, the value returned is the same as (point).\n\ | |
| 663 It would be more strictly correct to return the `top-level' value\n\ | |
| 664 of point, outside of any save-excursion forms.\n\ | |
| 665 But that is hard to define.") | |
| 666 (window) | |
| 667 Lisp_Object window; | |
| 668 { | |
| 669 register struct window *w = decode_window (window); | |
| 670 | |
| 671 if (w == XWINDOW (selected_window) | |
| 672 && current_buffer == XBUFFER (w->buffer)) | |
| 673 return Fpoint (); | |
| 674 return Fmarker_position (w->pointm); | |
| 675 } | |
| 676 | |
| 677 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
|
678 "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
|
679 This is updated by redisplay or by calling `set-window-start'.") |
| 265 | 680 (window) |
| 681 Lisp_Object window; | |
| 682 { | |
| 683 return Fmarker_position (decode_window (window)->start); | |
| 684 } | |
| 685 | |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
686 /* 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
|
687 |
|
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
688 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
|
689 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
|
690 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
|
691 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
|
692 (save-excursion\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
693 (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
|
694 (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
|
695 (point))") */ |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
696 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
697 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
|
698 "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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 (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
|
705 Lisp_Object window, update; |
| 265 | 706 { |
| 707 Lisp_Object value; | |
| 708 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
|
709 Lisp_Object buf; |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
710 |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
711 buf = w->buffer; |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
712 CHECK_BUFFER (buf, 0); |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
713 |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
714 #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
|
715 /* 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
|
716 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
|
717 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
|
718 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
|
719 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
|
720 return Qnil; |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
721 #endif |
|
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
722 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
723 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
|
724 && ! (! 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
|
725 && 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
|
726 { |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
727 int opoint = PT, opoint_byte = PT_BYTE; |
|
26635
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
728 |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
729 /* 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
|
730 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
|
731 `-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
|
732 commands. At the end, W->start happened to be BEG, while |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
733 rmail had already narrowed the buffer. This leads to an |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
734 abort in temp_set_pt_both. */ |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
735 if (XMARKER (w->start)->charpos < BEGV) |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
736 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
737 else if (XMARKER (w->start)->charpos > ZV) |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
738 TEMP_SET_PT_BOTH (ZV, ZV_BYTE); |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
739 else |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
740 TEMP_SET_PT_BOTH (XMARKER (w->start)->charpos, |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
741 XMARKER (w->start)->bytepos); |
|
af8d605cbcf1
(Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents:
26164
diff
changeset
|
742 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
743 Fvertical_motion (make_number (window_internal_height (w)), Qnil); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
744 XSETINT (value, PT); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
745 TEMP_SET_PT_BOTH (opoint, opoint_byte); |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
746 } |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
747 else |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
748 XSETINT (value, |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
749 BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); |
| 265 | 750 |
| 751 return value; | |
| 752 } | |
| 753 | |
| 754 DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, | |
| 755 "Make point value in WINDOW be at position POS in WINDOW's buffer.") | |
| 756 (window, pos) | |
| 757 Lisp_Object window, pos; | |
| 758 { | |
| 759 register struct window *w = decode_window (window); | |
| 760 | |
| 761 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
|
762 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
|
763 && XBUFFER (w->buffer) == current_buffer) |
| 265 | 764 Fgoto_char (pos); |
| 765 else | |
| 766 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
|
767 |
| 265 | 768 return pos; |
| 769 } | |
| 770 | |
| 771 DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, | |
| 772 "Make display in WINDOW start at position POS in WINDOW's buffer.\n\ | |
| 773 Optional third arg NOFORCE non-nil inhibits next redisplay\n\ | |
| 774 from overriding motion of point in order to display at this exact start.") | |
| 775 (window, pos, noforce) | |
| 776 Lisp_Object window, pos, noforce; | |
| 777 { | |
| 778 register struct window *w = decode_window (window); | |
| 779 | |
| 780 CHECK_NUMBER_COERCE_MARKER (pos, 1); | |
| 781 set_marker_restricted (w->start, pos, w->buffer); | |
| 782 /* this is not right, but much easier than doing what is right. */ | |
| 783 w->start_at_line_beg = Qnil; | |
| 485 | 784 if (NILP (noforce)) |
| 265 | 785 w->force_start = Qt; |
| 786 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
|
787 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
|
788 XSETFASTINT (w->last_overlay_modified, 0); |
| 338 | 789 if (!EQ (window, selected_window)) |
| 790 windows_or_buffers_changed++; | |
|
25387
df0083768b79
(Fset_window_point): Reset Vresize_mini_config.
Gerd Moellmann <gerd@gnu.org>
parents:
25375
diff
changeset
|
791 |
| 265 | 792 return pos; |
| 793 } | |
| 794 | |
| 795 DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | |
| 796 1, 1, 0, | |
| 797 "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
|
798 See also `set-window-dedicated-p'.") |
| 265 | 799 (window) |
| 800 Lisp_Object window; | |
| 801 { | |
| 802 return decode_window (window)->dedicated; | |
| 803 } | |
| 804 | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
805 DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
806 Sset_window_dedicated_p, 2, 2, 0, |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
807 "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
|
808 If it is dedicated, Emacs will not automatically change\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
809 which buffer appears in it.\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
810 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
|
811 non-nil means yes.") |
| 265 | 812 (window, arg) |
| 813 Lisp_Object window, arg; | |
| 814 { | |
| 815 register struct window *w = decode_window (window); | |
| 816 | |
| 485 | 817 if (NILP (arg)) |
| 265 | 818 w->dedicated = Qnil; |
| 819 else | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
820 w->dedicated = Qt; |
| 265 | 821 |
| 822 return w->dedicated; | |
| 823 } | |
| 824 | |
| 825 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, | |
| 826 0, 1, 0, | |
| 827 "Return the display-table that WINDOW is using.") | |
| 828 (window) | |
| 829 Lisp_Object window; | |
| 830 { | |
| 831 return decode_window (window)->display_table; | |
| 832 } | |
| 833 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
834 /* 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
|
835 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
|
836 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
|
837 return 0. */ |
| 265 | 838 |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
839 struct Lisp_Char_Table * |
| 265 | 840 window_display_table (w) |
| 841 struct window *w; | |
| 842 { | |
| 843 Lisp_Object tem; | |
| 844 tem = w->display_table; | |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
845 if (DISP_TABLE_P (tem)) |
|
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
846 return XCHAR_TABLE (tem); |
|
21227
be147fbd56f1
(window_display_table): Don't look inside buffer if its nil.
Richard M. Stallman <rms@gnu.org>
parents:
21198
diff
changeset
|
847 if (NILP (w->buffer)) |
|
be147fbd56f1
(window_display_table): Don't look inside buffer if its nil.
Richard M. Stallman <rms@gnu.org>
parents:
21198
diff
changeset
|
848 return 0; |
|
be147fbd56f1
(window_display_table): Don't look inside buffer if its nil.
Richard M. Stallman <rms@gnu.org>
parents:
21198
diff
changeset
|
849 |
| 265 | 850 tem = XBUFFER (w->buffer)->display_table; |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
851 if (DISP_TABLE_P (tem)) |
|
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
852 return XCHAR_TABLE (tem); |
| 265 | 853 tem = Vstandard_display_table; |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
854 if (DISP_TABLE_P (tem)) |
|
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
855 return XCHAR_TABLE (tem); |
| 265 | 856 return 0; |
| 857 } | |
| 858 | |
| 555 | 859 DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, |
| 265 | 860 "Set WINDOW's display-table to TABLE.") |
| 861 (window, table) | |
| 862 register Lisp_Object window, table; | |
| 863 { | |
| 864 register struct window *w; | |
| 865 | |
| 866 w = decode_window (window); | |
| 867 w->display_table = table; | |
| 868 return table; | |
| 869 } | |
| 870 | |
| 871 /* Record info on buffer window w is displaying | |
| 872 when it is about to cease to display that buffer. */ | |
| 21514 | 873 static void |
| 265 | 874 unshow_buffer (w) |
| 875 register struct window *w; | |
| 876 { | |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
877 Lisp_Object buf; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
878 struct buffer *b; |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
879 |
|
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
880 buf = w->buffer; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
881 b = XBUFFER (buf); |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
882 if (b != XMARKER (w->pointm)->buffer) |
| 265 | 883 abort (); |
| 884 | |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
885 if (w == XWINDOW (b->last_selected_window)) |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
886 b->last_selected_window = Qnil; |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
887 |
|
5990
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
888 #if 0 |
| 265 | 889 if (w == XWINDOW (selected_window) |
| 890 || ! EQ (buf, XWINDOW (selected_window)->buffer)) | |
| 891 /* Do this except when the selected window's buffer | |
| 892 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
|
893 #endif |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
894 /* 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
|
895 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
|
896 Now that this statement is unconditional, |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
897 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
|
898 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
|
899 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
|
900 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
|
901 b->last_window_start = marker_position (w->start); |
| 265 | 902 |
| 903 /* Point in the selected window's buffer | |
| 904 is actually stored in that buffer, and the window's pointm isn't used. | |
| 905 So don't clobber point in that buffer. */ | |
| 906 if (! EQ (buf, XWINDOW (selected_window)->buffer)) | |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
907 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
|
908 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
|
909 XMARKER (w->pointm)->charpos, |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
910 BUF_ZV (b)), |
|
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
911 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
|
912 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
|
913 BUF_ZV_BYTE (b))); |
| 265 | 914 } |
| 915 | |
| 916 /* Put replacement into the window structure in place of old. */ | |
| 21514 | 917 static void |
| 265 | 918 replace_window (old, replacement) |
| 919 Lisp_Object old, replacement; | |
| 920 { | |
| 921 register Lisp_Object tem; | |
| 922 register struct window *o = XWINDOW (old), *p = XWINDOW (replacement); | |
| 923 | |
| 769 | 924 /* If OLD is its frame's root_window, then replacement is the new |
| 925 root_window for that frame. */ | |
| 265 | 926 |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
927 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) |
| 769 | 928 FRAME_ROOT_WINDOW (XFRAME (o->frame)) = replacement; |
| 265 | 929 |
| 930 p->left = o->left; | |
| 931 p->top = o->top; | |
| 932 p->width = o->width; | |
| 933 p->height = o->height; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
934 p->desired_matrix = p->current_matrix = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
935 p->vscroll = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
936 bzero (&p->cursor, sizeof (p->cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
937 bzero (&p->last_cursor, sizeof (p->last_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
938 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
939 p->phys_cursor_type = -1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
940 p->must_be_updated_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
941 p->pseudo_window_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
942 XSETFASTINT (p->window_end_vpos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
943 XSETFASTINT (p->window_end_pos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
944 p->window_end_valid = Qnil; |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
945 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
|
946 p->orig_top = p->orig_height = Qnil; |
| 265 | 947 |
| 948 p->next = tem = o->next; | |
| 485 | 949 if (!NILP (tem)) |
| 265 | 950 XWINDOW (tem)->prev = replacement; |
| 951 | |
| 952 p->prev = tem = o->prev; | |
| 485 | 953 if (!NILP (tem)) |
| 265 | 954 XWINDOW (tem)->next = replacement; |
| 955 | |
| 956 p->parent = tem = o->parent; | |
| 485 | 957 if (!NILP (tem)) |
| 265 | 958 { |
| 959 if (EQ (XWINDOW (tem)->vchild, old)) | |
| 960 XWINDOW (tem)->vchild = replacement; | |
| 961 if (EQ (XWINDOW (tem)->hchild, old)) | |
| 962 XWINDOW (tem)->hchild = replacement; | |
| 963 } | |
| 964 | |
| 965 /*** Here, if replacement is a vertical combination | |
| 966 and so is its new parent, we should make replacement's | |
| 967 children be children of that parent instead. ***/ | |
| 968 } | |
| 969 | |
| 970 DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", | |
| 971 "Remove WINDOW from the display. Default is selected window.") | |
| 972 (window) | |
| 973 register Lisp_Object window; | |
| 974 { | |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
975 delete_window (window); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
976 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
977 if (! NILP (Vwindow_configuration_change_hook) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
978 && ! NILP (Vrun_hooks)) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
979 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
980 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
981 return Qnil; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
982 } |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
983 |
| 20351 | 984 void |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
985 delete_window (window) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
986 register Lisp_Object window; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
987 { |
| 265 | 988 register Lisp_Object tem, parent, sib; |
| 989 register struct window *p; | |
| 990 register struct window *par; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
991 FRAME_PTR frame; |
| 265 | 992 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
993 /* 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
|
994 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
|
995 so we can't decode_window here. */ |
| 485 | 996 if (NILP (window)) |
| 265 | 997 window = selected_window; |
| 998 else | |
| 999 CHECK_WINDOW (window, 0); | |
| 1000 p = XWINDOW (window); | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1001 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1002 /* 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
|
1003 if (NILP (p->buffer) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1004 && NILP (p->hchild) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1005 && NILP (p->vchild)) |
|
17365
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
1006 return; |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1007 |
| 265 | 1008 parent = p->parent; |
| 485 | 1009 if (NILP (parent)) |
| 265 | 1010 error ("Attempt to delete minibuffer or sole ordinary window"); |
| 1011 par = XWINDOW (parent); | |
| 1012 | |
| 1013 windows_or_buffers_changed++; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1014 frame = XFRAME (WINDOW_FRAME (p)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1015 FRAME_WINDOW_SIZES_CHANGED (frame) = 1; |
| 265 | 1016 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1017 /* 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
|
1018 { |
|
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1019 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
|
1020 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1021 /* 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
|
1022 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
|
1023 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
|
1024 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
|
1025 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
|
1026 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1027 while (!NILP (pwindow)) |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1028 { |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1029 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
|
1030 break; |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1031 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
|
1032 } |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1033 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1034 if (EQ (window, pwindow)) |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1035 { |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1036 Lisp_Object alternative; |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1037 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
|
1038 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1039 /* 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
|
1040 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
|
1041 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
|
1042 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
|
1043 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
|
1044 if (EQ (window, selected_window)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1045 Fselect_window (alternative); |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1046 else |
|
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
1047 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
|
1048 } |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1049 } |
| 265 | 1050 |
| 1051 tem = p->buffer; | |
| 1052 /* tem is null for dummy parent windows | |
| 1053 (which have inferiors but not any contents themselves) */ | |
| 485 | 1054 if (!NILP (tem)) |
| 265 | 1055 { |
| 1056 unshow_buffer (p); | |
| 1057 unchain_marker (p->pointm); | |
| 1058 unchain_marker (p->start); | |
| 1059 } | |
| 1060 | |
|
26761
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1061 /* 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
|
1062 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
|
1063 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
|
1064 processed while we are changing them. */ |
|
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1065 BLOCK_INPUT; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1066 free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (frame))); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1067 |
| 265 | 1068 tem = p->next; |
| 485 | 1069 if (!NILP (tem)) |
| 265 | 1070 XWINDOW (tem)->prev = p->prev; |
| 1071 | |
| 1072 tem = p->prev; | |
| 485 | 1073 if (!NILP (tem)) |
| 265 | 1074 XWINDOW (tem)->next = p->next; |
| 1075 | |
| 1076 if (EQ (window, par->hchild)) | |
| 1077 par->hchild = p->next; | |
| 1078 if (EQ (window, par->vchild)) | |
| 1079 par->vchild = p->next; | |
| 1080 | |
| 1081 /* Find one of our siblings to give our space to. */ | |
| 1082 sib = p->prev; | |
| 485 | 1083 if (NILP (sib)) |
| 265 | 1084 { |
| 1085 /* If p gives its space to its next sibling, that sibling needs | |
| 1086 to have its top/left side pulled back to where p's is. | |
| 1087 set_window_{height,width} will re-position the sibling's | |
| 1088 children. */ | |
| 1089 sib = p->next; | |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
1090 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
|
1091 XWINDOW (sib)->left = p->left; |
| 265 | 1092 } |
| 1093 | |
| 1094 /* Stretch that sibling. */ | |
| 485 | 1095 if (!NILP (par->vchild)) |
| 265 | 1096 set_window_height (sib, |
| 1097 XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height), | |
| 1098 1); | |
| 485 | 1099 if (!NILP (par->hchild)) |
| 265 | 1100 set_window_width (sib, |
| 1101 XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width), | |
| 1102 1); | |
| 1103 | |
| 1104 /* If parent now has only one child, | |
| 1105 put the child into the parent's place. */ | |
| 1106 tem = par->hchild; | |
| 485 | 1107 if (NILP (tem)) |
| 265 | 1108 tem = par->vchild; |
| 485 | 1109 if (NILP (XWINDOW (tem)->next)) |
| 265 | 1110 replace_window (parent, tem); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1111 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1112 /* 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
|
1113 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
|
1114 if (! NILP (p->hchild)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1115 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
|
1116 else if (! NILP (p->vchild)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1117 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
|
1118 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1119 /* Mark this window as deleted. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1120 p->buffer = p->hchild = p->vchild = Qnil; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1121 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1122 /* Adjust glyph matrices. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1123 adjust_glyphs (frame); |
|
26761
c15c2756ec0f
(delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents:
26635
diff
changeset
|
1124 UNBLOCK_INPUT; |
| 265 | 1125 } |
| 1126 | |
| 432 | 1127 |
| 769 | 1128 extern Lisp_Object next_frame (), prev_frame (); |
| 432 | 1129 |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1130 /* 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
|
1131 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
|
1132 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
|
1133 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1134 DEFUN ("next-window", Ffoo, Sfoo, 0, 3, 0, |
| 432 | 1135 "Return next window after WINDOW in canonical ordering of windows.\n\ |
| 1136 If omitted, WINDOW defaults to the selected window.\n\ | |
| 1137 \n\ | |
| 1138 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
| 1139 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
| 1140 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
| 1141 minibuffer even if it is active.\n\ | |
| 1142 \n\ | |
| 769 | 1143 Several frames may share a single minibuffer; if the minibuffer\n\ |
| 1144 counts, all windows on all frames that share that minibuffer count\n\ | |
| 8139 | 1145 too. Therefore, `next-window' can be used to iterate through the\n\ |
| 769 | 1146 set of windows even when the minibuffer is on another frame. If the\n\ |
| 1147 minibuffer does not count, only windows from WINDOW's frame count.\n\ | |
| 432 | 1148 \n\ |
| 769 | 1149 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
| 1150 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
|
1151 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
|
1152 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
|
1153 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
|
1154 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
|
1155 \n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1156 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
|
1157 `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
|
1158 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
|
1159 `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
|
1160 (window, minibuf, all_frames) */ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1161 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1162 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
|
1163 0) |
| 769 | 1164 (window, minibuf, all_frames) |
| 1165 register Lisp_Object window, minibuf, all_frames; | |
| 265 | 1166 { |
| 432 | 1167 register Lisp_Object tem; |
| 1168 Lisp_Object start_window; | |
| 265 | 1169 |
| 485 | 1170 if (NILP (window)) |
| 432 | 1171 window = selected_window; |
| 1172 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1173 CHECK_LIVE_WINDOW (window, 0); |
| 432 | 1174 |
| 1175 start_window = window; | |
| 1176 | |
| 1177 /* minibuf == nil may or may not include minibuffers. | |
| 1178 Decide if it does. */ | |
| 485 | 1179 if (NILP (minibuf)) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1180 minibuf = (minibuf_level ? minibuf_window : Qlambda); |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1181 else if (! EQ (minibuf, Qt)) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1182 minibuf = Qlambda; |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1183 /* Now minibuf can be t => count all minibuffer windows, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1184 lambda => count none of them, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1185 or a specific minibuffer window (the active one) to count. */ |
| 432 | 1186 |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1187 /* all_frames == nil doesn't specify which frames to include. */ |
| 769 | 1188 if (NILP (all_frames)) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1189 all_frames = (! EQ (minibuf, Qlambda) |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1190 ? (FRAME_MINIBUF_WINDOW |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1191 (XFRAME |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1192 (WINDOW_FRAME |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1193 (XWINDOW (window))))) |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1194 : Qnil); |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1195 else if (EQ (all_frames, Qvisible)) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1196 ; |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1197 else if (XFASTINT (all_frames) == 0) |
|
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1198 ; |
|
11307
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1199 else if (FRAMEP (all_frames) && ! EQ (all_frames, Fwindow_frame (window))) |
|
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1200 /* If all_frames is a frame and window arg isn't on that frame, just |
|
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1201 return the first window on the frame. */ |
|
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1202 return Fframe_first_window (all_frames); |
| 769 | 1203 else if (! EQ (all_frames, Qt)) |
| 1204 all_frames = Qnil; | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1205 /* Now all_frames is t meaning search all frames, |
|
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1206 nil meaning search just current frame, |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1207 visible meaning search just visible frames, |
|
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1208 0 meaning search visible and iconified frames, |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1209 or a window, meaning search the frame that window belongs to. */ |
| 432 | 1210 |
| 265 | 1211 /* Do this loop at least once, to get the next window, and perhaps |
| 1212 again, if we hit the minibuffer and that is not acceptable. */ | |
| 1213 do | |
| 1214 { | |
| 1215 /* Find a window that actually has a next one. This loop | |
| 1216 climbs up the tree. */ | |
| 485 | 1217 while (tem = XWINDOW (window)->next, NILP (tem)) |
| 1218 if (tem = XWINDOW (window)->parent, !NILP (tem)) | |
| 265 | 1219 window = tem; |
| 432 | 1220 else |
| 265 | 1221 { |
| 769 | 1222 /* We've reached the end of this frame. |
| 1223 Which other frames are acceptable? */ | |
| 1224 tem = WINDOW_FRAME (XWINDOW (window)); | |
| 1225 if (! NILP (all_frames)) | |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1226 { |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1227 Lisp_Object tem1; |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1228 |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1229 tem1 = tem; |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1230 tem = next_frame (tem, all_frames); |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1231 /* In the case where the minibuffer is active, |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1232 and we include its frame as well as the selected one, |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1233 next_frame may get stuck in that frame. |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1234 If that happens, go back to the selected frame |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1235 so we can complete the cycle. */ |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1236 if (EQ (tem, tem1)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
1237 tem = selected_frame; |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1238 } |
| 769 | 1239 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); |
| 432 | 1240 |
| 265 | 1241 break; |
| 1242 } | |
| 1243 | |
| 1244 window = tem; | |
| 432 | 1245 |
| 265 | 1246 /* If we're in a combination window, find its first child and |
| 1247 recurse on that. Otherwise, we've found the window we want. */ | |
| 1248 while (1) | |
| 1249 { | |
| 485 | 1250 if (!NILP (XWINDOW (window)->hchild)) |
| 265 | 1251 window = XWINDOW (window)->hchild; |
| 485 | 1252 else if (!NILP (XWINDOW (window)->vchild)) |
| 265 | 1253 window = XWINDOW (window)->vchild; |
| 1254 else break; | |
| 1255 } | |
|
26153
da4e7625a62d
(Fnext_window): Add a QUIT in the loop.
Gerd Moellmann <gerd@gnu.org>
parents:
26046
diff
changeset
|
1256 |
|
da4e7625a62d
(Fnext_window): Add a QUIT in the loop.
Gerd Moellmann <gerd@gnu.org>
parents:
26046
diff
changeset
|
1257 QUIT; |
| 265 | 1258 } |
|
13946
b7670a09033c
(Fprevious_window, Fwindow_configuration_p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13918
diff
changeset
|
1259 /* Which windows are acceptable? |
| 432 | 1260 Exit the loop and accept this window if |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1261 this isn't a minibuffer window, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1262 or we're accepting all minibuffer windows, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1263 or this is the active minibuffer and we are accepting that one, or |
| 432 | 1264 we've come all the way around and we're back at the original window. */ |
| 265 | 1265 while (MINI_WINDOW_P (XWINDOW (window)) |
| 432 | 1266 && ! EQ (minibuf, Qt) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1267 && ! EQ (minibuf, window) |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
1268 && ! EQ (window, start_window)); |
| 265 | 1269 |
| 1270 return window; | |
| 1271 } | |
| 1272 | |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1273 /* 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
|
1274 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
|
1275 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
|
1276 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1277 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
|
1278 "Return the window preceding WINDOW in canonical ordering of windows.\n\ |
| 432 | 1279 If omitted, WINDOW defaults to the selected window.\n\ |
| 1280 \n\ | |
| 1281 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
| 1282 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
| 1283 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
| 1284 minibuffer even if it is active.\n\ | |
| 1285 \n\ | |
| 769 | 1286 Several frames may share a single minibuffer; if the minibuffer\n\ |
| 1287 counts, all windows on all frames that share that minibuffer count\n\ | |
| 8139 | 1288 too. Therefore, `previous-window' can be used to iterate through\n\ |
| 769 | 1289 the set of windows even when the minibuffer is on another frame. If\n\ |
| 8139 | 1290 the minibuffer does not count, only windows from WINDOW's frame count\n\ |
| 432 | 1291 \n\ |
| 769 | 1292 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
| 1293 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
|
1294 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
|
1295 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
|
1296 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
|
1297 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
|
1298 \n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1299 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
|
1300 `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
|
1301 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
|
1302 `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
|
1303 (window, minibuf, all_frames) */ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1304 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1305 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1306 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
|
1307 0) |
| 769 | 1308 (window, minibuf, all_frames) |
| 1309 register Lisp_Object window, minibuf, all_frames; | |
| 265 | 1310 { |
| 1311 register Lisp_Object tem; | |
| 432 | 1312 Lisp_Object start_window; |
| 265 | 1313 |
| 485 | 1314 if (NILP (window)) |
| 265 | 1315 window = selected_window; |
| 1316 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1317 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 1318 |
| 432 | 1319 start_window = window; |
| 265 | 1320 |
| 432 | 1321 /* minibuf == nil may or may not include minibuffers. |
| 1322 Decide if it does. */ | |
| 485 | 1323 if (NILP (minibuf)) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1324 minibuf = (minibuf_level ? minibuf_window : Qlambda); |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1325 else if (! EQ (minibuf, Qt)) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1326 minibuf = Qlambda; |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1327 /* Now minibuf can be t => count all minibuffer windows, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1328 lambda => count none of them, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1329 or a specific minibuffer window (the active one) to count. */ |
| 265 | 1330 |
| 769 | 1331 /* all_frames == nil doesn't specify which frames to include. |
| 1332 Decide which frames it includes. */ | |
| 1333 if (NILP (all_frames)) | |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1334 all_frames = (! EQ (minibuf, Qlambda) |
| 769 | 1335 ? (FRAME_MINIBUF_WINDOW |
| 1336 (XFRAME | |
| 1337 (WINDOW_FRAME | |
| 432 | 1338 (XWINDOW (window))))) |
| 1339 : Qnil); | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1340 else if (EQ (all_frames, Qvisible)) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1341 ; |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1342 else if (XFASTINT (all_frames) == 0) |
|
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1343 ; |
|
11307
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1344 else if (FRAMEP (all_frames) && ! EQ (all_frames, Fwindow_frame (window))) |
|
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1345 /* If all_frames is a frame and window arg isn't on that frame, just |
|
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1346 return the first window on the frame. */ |
|
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1347 return Fframe_first_window (all_frames); |
| 769 | 1348 else if (! EQ (all_frames, Qt)) |
| 1349 all_frames = Qnil; | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1350 /* Now all_frames is t meaning search all frames, |
|
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1351 nil meaning search just current frame, |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1352 visible meaning search just visible frames, |
|
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1353 0 meaning search visible and iconified frames, |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1354 or a window, meaning search the frame that window belongs to. */ |
| 265 | 1355 |
| 1356 /* Do this loop at least once, to get the previous window, and perhaps | |
| 1357 again, if we hit the minibuffer and that is not acceptable. */ | |
| 1358 do | |
| 1359 { | |
| 1360 /* Find a window that actually has a previous one. This loop | |
| 1361 climbs up the tree. */ | |
| 485 | 1362 while (tem = XWINDOW (window)->prev, NILP (tem)) |
| 1363 if (tem = XWINDOW (window)->parent, !NILP (tem)) | |
| 265 | 1364 window = tem; |
| 432 | 1365 else |
| 265 | 1366 { |
| 769 | 1367 /* We have found the top window on the frame. |
| 1368 Which frames are acceptable? */ | |
| 1369 tem = WINDOW_FRAME (XWINDOW (window)); | |
| 1370 if (! NILP (all_frames)) | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1371 /* It's actually important that we use prev_frame here, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1372 rather than next_frame. All the windows acceptable |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1373 according to the given parameters should form a ring; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1374 Fnext_window and Fprevious_window should go back and |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1375 forth around the ring. If we use next_frame here, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1376 then Fnext_window and Fprevious_window take different |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1377 paths through the set of acceptable windows. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1378 window_loop assumes that these `ring' requirement are |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1379 met. */ |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1380 { |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1381 Lisp_Object tem1; |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1382 |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1383 tem1 = tem; |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1384 tem = prev_frame (tem, all_frames); |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1385 /* In the case where the minibuffer is active, |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1386 and we include its frame as well as the selected one, |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1387 next_frame may get stuck in that frame. |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1388 If that happens, go back to the selected frame |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1389 so we can complete the cycle. */ |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1390 if (EQ (tem, tem1)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
1391 tem = selected_frame; |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1392 } |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1393 /* If this frame has a minibuffer, find that window first, |
|
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1394 because it is conceptually the last window in that frame. */ |
|
3678
01941fa99c91
* window.c (Fprevious_window): Use FRAME_HAS_MINIBUF_P to decide
Jim Blandy <jimb@redhat.com>
parents:
3645
diff
changeset
|
1395 if (FRAME_HAS_MINIBUF_P (XFRAME (tem))) |
|
01941fa99c91
* window.c (Fprevious_window): Use FRAME_HAS_MINIBUF_P to decide
Jim Blandy <jimb@redhat.com>
parents:
3645
diff
changeset
|
1396 tem = FRAME_MINIBUF_WINDOW (XFRAME (tem)); |
|
01941fa99c91
* window.c (Fprevious_window): Use FRAME_HAS_MINIBUF_P to decide
Jim Blandy <jimb@redhat.com>
parents:
3645
diff
changeset
|
1397 else |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1398 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); |
| 432 | 1399 |
| 265 | 1400 break; |
| 1401 } | |
| 1402 | |
| 1403 window = tem; | |
| 1404 /* If we're in a combination window, find its last child and | |
| 1405 recurse on that. Otherwise, we've found the window we want. */ | |
| 1406 while (1) | |
| 1407 { | |
| 485 | 1408 if (!NILP (XWINDOW (window)->hchild)) |
| 265 | 1409 window = XWINDOW (window)->hchild; |
| 485 | 1410 else if (!NILP (XWINDOW (window)->vchild)) |
| 265 | 1411 window = XWINDOW (window)->vchild; |
| 1412 else break; | |
| 485 | 1413 while (tem = XWINDOW (window)->next, !NILP (tem)) |
| 265 | 1414 window = tem; |
| 1415 } | |
| 1416 } | |
|
13946
b7670a09033c
(Fprevious_window, Fwindow_configuration_p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13918
diff
changeset
|
1417 /* Which windows are acceptable? |
| 432 | 1418 Exit the loop and accept this window if |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1419 this isn't a minibuffer window, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1420 or we're accepting all minibuffer windows, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1421 or this is the active minibuffer and we are accepting that one, or |
| 432 | 1422 we've come all the way around and we're back at the original window. */ |
| 265 | 1423 while (MINI_WINDOW_P (XWINDOW (window)) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1424 && ! EQ (minibuf, Qt) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1425 && ! EQ (minibuf, window) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1426 && ! EQ (window, start_window)); |
| 265 | 1427 |
| 1428 return window; | |
| 1429 } | |
| 1430 | |
| 338 | 1431 DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", |
| 769 | 1432 "Select the ARG'th different window on this frame.\n\ |
| 1433 All windows on current frame are arranged in a cyclic order.\n\ | |
| 265 | 1434 This command selects the window ARG steps away in that order.\n\ |
| 1435 A negative ARG moves in the opposite order. If the optional second\n\ | |
| 769 | 1436 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
|
1437 (arg, all_frames) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1438 register Lisp_Object arg, all_frames; |
| 265 | 1439 { |
| 1440 register int i; | |
| 1441 register Lisp_Object w; | |
| 1442 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1443 CHECK_NUMBER (arg, 0); |
| 265 | 1444 w = selected_window; |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1445 i = XINT (arg); |
| 265 | 1446 |
| 1447 while (i > 0) | |
| 1448 { | |
| 769 | 1449 w = Fnext_window (w, Qnil, all_frames); |
| 265 | 1450 i--; |
| 1451 } | |
| 1452 while (i < 0) | |
| 1453 { | |
| 769 | 1454 w = Fprevious_window (w, Qnil, all_frames); |
| 265 | 1455 i++; |
| 1456 } | |
| 1457 Fselect_window (w); | |
| 1458 return Qnil; | |
| 1459 } | |
| 1460 | |
| 1461 /* Look at all windows, performing an operation specified by TYPE | |
| 1462 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
|
1463 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
|
1464 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
|
1465 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
|
1466 a frame, just look at windows on that frame. |
| 265 | 1467 If MINI is non-zero, perform the operation on minibuffer windows too. |
| 1468 */ | |
| 1469 | |
| 1470 enum window_loop | |
| 1471 { | |
| 1472 WINDOW_LOOP_UNUSED, | |
| 1473 GET_BUFFER_WINDOW, /* Arg is buffer */ | |
| 1474 GET_LRU_WINDOW, /* Arg is t for full-width windows only */ | |
| 1475 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ | |
| 1476 DELETE_BUFFER_WINDOWS, /* Arg is buffer */ | |
| 1477 GET_LARGEST_WINDOW, | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1478 UNSHOW_BUFFER, /* Arg is buffer */ |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1479 CHECK_ALL_WINDOWS |
| 265 | 1480 }; |
| 1481 | |
| 1482 static Lisp_Object | |
| 769 | 1483 window_loop (type, obj, mini, frames) |
| 265 | 1484 enum window_loop type; |
| 769 | 1485 register Lisp_Object obj, frames; |
| 265 | 1486 int mini; |
| 1487 { | |
| 1488 register Lisp_Object w; | |
| 1489 register Lisp_Object best_window; | |
| 1490 register Lisp_Object next_window; | |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1491 register Lisp_Object last_window; |
| 769 | 1492 FRAME_PTR frame; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1493 Lisp_Object frame_arg; |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1494 frame_arg = Qt; |
| 265 | 1495 |
| 769 | 1496 /* If we're only looping through windows on a particular frame, |
| 1497 frame points to that frame. If we're looping through windows | |
| 1498 on all frames, frame is 0. */ | |
| 1499 if (FRAMEP (frames)) | |
| 1500 frame = XFRAME (frames); | |
| 1501 else if (NILP (frames)) | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
1502 frame = SELECTED_FRAME (); |
| 265 | 1503 else |
| 769 | 1504 frame = 0; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1505 if (frame) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1506 frame_arg = Qlambda; |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1507 else if (XFASTINT (frames) == 0) |
|
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1508 frame_arg = frames; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1509 else if (EQ (frames, Qvisible)) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1510 frame_arg = frames; |
| 265 | 1511 |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1512 /* 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
|
1513 Qvisible to consider all visible frames, |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1514 or Qt otherwise. */ |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1515 |
| 265 | 1516 /* 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
|
1517 if (WINDOWP (obj)) |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1518 w = obj; |
| 769 | 1519 else if (frame) |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1520 w = FRAME_SELECTED_WINDOW (frame); |
| 265 | 1521 else |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
1522 w = FRAME_SELECTED_WINDOW (SELECTED_FRAME ()); |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1523 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1524 /* 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
|
1525 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
|
1526 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
|
1527 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1528 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
|
1529 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
|
1530 |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1531 last_window = Fprevious_window (w, mini ? Qt : Qnil, frame_arg); |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1532 |
| 265 | 1533 best_window = Qnil; |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1534 for (;;) |
| 265 | 1535 { |
| 1536 /* Pick the next window now, since some operations will delete | |
| 1537 the current window. */ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1538 next_window = Fnext_window (w, mini ? Qt : Qnil, frame_arg); |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1539 |
|
6268
43853122823f
(window_loop): Delete MULTI_FRAME
Richard M. Stallman <rms@gnu.org>
parents:
6267
diff
changeset
|
1540 /* Note that we do not pay attention here to whether |
|
43853122823f
(window_loop): Delete MULTI_FRAME
Richard M. Stallman <rms@gnu.org>
parents:
6267
diff
changeset
|
1541 the frame is visible, since Fnext_window skips non-visible frames |
|
43853122823f
(window_loop): Delete MULTI_FRAME
Richard M. Stallman <rms@gnu.org>
parents:
6267
diff
changeset
|
1542 if that is desired, under the control of frame_arg. */ |
|
3785
3455cbb3339d
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3765
diff
changeset
|
1543 if (! MINI_WINDOW_P (XWINDOW (w)) |
|
23728
0d1a0ded9aa1
(temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents:
23410
diff
changeset
|
1544 /* 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
|
1545 || type == UNSHOW_BUFFER |
| 265 | 1546 || (mini && minibuf_level > 0)) |
| 1547 switch (type) | |
| 1548 { | |
| 1549 case GET_BUFFER_WINDOW: | |
|
16522
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1550 if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj) |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1551 /* Don't find any minibuffer window |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1552 except the one that is currently in use. */ |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1553 && (MINI_WINDOW_P (XWINDOW (w)) |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1554 ? EQ (w, minibuf_window) : 1)) |
| 265 | 1555 return w; |
| 1556 break; | |
| 1557 | |
| 1558 case GET_LRU_WINDOW: | |
| 1559 /* t as arg means consider only full-width windows */ | |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
1560 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (XWINDOW (w))) |
| 265 | 1561 break; |
| 1562 /* Ignore dedicated windows and minibuffers. */ | |
| 1563 if (MINI_WINDOW_P (XWINDOW (w)) | |
| 485 | 1564 || !NILP (XWINDOW (w)->dedicated)) |
| 265 | 1565 break; |
| 485 | 1566 if (NILP (best_window) |
| 265 | 1567 || (XFASTINT (XWINDOW (best_window)->use_time) |
| 1568 > XFASTINT (XWINDOW (w)->use_time))) | |
| 1569 best_window = w; | |
| 1570 break; | |
| 1571 | |
| 1572 case DELETE_OTHER_WINDOWS: | |
| 1573 if (XWINDOW (w) != XWINDOW (obj)) | |
| 1574 Fdelete_window (w); | |
| 1575 break; | |
| 1576 | |
| 1577 case DELETE_BUFFER_WINDOWS: | |
| 1578 if (EQ (XWINDOW (w)->buffer, obj)) | |
| 1579 { | |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1580 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1581 |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1582 /* 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
|
1583 kill the frame. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1584 if (EQ (w, FRAME_ROOT_WINDOW (f)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1585 && !NILP (XWINDOW (w)->dedicated) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1586 && other_visible_frames (f)) |
| 265 | 1587 { |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1588 /* 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
|
1589 There might be one, the minibuffer! */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1590 if (! EQ (w, last_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1591 while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window)))) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1592 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1593 /* As we go, check for the end of the loop. |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1594 We mustn't start going around a second time. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1595 if (EQ (next_window, last_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1596 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1597 last_window = w; |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1598 break; |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1599 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1600 next_window = Fnext_window (next_window, |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1601 mini ? Qt : Qnil, |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1602 frame_arg); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1603 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1604 /* Now we can safely delete the frame. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1605 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
| 265 | 1606 } |
| 1607 else | |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1608 /* If we're deleting the buffer displayed in the only window |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1609 on the frame, find a new buffer to display there. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1610 if (NILP (XWINDOW (w)->parent)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1611 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1612 Lisp_Object new_buffer; |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
1613 new_buffer = Fother_buffer (obj, Qnil, |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
1614 XWINDOW (w)->frame); |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1615 if (NILP (new_buffer)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1616 new_buffer |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1617 = Fget_buffer_create (build_string ("*scratch*")); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1618 Fset_window_buffer (w, new_buffer); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1619 if (EQ (w, selected_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1620 Fset_buffer (XWINDOW (w)->buffer); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1621 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1622 else |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1623 Fdelete_window (w); |
| 265 | 1624 } |
| 1625 break; | |
| 1626 | |
| 1627 case GET_LARGEST_WINDOW: | |
| 1628 /* Ignore dedicated windows and minibuffers. */ | |
| 1629 if (MINI_WINDOW_P (XWINDOW (w)) | |
| 485 | 1630 || !NILP (XWINDOW (w)->dedicated)) |
| 265 | 1631 break; |
| 1632 { | |
| 1633 struct window *best_window_ptr = XWINDOW (best_window); | |
| 1634 struct window *w_ptr = XWINDOW (w); | |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1635 if (NILP (best_window) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1636 || (XFASTINT (w_ptr->height) * XFASTINT (w_ptr->width) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1637 > (XFASTINT (best_window_ptr->height) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1638 * XFASTINT (best_window_ptr->width)))) |
| 265 | 1639 best_window = w; |
| 1640 } | |
| 1641 break; | |
| 1642 | |
| 1643 case UNSHOW_BUFFER: | |
| 1644 if (EQ (XWINDOW (w)->buffer, obj)) | |
| 1645 { | |
| 1646 /* Find another buffer to show in this window. */ | |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
1647 Lisp_Object another_buffer; |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1648 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
1649 another_buffer = Fother_buffer (obj, Qnil, XWINDOW (w)->frame); |
| 485 | 1650 if (NILP (another_buffer)) |
| 265 | 1651 another_buffer |
| 1652 = Fget_buffer_create (build_string ("*scratch*")); | |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1653 /* 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
|
1654 kill the frame. */ |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1655 if (EQ (w, FRAME_ROOT_WINDOW (f)) |
|
7663
eb26954fb767
(window_loop): Fix test of dedicated flag in prev change.
Richard M. Stallman <rms@gnu.org>
parents:
7647
diff
changeset
|
1656 && !NILP (XWINDOW (w)->dedicated) |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1657 && other_visible_frames (f)) |
|
8536
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1658 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1659 /* Skip the other windows on this frame. |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1660 There might be one, the minibuffer! */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1661 if (! EQ (w, last_window)) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1662 while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window)))) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1663 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1664 /* As we go, check for the end of the loop. |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1665 We mustn't start going around a second time. */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1666 if (EQ (next_window, last_window)) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1667 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1668 last_window = w; |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1669 break; |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1670 } |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1671 next_window = Fnext_window (next_window, |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1672 mini ? Qt : Qnil, |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1673 frame_arg); |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1674 } |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1675 /* Now we can safely delete the frame. */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1676 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1677 } |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1678 else |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1679 { |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1680 /* Otherwise show a different buffer in the window. */ |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1681 XWINDOW (w)->dedicated = Qnil; |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1682 Fset_window_buffer (w, another_buffer); |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1683 if (EQ (w, selected_window)) |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1684 Fset_buffer (XWINDOW (w)->buffer); |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1685 } |
| 265 | 1686 } |
| 1687 break; | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1688 |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1689 /* 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
|
1690 case CHECK_ALL_WINDOWS: |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1691 if (! NILP (XWINDOW (w)->buffer) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1692 && NILP (XBUFFER (XWINDOW (w)->buffer)->name)) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1693 abort (); |
| 265 | 1694 } |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1695 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1696 if (EQ (w, last_window)) |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1697 break; |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1698 |
| 265 | 1699 w = next_window; |
| 1700 } | |
| 1701 | |
| 1702 return best_window; | |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
1703 } |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1704 |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1705 /* 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
|
1706 |
| 25268 | 1707 void |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1708 check_all_windows () |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1709 { |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1710 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
|
1711 } |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
1712 |
| 265 | 1713 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
| 1714 "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
|
1715 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
|
1716 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
|
1717 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
|
1718 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
|
1719 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
|
1720 (frame) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1721 Lisp_Object frame; |
| 265 | 1722 { |
| 1723 register Lisp_Object w; | |
| 1724 /* 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
|
1725 w = window_loop (GET_LRU_WINDOW, Qt, 0, frame); |
| 485 | 1726 if (!NILP (w) && !EQ (w, selected_window)) |
| 265 | 1727 return w; |
| 1728 /* 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
|
1729 return window_loop (GET_LRU_WINDOW, Qnil, 0, frame); |
| 265 | 1730 } |
| 1731 | |
| 1732 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, | |
| 1733 "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
|
1734 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
|
1735 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
|
1736 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
|
1737 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
|
1738 If FRAME is a frame, search only that frame.") |
| 769 | 1739 (frame) |
| 1740 Lisp_Object frame; | |
| 265 | 1741 { |
| 1742 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, | |
| 769 | 1743 frame); |
| 265 | 1744 } |
| 1745 | |
| 1746 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, | |
| 1747 "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
|
1748 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
|
1749 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
|
1750 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
|
1751 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
|
1752 If FRAME is a frame, search only that frame.") |
| 769 | 1753 (buffer, frame) |
| 1754 Lisp_Object buffer, frame; | |
| 265 | 1755 { |
| 1756 buffer = Fget_buffer (buffer); | |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
1757 if (BUFFERP (buffer)) |
| 769 | 1758 return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame); |
| 265 | 1759 else |
| 1760 return Qnil; | |
| 1761 } | |
| 1762 | |
| 1763 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows, | |
| 1764 0, 1, "", | |
| 769 | 1765 "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
|
1766 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
|
1767 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
|
1768 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
|
1769 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
|
1770 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
|
1771 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
|
1772 value is reasonable when this function is called.") |
| 265 | 1773 (window) |
| 1774 Lisp_Object window; | |
| 1775 { | |
| 1776 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
|
1777 int startpos; |
| 265 | 1778 int top; |
| 1779 | |
| 485 | 1780 if (NILP (window)) |
| 265 | 1781 window = selected_window; |
| 1782 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1783 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 1784 |
| 1785 w = XWINDOW (window); | |
|
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1786 |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1787 startpos = marker_position (w->start); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1788 top = XFASTINT (w->top) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); |
| 265 | 1789 |
|
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1790 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
|
1791 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
|
1792 |
|
2190
482c7827b968
(Fdelete_other_windows): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
1793 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); |
| 265 | 1794 |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1795 /* 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
|
1796 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
|
1797 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
|
1798 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
|
1799 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
|
1800 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
|
1801 && 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
|
1802 { |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1803 struct position pos; |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1804 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
|
1805 |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1806 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
|
1807 /* 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
|
1808 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
|
1809 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
|
1810 |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
1811 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
|
1812 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
|
1813 || 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
|
1814 : Qnil); |
|
13198
43d90596da34
(Fdelete_other_windows): Set w->force_start.
Richard M. Stallman <rms@gnu.org>
parents:
13187
diff
changeset
|
1815 /* 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
|
1816 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
|
1817 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
|
1818 |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1819 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
|
1820 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1821 |
| 265 | 1822 return Qnil; |
| 1823 } | |
| 1824 | |
| 1825 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
|
1826 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
|
1827 "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
|
1828 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
|
1829 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
|
1830 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
|
1831 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
|
1832 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
|
1833 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
|
1834 (buffer, frame) |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1835 Lisp_Object buffer, frame; |
| 265 | 1836 { |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1837 /* 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
|
1838 expects. */ |
|
22223
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1839 if (NILP (frame)) |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1840 frame = Qt; |
|
5d15aed3a37c
(Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents:
22187
diff
changeset
|
1841 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
|
1842 frame = Qnil; |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1843 |
| 485 | 1844 if (!NILP (buffer)) |
| 265 | 1845 { |
| 1846 buffer = Fget_buffer (buffer); | |
| 1847 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
|
1848 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame); |
| 265 | 1849 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1850 |
| 265 | 1851 return Qnil; |
| 1852 } | |
| 1853 | |
| 1854 DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows, | |
| 1855 Sreplace_buffer_in_windows, | |
| 1856 1, 1, "bReplace buffer in windows: ", | |
| 1857 "Replace BUFFER with some other buffer in all windows showing it.") | |
| 1858 (buffer) | |
| 1859 Lisp_Object buffer; | |
| 1860 { | |
| 485 | 1861 if (!NILP (buffer)) |
| 265 | 1862 { |
| 1863 buffer = Fget_buffer (buffer); | |
| 1864 CHECK_BUFFER (buffer, 0); | |
| 1865 window_loop (UNSHOW_BUFFER, buffer, 0, Qt); | |
| 1866 } | |
| 1867 return Qnil; | |
| 1868 } | |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1869 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1870 /* 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
|
1871 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
|
1872 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1873 void |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1874 replace_buffer_in_all_windows (buffer) |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1875 Lisp_Object buffer; |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1876 { |
|
14204
c0b44d3a8312
(replace_buffer_in_all_windows): Don't change selected
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1877 #ifdef MULTI_KBOARD |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1878 Lisp_Object tail, frame; |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1879 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1880 /* 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
|
1881 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
|
1882 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
|
1883 FOR_EACH_FRAME (tail, frame) |
|
20066
affc9c857428
(replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents:
20046
diff
changeset
|
1884 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
|
1885 #else |
|
20066
affc9c857428
(replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents:
20046
diff
changeset
|
1886 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
|
1887 #endif |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1888 } |
| 265 | 1889 |
| 1890 /* 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
|
1891 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1892 /* 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
|
1893 might crash Emacs. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1894 |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1895 #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
|
1896 #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
|
1897 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1898 /* 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
|
1899 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
|
1900 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1901 static void |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1902 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
|
1903 { |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1904 /* 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
|
1905 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
|
1906 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
|
1907 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
|
1908 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
|
1909 } |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1910 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1911 /* 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
|
1912 minimum allowable size. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1913 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1914 void |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1915 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
|
1916 FRAME_PTR frame; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1917 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
|
1918 { |
|
4347
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
1919 /* 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
|
1920 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
|
1921 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
|
1922 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
|
1923 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
|
1924 (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
|
1925 : (! 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
|
1926 : 2 * MIN_SAFE_WINDOW_HEIGHT - 1); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1927 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1928 if (FRAME_TOP_MARGIN (frame) > 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
1929 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
|
1930 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1931 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
|
1932 *rows = min_height; |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1933 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
|
1934 *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
|
1935 } |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1936 |
| 25254 | 1937 |
| 25268 | 1938 /* Value is non-zero if window W is fixed-size. WIDTH_P non-zero means |
| 1939 check if W's width can be changed, otherwise check W's height. | |
| 1940 CHECK_SIBLINGS_P non-zero means check resizablity of WINDOW's | |
| 1941 siblings, too. If none of the siblings is resizable, WINDOW isn't | |
| 1942 either. */ | |
| 1943 | |
| 1944 static int | |
| 1945 window_fixed_size_p (w, width_p, check_siblings_p) | |
| 1946 struct window *w; | |
| 1947 int width_p, check_siblings_p; | |
| 1948 { | |
| 1949 int fixed_p; | |
| 1950 struct window *c; | |
| 1951 | |
| 1952 if (!NILP (w->hchild)) | |
| 1953 { | |
| 1954 c = XWINDOW (w->hchild); | |
| 1955 | |
| 1956 if (width_p) | |
| 1957 { | |
| 1958 /* A horiz. combination is fixed-width if all of if its | |
| 1959 children are. */ | |
| 1960 while (c && window_fixed_size_p (c, width_p, 0)) | |
| 1961 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 1962 fixed_p = c == NULL; | |
| 1963 } | |
| 1964 else | |
| 1965 { | |
| 1966 /* A horiz. combination is fixed-height if one of if its | |
| 1967 children is. */ | |
| 1968 while (c && !window_fixed_size_p (c, width_p, 0)) | |
| 1969 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 1970 fixed_p = c != NULL; | |
| 1971 } | |
| 1972 } | |
| 1973 else if (!NILP (w->vchild)) | |
| 1974 { | |
| 1975 c = XWINDOW (w->vchild); | |
| 1976 | |
| 1977 if (width_p) | |
| 1978 { | |
| 1979 /* A vert. combination is fixed-width if one of if its | |
| 1980 children is. */ | |
| 1981 while (c && !window_fixed_size_p (c, width_p, 0)) | |
| 1982 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 1983 fixed_p = c != NULL; | |
| 1984 } | |
| 1985 else | |
| 1986 { | |
| 1987 /* A vert. combination is fixed-height if all of if its | |
| 1988 children are. */ | |
| 1989 while (c && window_fixed_size_p (c, width_p, 0)) | |
| 1990 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 1991 fixed_p = c == NULL; | |
| 1992 } | |
| 1993 } | |
| 1994 else if (BUFFERP (w->buffer)) | |
| 1995 { | |
|
25739
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
1996 if (w->height_fixed_p && !width_p) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
1997 fixed_p = 1; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
1998 else |
| 25268 | 1999 { |
|
25739
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2000 struct buffer *old = current_buffer; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2001 Lisp_Object val; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2002 |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2003 current_buffer = XBUFFER (w->buffer); |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2004 val = find_symbol_value (Qwindow_size_fixed); |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2005 current_buffer = old; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2006 |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2007 fixed_p = 0; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2008 if (!EQ (val, Qunbound)) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2009 { |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2010 fixed_p = !NILP (val); |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2011 |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2012 if (fixed_p |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2013 && ((EQ (val, Qheight) && width_p) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2014 || (EQ (val, Qwidth) && !width_p))) |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2015 fixed_p = 0; |
|
a4321ad412ba
(Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents:
25676
diff
changeset
|
2016 } |
| 25268 | 2017 } |
| 2018 | |
| 2019 /* Can't tell if this one is resizable without looking at | |
| 2020 siblings. If all siblings are fixed-size this one is too. */ | |
| 2021 if (!fixed_p && check_siblings_p && WINDOWP (w->parent)) | |
| 2022 { | |
| 2023 Lisp_Object child; | |
| 2024 | |
| 2025 for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev) | |
| 2026 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) | |
| 2027 break; | |
| 2028 | |
| 2029 if (NILP (child)) | |
| 2030 for (child = w->next; !NILP (child); child = XWINDOW (child)->next) | |
| 2031 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) | |
| 2032 break; | |
| 2033 | |
| 2034 if (NILP (child)) | |
| 2035 fixed_p = 1; | |
| 2036 } | |
| 2037 } | |
| 2038 else | |
| 2039 fixed_p = 1; | |
| 2040 | |
| 2041 return fixed_p; | |
| 2042 } | |
| 2043 | |
| 2044 | |
| 2045 /* Return the minimum size of window W, not taking fixed-width windows | |
| 2046 into account. WIDTH_P non-zero means return the minimum width, | |
| 2047 otherwise return the minimum height. If W is a combination window, | |
| 2048 compute the minimum size from the minimum sizes of W's children. */ | |
| 2049 | |
| 2050 static int | |
| 2051 window_min_size_1 (w, width_p) | |
| 25254 | 2052 struct window *w; |
| 2053 int width_p; | |
| 2054 { | |
| 25268 | 2055 struct window *c; |
| 25254 | 2056 int size; |
| 2057 | |
| 25268 | 2058 if (!NILP (w->hchild)) |
| 2059 { | |
| 2060 c = XWINDOW (w->hchild); | |
| 2061 size = 0; | |
| 2062 | |
| 2063 if (width_p) | |
| 2064 { | |
| 2065 /* The min width of a horizontal combination is | |
| 2066 the sum of the min widths of its children. */ | |
| 2067 while (c) | |
| 2068 { | |
| 2069 size += window_min_size_1 (c, width_p); | |
| 2070 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2071 } | |
| 2072 } | |
| 2073 else | |
| 2074 { | |
| 2075 /* The min height a horizontal combination equals | |
| 2076 the maximum of all min height of its children. */ | |
| 2077 while (c) | |
| 2078 { | |
| 2079 int min_size = window_min_size_1 (c, width_p); | |
| 2080 size = max (min_size, size); | |
| 2081 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2082 } | |
| 2083 } | |
| 2084 } | |
| 2085 else if (!NILP (w->vchild)) | |
| 2086 { | |
| 2087 c = XWINDOW (w->vchild); | |
| 2088 size = 0; | |
| 2089 | |
| 2090 if (width_p) | |
| 2091 { | |
| 2092 /* The min width of a vertical combination is | |
| 2093 the maximum of the min widths of its children. */ | |
| 2094 while (c) | |
| 2095 { | |
| 2096 int min_size = window_min_size_1 (c, width_p); | |
| 2097 size = max (min_size, size); | |
| 2098 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2099 } | |
| 2100 } | |
| 2101 else | |
| 2102 { | |
| 2103 /* The min height of a vertical combination equals | |
| 2104 the sum of the min height of its children. */ | |
| 2105 while (c) | |
| 2106 { | |
| 2107 size += window_min_size_1 (c, width_p); | |
| 2108 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL; | |
| 2109 } | |
| 2110 } | |
| 2111 } | |
| 25254 | 2112 else |
| 2113 { | |
| 25268 | 2114 if (width_p) |
| 2115 size = window_min_width; | |
| 25254 | 2116 else |
| 25268 | 2117 { |
| 2118 if (MINI_WINDOW_P (w) | |
| 2119 || (!WINDOW_WANTS_MODELINE_P (w) | |
| 25546 | 2120 && !WINDOW_WANTS_HEADER_LINE_P (w))) |
| 25268 | 2121 size = 1; |
| 2122 else | |
| 2123 size = window_min_height; | |
| 2124 } | |
| 25254 | 2125 } |
| 2126 | |
| 2127 return size; | |
| 2128 } | |
| 2129 | |
| 2130 | |
| 25268 | 2131 /* Return the minimum size of window W, taking fixed-size windows into |
| 2132 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
|
2133 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
|
2134 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
|
2135 unless FIXED is null. */ |
| 25268 | 2136 |
| 2137 static int | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2138 window_min_size (w, width_p, ignore_fixed_p, fixed) |
| 25268 | 2139 struct window *w; |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2140 int width_p, ignore_fixed_p, *fixed; |
| 25268 | 2141 { |
| 2142 int size, fixed_p; | |
| 2143 | |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2144 if (ignore_fixed_p) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2145 fixed_p = 0; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2146 else |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
2147 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
|
2148 |
| 25268 | 2149 if (fixed) |
| 2150 *fixed = fixed_p; | |
| 2151 | |
| 2152 if (fixed_p) | |
| 2153 size = width_p ? XFASTINT (w->width) : XFASTINT (w->height); | |
| 2154 else | |
| 2155 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
|
2156 |
| 25268 | 2157 return size; |
| 2158 } | |
| 2159 | |
| 2160 | |
| 2161 /* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set | |
| 2162 WINDOW's width. Resize WINDOW's children, if any, so that they | |
| 2163 keep their proportionate size relative to WINDOW. Propagate | |
| 2164 WINDOW's top or left edge position to children. Delete windows | |
| 2165 that become too small unless NODELETE_P is non-zero. */ | |
| 2166 | |
| 2167 static void | |
| 2168 size_window (window, size, width_p, nodelete_p) | |
| 2169 Lisp_Object window; | |
| 2170 int size, width_p, nodelete_p; | |
| 2171 { | |
| 2172 struct window *w = XWINDOW (window); | |
| 2173 struct window *c; | |
| 2174 Lisp_Object child, *forward, *sideward; | |
| 2175 int old_size, min_size; | |
| 2176 | |
| 2177 check_min_window_sizes (); | |
| 2178 | |
| 2179 /* If the window has been "too small" at one point, | |
| 2180 don't delete it for being "too small" in the future. | |
| 2181 Preserve it as long as that is at all possible. */ | |
| 2182 if (width_p) | |
| 2183 { | |
| 2184 old_size = XFASTINT (w->width); | |
| 2185 min_size = window_min_width; | |
| 2186 } | |
| 2187 else | |
| 2188 { | |
| 2189 old_size = XFASTINT (w->height); | |
| 2190 min_size = window_min_height; | |
| 2191 } | |
| 2192 | |
| 2193 if (old_size < window_min_width) | |
| 2194 w->too_small_ok = Qt; | |
| 2195 | |
| 2196 /* Maybe delete WINDOW if it's too small. */ | |
| 2197 if (!nodelete_p && !NILP (w->parent)) | |
| 2198 { | |
| 2199 int min_size; | |
| 2200 | |
| 2201 if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok)) | |
| 2202 min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT; | |
| 2203 else | |
| 2204 min_size = width_p ? window_min_width : window_min_height; | |
| 2205 | |
| 2206 if (size < min_size) | |
| 2207 { | |
| 2208 delete_window (window); | |
| 2209 return; | |
| 2210 } | |
| 2211 } | |
| 2212 | |
| 2213 /* Set redisplay hints. */ | |
| 2214 XSETFASTINT (w->last_modified, 0); | |
| 2215 XSETFASTINT (w->last_overlay_modified, 0); | |
| 2216 windows_or_buffers_changed++; | |
| 2217 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1; | |
| 2218 | |
| 2219 if (width_p) | |
| 2220 { | |
| 2221 sideward = &w->vchild; | |
| 2222 forward = &w->hchild; | |
| 2223 XSETFASTINT (w->width, size); | |
| 2224 } | |
| 2225 else | |
| 2226 { | |
| 2227 sideward = &w->hchild; | |
| 2228 forward = &w->vchild; | |
| 2229 XSETFASTINT (w->height, size); | |
| 2230 } | |
| 2231 | |
| 2232 if (!NILP (*sideward)) | |
| 2233 { | |
| 2234 for (child = *sideward; !NILP (child); child = c->next) | |
| 2235 { | |
| 2236 c = XWINDOW (child); | |
| 2237 if (width_p) | |
| 2238 c->left = w->left; | |
| 2239 else | |
| 2240 c->top = w->top; | |
| 2241 size_window (child, size, width_p, nodelete_p); | |
| 2242 } | |
| 2243 } | |
| 2244 else if (!NILP (*forward)) | |
| 2245 { | |
| 2246 int fixed_size, each, extra, n; | |
| 2247 int resize_fixed_p, nfixed; | |
| 2248 int last_pos, first_pos, nchildren; | |
| 2249 | |
| 2250 /* Determine the fixed-size portion of the this window, and the | |
| 2251 number of child windows. */ | |
| 2252 fixed_size = nchildren = nfixed = 0; | |
| 2253 for (child = *forward; !NILP (child); child = c->next, ++nchildren) | |
| 2254 { | |
| 2255 c = XWINDOW (child); | |
| 2256 if (window_fixed_size_p (c, width_p, 0)) | |
| 2257 { | |
| 2258 fixed_size += (width_p | |
| 2259 ? XFASTINT (c->width) : XFASTINT (c->height)); | |
| 2260 ++nfixed; | |
| 2261 } | |
| 2262 } | |
| 2263 | |
| 2264 /* If the new size is smaller than fixed_size, or if there | |
| 2265 aren't any resizable windows, allow resizing fixed-size | |
| 2266 windows. */ | |
| 2267 resize_fixed_p = nfixed == nchildren || size < fixed_size; | |
| 2268 | |
| 2269 /* Compute how many lines/columns to add to each child. The | |
| 2270 value of extra takes care of rounding errors. */ | |
| 2271 n = resize_fixed_p ? nchildren : nchildren - nfixed; | |
| 2272 each = (size - old_size) / n; | |
| 2273 extra = (size - old_size) - n * each; | |
| 2274 | |
| 2275 /* Compute new children heights and edge positions. */ | |
| 2276 first_pos = width_p ? XFASTINT (w->left) : XFASTINT (w->top); | |
| 2277 last_pos = first_pos; | |
| 2278 for (child = *forward; !NILP (child); child = c->next) | |
| 2279 { | |
| 2280 int new_size, old_size; | |
| 2281 | |
| 2282 c = XWINDOW (child); | |
| 2283 old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); | |
| 2284 new_size = old_size; | |
| 2285 | |
| 2286 /* The top or left edge position of this child equals the | |
| 2287 bottom or right edge of its predecessor. */ | |
| 2288 if (width_p) | |
| 2289 c->left = make_number (last_pos); | |
| 2290 else | |
| 2291 c->top = make_number (last_pos); | |
| 2292 | |
| 2293 /* If this child can be resized, do it. */ | |
| 2294 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) | |
| 2295 { | |
| 2296 new_size = old_size + each + extra; | |
| 2297 extra = 0; | |
| 2298 } | |
| 2299 | |
| 2300 /* Set new height. Note that size_window also propagates | |
| 2301 edge positions to children, so it's not a no-op if we | |
| 2302 didn't change the child's size. */ | |
| 2303 size_window (child, new_size, width_p, 1); | |
| 2304 | |
| 2305 /* Remember the bottom/right edge position of this child; it | |
| 2306 will be used to set the top/left edge of the next child. */ | |
| 2307 last_pos += new_size; | |
| 2308 } | |
| 2309 | |
| 2310 /* We should have covered the parent exactly with child windows. */ | |
| 2311 xassert (size == last_pos - first_pos); | |
| 2312 | |
| 2313 /* Now delete any children that became too small. */ | |
| 2314 if (!nodelete_p) | |
| 2315 for (child = *forward; !NILP (child); child = c->next) | |
| 2316 { | |
| 2317 int child_size; | |
| 2318 c = XWINDOW (child); | |
| 2319 child_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height); | |
| 2320 size_window (child, child_size, width_p, 0); | |
| 2321 } | |
| 2322 } | |
| 2323 } | |
| 2324 | |
| 2325 /* Set WINDOW's height to HEIGHT, and recursively change the height of | |
| 2326 WINDOW's children. NODELETE non-zero means don't delete windows | |
| 2327 that become too small in the process. (The caller should check | |
| 2328 later and do so if appropriate.) */ | |
| 265 | 2329 |
| 20351 | 2330 void |
| 265 | 2331 set_window_height (window, height, nodelete) |
| 2332 Lisp_Object window; | |
| 2333 int height; | |
| 2334 int nodelete; | |
| 2335 { | |
| 25268 | 2336 size_window (window, height, 0, nodelete); |
| 265 | 2337 } |
| 2338 | |
| 25268 | 2339 |
| 2340 /* Set WINDOW's width to WIDTH, and recursively change the width of | |
| 2341 WINDOW's children. NODELETE non-zero means don't delete windows | |
| 2342 that become too small in the process. (The caller should check | |
| 2343 later and do so if appropriate.) */ | |
| 265 | 2344 |
| 20351 | 2345 void |
| 265 | 2346 set_window_width (window, width, nodelete) |
| 2347 Lisp_Object window; | |
| 2348 int width; | |
| 2349 int nodelete; | |
| 2350 { | |
| 25268 | 2351 size_window (window, width, 1, nodelete); |
| 265 | 2352 } |
| 25268 | 2353 |
| 265 | 2354 |
| 362 | 2355 int window_select_count; |
| 265 | 2356 |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2357 Lisp_Object |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2358 Fset_window_buffer_unwind (obuf) |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2359 Lisp_Object obuf; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2360 { |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2361 Fset_buffer (obuf); |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2362 return Qnil; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2363 } |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
2364 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2365 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2366 /* 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
|
2367 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
|
2368 it's not allowed. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2369 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2370 void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2371 set_window_buffer (window, buffer, run_hooks_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2372 Lisp_Object window, buffer; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2373 int run_hooks_p; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2374 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2375 struct window *w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2376 struct buffer *b = XBUFFER (buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2377 int count = specpdl_ptr - specpdl; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2378 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2379 w->buffer = buffer; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2380 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2381 if (EQ (window, selected_window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2382 b->last_selected_window = window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2383 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2384 /* Update time stamps of buffer display. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2385 if (INTEGERP (b->display_count)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2386 XSETINT (b->display_count, XINT (b->display_count) + 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2387 b->display_time = Fcurrent_time (); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2388 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2389 XSETFASTINT (w->window_end_pos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2390 XSETFASTINT (w->window_end_vpos, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2391 bzero (&w->last_cursor, sizeof w->last_cursor); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2392 w->window_end_valid = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2393 XSETFASTINT (w->hscroll, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2394 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
|
2395 set_marker_restricted (w->start, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2396 make_number (b->last_window_start), |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2397 buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2398 w->start_at_line_beg = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2399 w->force_start = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2400 XSETFASTINT (w->last_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2401 XSETFASTINT (w->last_overlay_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2402 windows_or_buffers_changed++; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2403 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2404 /* 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
|
2405 If WINDOW is selected, switch permanently. |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2406 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
|
2407 if (EQ (window, selected_window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2408 Fset_buffer (buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2409 /* We can't check ! NILP (Vwindow_scroll_functions) here |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2410 because that might itself be a local variable. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2411 else if (window_initialized) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2412 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2413 record_unwind_protect (Fset_window_buffer_unwind, Fcurrent_buffer ()); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2414 Fset_buffer (buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2415 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2416 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2417 /* 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
|
2418 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
|
2419 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2420 if (run_hooks_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2421 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2422 if (! NILP (Vwindow_scroll_functions)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2423 run_hook_with_args_2 (Qwindow_scroll_functions, window, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2424 Fmarker_position (w->start)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2425 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2426 if (! NILP (Vwindow_configuration_change_hook) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2427 && ! NILP (Vrun_hooks)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2428 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2429 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2430 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2431 unbind_to (count, Qnil); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2432 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2433 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2434 |
| 265 | 2435 DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 2, 0, |
| 2436 "Make WINDOW display BUFFER as its contents.\n\ | |
| 2437 BUFFER can be a buffer or buffer name.") | |
| 2438 (window, buffer) | |
| 2439 register Lisp_Object window, buffer; | |
| 2440 { | |
| 2441 register Lisp_Object tem; | |
| 2442 register struct window *w = decode_window (window); | |
| 2443 | |
|
27848
27b993d2ea05
(Fset_window_buffer): Set WINDOW to the window
Gerd Moellmann <gerd@gnu.org>
parents:
27699
diff
changeset
|
2444 XSETWINDOW (window, w); |
| 265 | 2445 buffer = Fget_buffer (buffer); |
| 2446 CHECK_BUFFER (buffer, 1); | |
| 2447 | |
| 485 | 2448 if (NILP (XBUFFER (buffer)->name)) |
| 265 | 2449 error ("Attempt to display deleted buffer"); |
| 2450 | |
| 2451 tem = w->buffer; | |
| 485 | 2452 if (NILP (tem)) |
| 265 | 2453 error ("Window is deleted"); |
| 2454 else if (! EQ (tem, Qt)) /* w->buffer is t when the window | |
| 2455 is first being set up. */ | |
| 2456 { | |
| 485 | 2457 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
|
2458 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
|
2459 XSTRING (XBUFFER (tem)->name)->data); |
| 265 | 2460 |
| 2461 unshow_buffer (w); | |
| 2462 } | |
| 2463 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
2464 set_window_buffer (window, buffer, 1); |
| 265 | 2465 return Qnil; |
| 2466 } | |
| 2467 | |
| 2468 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, | |
| 2469 "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
|
2470 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
|
2471 Note that the main editor command loop\n\ |
|
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2472 selects the buffer of the selected window before each command.") |
| 265 | 2473 (window) |
| 2474 register Lisp_Object window; | |
| 2475 { | |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2476 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
|
2477 } |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2478 |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2479 static Lisp_Object |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2480 select_window_1 (window, recordflag) |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2481 register Lisp_Object window; |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2482 int recordflag; |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2483 { |
| 265 | 2484 register struct window *w; |
| 2485 register struct window *ow = XWINDOW (selected_window); | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2486 struct frame *sf; |
| 265 | 2487 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2488 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 2489 |
| 2490 w = XWINDOW (window); | |
| 2491 | |
| 485 | 2492 if (NILP (w->buffer)) |
| 265 | 2493 error ("Trying to select deleted window or non-leaf window"); |
| 2494 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2495 XSETFASTINT (w->use_time, ++window_select_count); |
| 265 | 2496 if (EQ (window, selected_window)) |
| 2497 return window; | |
| 2498 | |
|
20627
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
2499 if (! NILP (ow->buffer)) |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
2500 set_marker_both (ow->pointm, ow->buffer, |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
2501 BUF_PT (XBUFFER (ow->buffer)), |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
2502 BUF_PT_BYTE (XBUFFER (ow->buffer))); |
| 265 | 2503 |
| 2504 selected_window = window; | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2505 sf = SELECTED_FRAME (); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2506 if (XFRAME (WINDOW_FRAME (w)) != sf) |
| 265 | 2507 { |
| 769 | 2508 XFRAME (WINDOW_FRAME (w))->selected_window = window; |
|
7080
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2509 /* Use this rather than Fhandle_switch_frame |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2510 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
|
2511 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
|
2512 frame is active. */ |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
2513 Fselect_frame (WINDOW_FRAME (w), Qnil); |
| 265 | 2514 } |
| 2515 else | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2516 sf->selected_window = window; |
| 265 | 2517 |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2518 if (recordflag) |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2519 record_buffer (w->buffer); |
| 265 | 2520 Fset_buffer (w->buffer); |
| 2521 | |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
2522 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
|
2523 |
| 265 | 2524 /* Go to the point recorded in the window. |
| 2525 This is important when the buffer is in more | |
| 2526 than one window. It also matters when | |
| 2527 redisplay_window has altered point after scrolling, | |
| 2528 because it makes the change only in the window. */ | |
| 2529 { | |
| 2530 register int new_point = marker_position (w->pointm); | |
| 2531 if (new_point < BEGV) | |
| 2532 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
|
2533 else if (new_point > ZV) |
| 265 | 2534 SET_PT (ZV); |
| 2535 else | |
| 2536 SET_PT (new_point); | |
| 2537 } | |
| 2538 | |
| 2539 windows_or_buffers_changed++; | |
| 2540 return window; | |
| 2541 } | |
|
22187
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2542 |
|
14175
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2543 /* 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
|
2544 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
|
2545 then return WINDOW. |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2546 |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
2547 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
|
2548 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
|
2549 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
|
2550 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
|
2551 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
|
2552 |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2553 static Lisp_Object |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2554 display_buffer_1 (window) |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2555 Lisp_Object window; |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2556 { |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2557 Lisp_Object frame = XWINDOW (window)->frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2558 FRAME_PTR f = XFRAME (frame); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2559 |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2560 FRAME_SAMPLE_VISIBILITY (f); |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2561 |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2562 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
|
2563 { |
|
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2564 if (FRAME_ICONIFIED_P (f)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2565 Fmake_frame_visible (frame); |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2566 else if (FRAME_VISIBLE_P (f)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2567 Fraise_frame (frame); |
|
14535
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2568 } |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2569 |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2570 return window; |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2571 } |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2572 |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2573 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
|
2574 "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
|
2575 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
|
2576 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
|
2577 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
|
2578 (buffer_name) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2579 Lisp_Object buffer_name; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2580 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2581 Lisp_Object tem; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2582 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2583 CHECK_STRING (buffer_name, 1); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2584 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2585 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
|
2586 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2587 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2588 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2589 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
|
2590 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2591 return XCDR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2592 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2593 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
|
2594 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2595 Lisp_Object car = XCAR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2596 if (STRINGP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2597 && 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
|
2598 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2599 else if (CONSP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2600 && STRINGP (XCAR (car)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2601 && 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
|
2602 return XCDR (car); |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2603 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2604 return Qnil; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2605 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2606 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2607 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
|
2608 "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
|
2609 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
|
2610 (buffer_name) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2611 Lisp_Object buffer_name; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2612 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2613 Lisp_Object tem; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2614 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2615 CHECK_STRING (buffer_name, 1); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2616 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2617 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
|
2618 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2619 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2620 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2621 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
|
2622 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2623 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2624 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2625 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
|
2626 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2627 Lisp_Object car = XCAR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2628 if (STRINGP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2629 && 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
|
2630 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2631 else if (CONSP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2632 && STRINGP (XCAR (car)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2633 && 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
|
2634 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2635 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2636 return Qnil; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2637 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2638 |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2639 /* Use B so the default is (other-buffer). */ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2640 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
|
2641 "BDisplay buffer: \nP", |
| 265 | 2642 "Make BUFFER appear in some window but don't select it.\n\ |
| 2643 BUFFER can be a buffer or a buffer name.\n\ | |
| 2644 If BUFFER is shown already in some window, just use that one,\n\ | |
| 2645 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
|
2646 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
|
2647 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
|
2648 Returns the window displaying BUFFER.\n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2649 \n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2650 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
|
2651 `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
|
2652 buffer names are handled.\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2653 \n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2654 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
|
2655 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
|
2656 If FRAME is t, search all frames.\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2657 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
|
2658 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
|
2659 (actually the last nonminibuffer frame),\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2660 unless `pop-up-frames' is non-nil,\n\ |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2661 which means search visible and iconified frames.") |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2662 (buffer, not_this_window, frame) |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2663 register Lisp_Object buffer, not_this_window, frame; |
| 265 | 2664 { |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2665 register Lisp_Object window, tem, swp; |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2666 struct frame *f; |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2667 |
|
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2668 swp = Qnil; |
| 265 | 2669 buffer = Fget_buffer (buffer); |
| 2670 CHECK_BUFFER (buffer, 0); | |
| 2671 | |
| 485 | 2672 if (!NILP (Vdisplay_buffer_function)) |
| 265 | 2673 return call2 (Vdisplay_buffer_function, buffer, not_this_window); |
| 2674 | |
| 485 | 2675 if (NILP (not_this_window) |
| 265 | 2676 && 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
|
2677 return display_buffer_1 (selected_window); |
| 265 | 2678 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2679 /* 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
|
2680 in the selected window. */ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2681 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
|
2682 { |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2683 swp = Fsame_window_p (XBUFFER (buffer)->name); |
|
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2684 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
|
2685 { |
|
71304a70d0f6
(Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents:
10958
diff
changeset
|
2686 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
|
2687 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
|
2688 } |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2689 } |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2690 |
|
6262
930d259c1f95
(Fdisplay_buffer): If pop_up_frames != 0,
Richard M. Stallman <rms@gnu.org>
parents:
6247
diff
changeset
|
2691 /* If pop_up_frames, |
|
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2692 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
|
2693 Otherwise search only the current frame. */ |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2694 if (! NILP (frame)) |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2695 tem = frame; |
|
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2696 else if (pop_up_frames || last_nonminibuf_frame == 0) |
|
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2697 XSETFASTINT (tem, 0); |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2698 else |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2699 XSETFRAME (tem, last_nonminibuf_frame); |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2700 window = Fget_buffer_window (buffer, tem); |
| 485 | 2701 if (!NILP (window) |
| 2702 && (NILP (not_this_window) || !EQ (window, selected_window))) | |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
2703 { |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2704 return display_buffer_1 (window); |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
2705 } |
| 265 | 2706 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2707 /* Certain buffer names get special handling. */ |
|
25182
ef79ee0ceedd
(display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents:
25115
diff
changeset
|
2708 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
|
2709 { |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2710 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
|
2711 if (EQ (tem, Qt)) |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2712 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
|
2713 if (CONSP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2714 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
|
2715 } |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2716 |
| 769 | 2717 /* If there are no frames open that have more than a minibuffer, |
| 2718 we need to create a new frame. */ | |
| 2719 if (pop_up_frames || last_nonminibuf_frame == 0) | |
| 265 | 2720 { |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2721 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
| 265 | 2722 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
|
2723 return display_buffer_1 (window); |
| 265 | 2724 } |
| 2725 | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2726 f = SELECTED_FRAME (); |
| 358 | 2727 if (pop_up_windows |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2728 || 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
|
2729 /* 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
|
2730 don't try to reuse its windows. */ |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2731 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated)) |
| 358 | 2732 { |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2733 Lisp_Object frames; |
|
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2734 |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2735 frames = Qnil; |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2736 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
|
2737 XSETFRAME (frames, last_nonminibuf_frame); |
| 265 | 2738 /* Don't try to create a window if would get an error */ |
| 2739 if (split_height_threshold < window_min_height << 1) | |
| 2740 split_height_threshold = window_min_height << 1; | |
| 2741 | |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2742 /* 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
|
2743 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
|
2744 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
|
2745 |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2746 /* 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
|
2747 try other frames. */ |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2748 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
|
2749 { |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2750 /* Try visible frames first. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2751 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
|
2752 /* 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
|
2753 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2754 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
|
2755 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2756 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
|
2757 } |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2758 else |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2759 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
|
2760 |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2761 /* 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
|
2762 split it. */ |
| 485 | 2763 if (!NILP (window) |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2764 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
| 265 | 2765 && 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
|
2766 && WINDOW_FULL_WIDTH_P (XWINDOW (window))) |
| 265 | 2767 window = Fsplit_window (window, Qnil, Qnil); |
| 2768 else | |
| 2769 { | |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2770 Lisp_Object upper, lower, other; |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2771 |
| 769 | 2772 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
|
2773 /* 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
|
2774 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
|
2775 if (!NILP (window) |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2776 && ! 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
|
2777 && (EQ (window, selected_window) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2778 || EQ (XWINDOW (window)->parent, Qnil)) |
| 265 | 2779 && window_height (window) >= window_min_height << 1) |
| 2780 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
|
2781 /* 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
|
2782 |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2783 /* Try visible frames first. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2784 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
|
2785 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
|
2786 if (NILP (window)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2787 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
|
2788 /* 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
|
2789 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
|
2790 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
|
2791 if (NILP (window)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2792 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
|
2793 /* Try invisible frames. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2794 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
|
2795 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
|
2796 if (NILP (window)) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2797 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
|
2798 /* 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
|
2799 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2800 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
|
2801 /* 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
|
2802 even out their heights. */ |
|
11750
b911d6f75664
(Fdisplay_buffer): Initialize other, upper, lower.
Richard M. Stallman <rms@gnu.org>
parents:
11731
diff
changeset
|
2803 other = upper = lower = Qnil; |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2804 if (!NILP (XWINDOW (window)->prev)) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2805 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
|
2806 if (!NILP (XWINDOW (window)->next)) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2807 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
|
2808 if (!NILP (other) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2809 /* 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
|
2810 && !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
|
2811 && (XFASTINT (XWINDOW (other)->height) |
|
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
2812 > XFASTINT (XWINDOW (window)->height))) |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2813 { |
|
17365
fc2ec9ced22f
(delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents:
17281
diff
changeset
|
2814 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
|
2815 + XFASTINT (XWINDOW (window)->height)); |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
2816 enlarge_window (upper, |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
2817 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
|
2818 0); |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2819 } |
| 265 | 2820 } |
| 2821 } | |
| 2822 else | |
| 2823 window = Fget_lru_window (Qnil); | |
| 2824 | |
| 2825 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
|
2826 return display_buffer_1 (window); |
| 265 | 2827 } |
| 2828 | |
| 2829 void | |
| 2830 temp_output_buffer_show (buf) | |
| 2831 register Lisp_Object buf; | |
| 2832 { | |
| 2833 register struct buffer *old = current_buffer; | |
| 2834 register Lisp_Object window; | |
| 2835 register struct window *w; | |
| 2836 | |
|
18493
d65021d5c39e
(temp_output_buffer_show): Copy default-directory from current buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18065
diff
changeset
|
2837 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
|
2838 |
| 265 | 2839 Fset_buffer (buf); |
|
10302
34556316a48a
(temp_output_buffer_show): Use BUF_SAVE_MODIFF.
Richard M. Stallman <rms@gnu.org>
parents:
10043
diff
changeset
|
2840 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; |
| 265 | 2841 BEGV = BEG; |
| 2842 ZV = Z; | |
| 2843 SET_PT (BEG); | |
| 25375 | 2844 XBUFFER (buf)->prevent_redisplay_optimizations_p = 1; |
| 265 | 2845 set_buffer_internal (old); |
| 2846 | |
| 2847 if (!EQ (Vtemp_buffer_show_function, Qnil)) | |
| 2848 call1 (Vtemp_buffer_show_function, buf); | |
| 2849 else | |
| 2850 { | |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
2851 window = Fdisplay_buffer (buf, Qnil, Qnil); |
| 265 | 2852 |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
2853 if (!EQ (XWINDOW (window)->frame, selected_frame)) |
| 769 | 2854 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
| 265 | 2855 Vminibuf_scroll_window = window; |
| 2856 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
|
2857 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
|
2858 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
|
2859 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
|
2860 |
|
22149
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2861 /* 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
|
2862 and it sbuffer current. */ |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2863 if (!NILP (Vrun_hooks)) |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2864 { |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2865 Lisp_Object tem; |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2866 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
|
2867 if (!NILP (tem)) |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2868 { |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2869 tem = Fsymbol_value (Qtemp_buffer_show_hook); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2870 if (!NILP (tem)) |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2871 { |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2872 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
|
2873 Lisp_Object prev_window; |
|
9509e86a7be5
(window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents:
22155
diff
changeset
|
2874 prev_window = selected_window; |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2875 |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2876 /* 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
|
2877 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
|
2878 select_window_1 (window, 0); |
|
22149
ad3ee5ec90d1
(Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21844
diff
changeset
|
2879 Fset_buffer (w->buffer); |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2880 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
|
2881 select_window_1 (prev_window, 0); |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2882 unbind_to (count, Qnil); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2883 } |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2884 } |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2885 } |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2886 } |
| 265 | 2887 } |
| 2888 | |
| 21514 | 2889 static void |
| 265 | 2890 make_dummy_parent (window) |
| 2891 Lisp_Object window; | |
| 2892 { | |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2893 Lisp_Object new; |
| 265 | 2894 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
|
2895 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
|
2896 int i; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2897 |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2898 o = XWINDOW (window); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2899 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
|
2900 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
|
2901 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
|
2902 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
|
2903 p = (struct window *)vec; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2904 XSETWINDOW (new, p); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2905 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2906 XSETFASTINT (p->sequence_number, ++sequence_number); |
| 265 | 2907 |
| 2908 /* Put new into window structure in place of window */ | |
| 2909 replace_window (window, new); | |
| 2910 | |
| 2911 o->next = Qnil; | |
| 2912 o->prev = Qnil; | |
| 2913 o->vchild = Qnil; | |
| 2914 o->hchild = Qnil; | |
| 2915 o->parent = new; | |
| 2916 | |
| 2917 p->start = Qnil; | |
| 2918 p->pointm = Qnil; | |
| 2919 p->buffer = Qnil; | |
| 2920 } | |
| 2921 | |
| 2922 DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", | |
| 2923 "Split WINDOW, putting SIZE lines in the first of the pair.\n\ | |
| 2924 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
|
2925 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
|
2926 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
|
2927 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
|
2928 (window, size, horflag) |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2929 Lisp_Object window, size, horflag; |
| 265 | 2930 { |
| 2931 register Lisp_Object new; | |
| 2932 register struct window *o, *p; | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2933 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
|
2934 register int size_int; |
| 265 | 2935 |
| 485 | 2936 if (NILP (window)) |
| 265 | 2937 window = selected_window; |
| 2938 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2939 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 2940 |
| 2941 o = XWINDOW (window); | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2942 fo = XFRAME (WINDOW_FRAME (o)); |
| 265 | 2943 |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2944 if (NILP (size)) |
| 265 | 2945 { |
| 485 | 2946 if (!NILP (horflag)) |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2947 /* 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
|
2948 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
|
2949 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
|
2950 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
|
2951 size_int = (XFASTINT (o->width) + 1) >> 1; |
| 265 | 2952 else |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2953 size_int = XFASTINT (o->height) >> 1; |
| 265 | 2954 } |
| 2955 else | |
| 2956 { | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2957 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
|
2958 size_int = XINT (size); |
| 265 | 2959 } |
| 2960 | |
| 2961 if (MINI_WINDOW_P (o)) | |
| 2962 error ("Attempt to split minibuffer window"); | |
| 25268 | 2963 else if (window_fixed_size_p (o, !NILP (horflag), 0)) |
| 2964 error ("Attempt to split fixed-size window"); | |
| 265 | 2965 |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2966 check_min_window_sizes (); |
| 265 | 2967 |
| 485 | 2968 if (NILP (horflag)) |
| 265 | 2969 { |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2970 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
|
2971 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
|
2972 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
|
2973 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
|
2974 XFASTINT (o->height) - size_int); |
| 485 | 2975 if (NILP (o->parent) |
| 2976 || NILP (XWINDOW (o->parent)->vchild)) | |
| 265 | 2977 { |
| 2978 make_dummy_parent (window); | |
| 2979 new = o->parent; | |
| 2980 XWINDOW (new)->vchild = window; | |
| 2981 } | |
| 2982 } | |
| 2983 else | |
| 2984 { | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2985 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
|
2986 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
|
2987 |
|
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
2988 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
|
2989 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
|
2990 XFASTINT (o->width) - size_int); |
| 485 | 2991 if (NILP (o->parent) |
| 2992 || NILP (XWINDOW (o->parent)->hchild)) | |
| 265 | 2993 { |
| 2994 make_dummy_parent (window); | |
| 2995 new = o->parent; | |
| 2996 XWINDOW (new)->hchild = window; | |
| 2997 } | |
| 2998 } | |
| 2999 | |
| 3000 /* Now we know that window's parent is a vertical combination | |
| 3001 if we are dividing vertically, or a horizontal combination | |
| 3002 if we are making side-by-side windows */ | |
| 3003 | |
| 3004 windows_or_buffers_changed++; | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
3005 FRAME_WINDOW_SIZES_CHANGED (fo) = 1; |
| 265 | 3006 new = make_window (); |
| 3007 p = XWINDOW (new); | |
| 3008 | |
| 769 | 3009 p->frame = o->frame; |
| 265 | 3010 p->next = o->next; |
| 485 | 3011 if (!NILP (p->next)) |
| 265 | 3012 XWINDOW (p->next)->prev = new; |
| 3013 p->prev = window; | |
| 3014 o->next = new; | |
| 3015 p->parent = o->parent; | |
| 3016 p->buffer = Qt; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3017 p->window_end_valid = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3018 bzero (&p->last_cursor, sizeof p->last_cursor); |
| 265 | 3019 |
| 769 | 3020 /* Apportion the available frame space among the two new windows */ |
| 265 | 3021 |
| 485 | 3022 if (!NILP (horflag)) |
| 265 | 3023 { |
| 3024 p->height = o->height; | |
| 3025 p->top = o->top; | |
|
15902
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
3026 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
|
3027 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
|
3028 XSETFASTINT (p->left, XFASTINT (o->left) + size_int); |
| 265 | 3029 } |
| 3030 else | |
| 3031 { | |
| 3032 p->left = o->left; | |
| 3033 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
|
3034 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
|
3035 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
|
3036 XSETFASTINT (p->top, XFASTINT (o->top) + size_int); |
| 265 | 3037 } |
| 3038 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3039 /* Adjust glyph matrices. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3040 adjust_glyphs (fo); |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3041 Fset_window_buffer (new, o->buffer); |
| 265 | 3042 return new; |
| 3043 } | |
| 3044 | |
| 3045 DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p", | |
| 3046 "Make current window ARG lines bigger.\n\ | |
| 3047 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
|
3048 (arg, side) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3049 register Lisp_Object arg, side; |
| 265 | 3050 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3051 CHECK_NUMBER (arg, 0); |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3052 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
|
3053 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3054 if (! NILP (Vwindow_configuration_change_hook)) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3055 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3056 |
| 265 | 3057 return Qnil; |
| 3058 } | |
| 3059 | |
| 3060 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", | |
| 3061 "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
|
3062 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
|
3063 (arg, side) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3064 register Lisp_Object arg, side; |
| 265 | 3065 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3066 CHECK_NUMBER (arg, 0); |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3067 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
|
3068 |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3069 if (! NILP (Vwindow_configuration_change_hook)) |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3070 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3071 |
| 265 | 3072 return Qnil; |
| 3073 } | |
| 3074 | |
| 3075 int | |
| 3076 window_height (window) | |
| 3077 Lisp_Object window; | |
| 3078 { | |
| 3079 register struct window *p = XWINDOW (window); | |
| 3080 return XFASTINT (p->height); | |
| 3081 } | |
| 3082 | |
| 3083 int | |
| 3084 window_width (window) | |
| 3085 Lisp_Object window; | |
| 3086 { | |
| 3087 register struct window *p = XWINDOW (window); | |
| 3088 return XFASTINT (p->width); | |
| 3089 } | |
| 3090 | |
| 25254 | 3091 |
| 265 | 3092 #define CURBEG(w) \ |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3093 *(widthflag ? (int *) &(XWINDOW (w)->left) : (int *) &(XWINDOW (w)->top)) |
| 265 | 3094 |
| 3095 #define CURSIZE(w) \ | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3096 *(widthflag ? (int *) &(XWINDOW (w)->width) : (int *) &(XWINDOW (w)->height)) |
| 265 | 3097 |
| 25268 | 3098 |
| 3099 /* Enlarge selected_window by DELTA. WIDTHFLAG non-zero means | |
| 3100 increase its width. Siblings of the selected window are resized to | |
| 3101 fullfil the size request. If they become too small in the process, | |
| 3102 they will be deleted. */ | |
| 265 | 3103 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3104 static void |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3105 enlarge_window (window, delta, widthflag) |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3106 Lisp_Object window; |
| 25268 | 3107 int delta, widthflag; |
| 265 | 3108 { |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3109 Lisp_Object parent, next, prev; |
| 25268 | 3110 struct window *p; |
| 3111 int *sizep, maximum; | |
| 20351 | 3112 int (*sizefun) P_ ((Lisp_Object)) |
| 3113 = widthflag ? window_width : window_height; | |
| 25268 | 3114 void (*setsizefun) P_ ((Lisp_Object, int, int)) |
| 20351 | 3115 = (widthflag ? set_window_width : set_window_height); |
| 25268 | 3116 |
| 3117 /* Check values of window_min_width and window_min_height for | |
| 3118 validity. */ | |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
3119 check_min_window_sizes (); |
| 265 | 3120 |
| 25268 | 3121 /* Give up if this window cannot be resized. */ |
| 3122 if (window_fixed_size_p (XWINDOW (window), widthflag, 1)) | |
| 3123 error ("Window is not resizable"); | |
| 3124 | |
| 3125 /* Find the parent of the selected window. */ | |
| 265 | 3126 while (1) |
| 3127 { | |
| 3128 p = XWINDOW (window); | |
| 3129 parent = p->parent; | |
| 25268 | 3130 |
| 485 | 3131 if (NILP (parent)) |
| 265 | 3132 { |
| 3133 if (widthflag) | |
| 3134 error ("No other window to side of this one"); | |
| 3135 break; | |
| 3136 } | |
| 25268 | 3137 |
| 3138 if (widthflag | |
| 3139 ? !NILP (XWINDOW (parent)->hchild) | |
| 485 | 3140 : !NILP (XWINDOW (parent)->vchild)) |
| 265 | 3141 break; |
| 25268 | 3142 |
| 265 | 3143 window = parent; |
| 3144 } | |
| 3145 | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3146 sizep = &CURSIZE (window); |
|
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3147 |
| 265 | 3148 { |
| 3149 register int maxdelta; | |
| 3150 | |
| 485 | 3151 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep |
| 25254 | 3152 : !NILP (p->next) ? ((*sizefun) (p->next) |
| 3153 - 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
|
3154 widthflag, 0, 0)) |
| 25254 | 3155 : !NILP (p->prev) ? ((*sizefun) (p->prev) |
| 3156 - 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
|
3157 widthflag, 0, 0)) |
| 769 | 3158 /* This is a frame with only one window, a minibuffer-only |
| 3159 or a minibufferless frame. */ | |
| 432 | 3160 : (delta = 0)); |
| 265 | 3161 |
| 3162 if (delta > maxdelta) | |
| 3163 /* This case traps trying to make the minibuffer | |
| 769 | 3164 the full frame, or make the only window aside from the |
| 3165 minibuffer the full frame. */ | |
| 265 | 3166 delta = maxdelta; |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3167 } |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3168 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3169 if (*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
|
3170 { |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
3171 delete_window (window); |
| 432 | 3172 return; |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3173 } |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3174 |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3175 if (delta == 0) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3176 return; |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
3177 |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3178 /* 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
|
3179 maximum = 0; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3180 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) |
| 25254 | 3181 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
|
3182 widthflag, 0, 0); |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3183 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) |
| 25254 | 3184 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
|
3185 widthflag, 0, 0); |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3186 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3187 /* 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
|
3188 if (delta <= maximum) |
| 265 | 3189 { |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3190 Lisp_Object first_unaffected; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3191 Lisp_Object first_affected; |
| 25268 | 3192 int fixed_p; |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3193 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3194 next = p->next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3195 prev = p->prev; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3196 first_affected = window; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3197 /* 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
|
3198 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
|
3199 and take as much as we can get without deleting that sibling. */ |
| 25268 | 3200 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
|
3201 { |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3202 if (! NILP (next)) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3203 { |
| 25254 | 3204 int this_one = ((*sizefun) (next) |
| 25268 | 3205 - window_min_size (XWINDOW (next), |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3206 widthflag, 0, &fixed_p)); |
| 25268 | 3207 if (!fixed_p) |
| 3208 { | |
| 3209 if (this_one > delta) | |
| 3210 this_one = delta; | |
| 3211 | |
| 3212 (*setsizefun) (next, (*sizefun) (next) - this_one, 0); | |
| 3213 (*setsizefun) (window, *sizep + this_one, 0); | |
| 3214 | |
| 3215 delta -= this_one; | |
| 3216 } | |
| 3217 | |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3218 next = XWINDOW (next)->next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3219 } |
| 25268 | 3220 |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3221 if (delta == 0) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3222 break; |
| 25268 | 3223 |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3224 if (! NILP (prev)) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3225 { |
| 25254 | 3226 int this_one = ((*sizefun) (prev) |
| 25268 | 3227 - window_min_size (XWINDOW (prev), |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3228 widthflag, 0, &fixed_p)); |
| 25268 | 3229 if (!fixed_p) |
| 3230 { | |
| 3231 if (this_one > delta) | |
| 3232 this_one = delta; | |
| 3233 | |
| 3234 first_affected = prev; | |
| 3235 | |
| 3236 (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0); | |
| 3237 (*setsizefun) (window, *sizep + this_one, 0); | |
| 3238 | |
| 3239 delta -= this_one; | |
| 3240 } | |
| 3241 | |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3242 prev = XWINDOW (prev)->prev; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3243 } |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3244 } |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3245 |
| 25268 | 3246 xassert (delta == 0); |
| 3247 | |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3248 /* 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
|
3249 based on the new sizes. */ |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3250 first_unaffected = next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3251 prev = first_affected; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3252 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
|
3253 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
|
3254 { |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3255 CURBEG (next) = CURBEG (prev) + (*sizefun) (prev); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3256 /* 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
|
3257 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
|
3258 (*setsizefun) (next, (*sizefun) (next), 0); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
3259 } |
| 265 | 3260 } |
| 3261 else | |
| 3262 { | |
| 3263 register int delta1; | |
| 3264 register int opht = (*sizefun) (parent); | |
| 3265 | |
| 3266 /* If trying to grow this window to or beyond size of the parent, | |
| 3267 make delta1 so big that, on shrinking back down, | |
| 3268 all the siblings end up with less than one line and are deleted. */ | |
| 3269 if (opht <= *sizep + delta) | |
| 3270 delta1 = opht * opht * 2; | |
| 3271 else | |
| 25268 | 3272 { |
| 3273 /* Otherwise, make delta1 just right so that if we add | |
| 3274 delta1 lines to this window and to the parent, and then | |
| 3275 shrink the parent back to its original size, the new | |
| 3276 proportional size of this window will increase by delta. | |
| 3277 | |
| 3278 The function size_window will compute the new height h' | |
| 3279 of the window from delta1 as: | |
| 3280 | |
| 3281 e = delta1/n | |
| 3282 x = delta1 - delta1/n * n for the 1st resizable child | |
| 3283 h' = h + e + x | |
| 3284 | |
| 3285 where n is the number of children that can be resized. | |
| 3286 We can ignore x by choosing a delta1 that is a multiple of | |
| 3287 n. We want the height of this window to come out as | |
| 3288 | |
| 3289 h' = h + delta | |
| 3290 | |
| 3291 So, delta1 must be | |
| 3292 | |
| 3293 h + e = h + delta | |
| 3294 delta1/n = delta | |
| 3295 delta1 = n * delta. | |
| 3296 | |
| 3297 The number of children n rquals the number of resizable | |
| 3298 children of this window + 1 because we know window itself | |
| 3299 is resizable (otherwise we would have signalled an error. */ | |
| 3300 | |
| 3301 struct window *w = XWINDOW (window); | |
| 3302 Lisp_Object s; | |
| 3303 int n = 1; | |
| 3304 | |
| 3305 for (s = w->next; !NILP (s); s = XWINDOW (s)->next) | |
| 3306 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) | |
| 3307 ++n; | |
| 3308 for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev) | |
| 3309 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) | |
| 3310 ++n; | |
| 3311 | |
| 3312 delta1 = n * delta; | |
| 3313 } | |
| 265 | 3314 |
| 3315 /* Add delta1 lines or columns to this window, and to the parent, | |
| 3316 keeping things consistent while not affecting siblings. */ | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
3317 CURSIZE (parent) = opht + delta1; |
| 265 | 3318 (*setsizefun) (window, *sizep + delta1, 0); |
| 3319 | |
| 3320 /* Squeeze out delta1 lines or columns from our parent, | |
| 3321 shriking this window and siblings proportionately. | |
| 3322 This brings parent back to correct size. | |
| 3323 Delta1 was calculated so this makes this window the desired size, | |
| 3324 taking it all out of the siblings. */ | |
| 3325 (*setsizefun) (parent, opht, 0); | |
| 3326 } | |
| 3327 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3328 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
|
3329 XSETFASTINT (p->last_overlay_modified, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3330 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3331 /* Adjust glyph matrices. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3332 adjust_glyphs (XFRAME (WINDOW_FRAME (XWINDOW (window)))); |
| 265 | 3333 } |
| 25254 | 3334 |
| 265 | 3335 #undef CURBEG |
| 3336 #undef CURSIZE | |
| 3337 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3338 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3339 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3340 /*********************************************************************** |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3341 Resizing Mini-Windows |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3342 ***********************************************************************/ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3343 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3344 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
|
3345 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3346 enum save_restore_action |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3347 { |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3348 CHECK_ORIG_SIZES, |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3349 SAVE_ORIG_SIZES, |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3350 RESTORE_ORIG_SIZES |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3351 }; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3352 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3353 static int save_restore_orig_size P_ ((struct window *, |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3354 enum save_restore_action)); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3355 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3356 /* 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
|
3357 from lowest windows first. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3358 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3359 static void |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3360 shrink_window_lowest_first (w, height) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3361 struct window *w; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3362 int height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3363 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3364 struct window *c; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3365 Lisp_Object child; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3366 int old_height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3367 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3368 xassert (!MINI_WINDOW_P (w)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3369 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3370 /* Set redisplay hints. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3371 XSETFASTINT (w->last_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3372 XSETFASTINT (w->last_overlay_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3373 windows_or_buffers_changed++; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3374 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
|
3375 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3376 old_height = XFASTINT (w->height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3377 XSETFASTINT (w->height, height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3378 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3379 if (!NILP (w->hchild)) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3380 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3381 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
|
3382 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3383 c = XWINDOW (child); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3384 c->top = w->top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3385 shrink_window_lowest_first (c, height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3386 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3387 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3388 else if (!NILP (w->vchild)) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3389 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3390 Lisp_Object last_child; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3391 int delta = old_height - height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3392 int last_top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3393 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3394 /* 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
|
3395 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
|
3396 backwards. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3397 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
|
3398 last_child = child; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3399 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3400 /* 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
|
3401 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
|
3402 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3403 int this_one; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3404 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3405 c = XWINDOW (child); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3406 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
|
3407 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3408 if (this_one > delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3409 this_one = delta; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3410 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3411 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
|
3412 delta -= this_one; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3413 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3414 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3415 /* Compute new positions. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3416 last_top = w->top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3417 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
|
3418 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3419 c = XWINDOW (child); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3420 c->top = make_number (last_top); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3421 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
|
3422 last_top += XFASTINT (c->height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3423 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3424 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3425 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3426 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3427 |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3428 /* 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
|
3429 rooted at W. ACTION says what to do. |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3430 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3431 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
|
3432 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
|
3433 non-zero if they are valid. |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3434 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3435 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
|
3436 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
|
3437 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3438 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
|
3439 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
|
3440 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3441 static int |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3442 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
|
3443 struct window *w; |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3444 enum save_restore_action action; |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3445 { |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3446 int success_p = 1; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3447 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3448 while (w) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3449 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3450 if (!NILP (w->hchild)) |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3451 { |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3452 if (!save_restore_orig_size (XWINDOW (w->hchild), action)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3453 success_p = 0; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3454 } |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3455 else if (!NILP (w->vchild)) |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3456 { |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3457 if (!save_restore_orig_size (XWINDOW (w->vchild), action)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3458 success_p = 0; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3459 } |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3460 |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3461 switch (action) |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3462 { |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3463 case CHECK_ORIG_SIZES: |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3464 if (!INTEGERP (w->orig_top) || !INTEGERP (w->orig_height)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3465 return 0; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3466 break; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3467 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3468 case SAVE_ORIG_SIZES: |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3469 w->orig_top = w->top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3470 w->orig_height = w->height; |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3471 XSETFASTINT (w->last_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3472 XSETFASTINT (w->last_overlay_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3473 break; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3474 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3475 case RESTORE_ORIG_SIZES: |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3476 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
|
3477 w->top = w->orig_top; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3478 w->height = w->orig_height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3479 w->orig_height = w->orig_top = Qnil; |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3480 XSETFASTINT (w->last_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3481 XSETFASTINT (w->last_overlay_modified, 0); |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3482 break; |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3483 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3484 default: |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3485 abort (); |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3486 } |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3487 |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3488 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
|
3489 } |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3490 |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3491 return success_p; |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3492 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3493 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3494 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3495 /* 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
|
3496 without deleting other windows. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3497 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3498 void |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3499 grow_mini_window (w, delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3500 struct window *w; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3501 int delta; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3502 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3503 struct frame *f = XFRAME (w->frame); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3504 struct window *root; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3505 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3506 xassert (MINI_WINDOW_P (w)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3507 xassert (delta >= 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3508 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3509 /* 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
|
3510 validity. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3511 check_min_window_sizes (); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3512 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3513 /* 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
|
3514 other windows. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3515 root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3516 if (delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3517 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3518 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
|
3519 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
|
3520 delta = XFASTINT (root->height) - min_height; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3521 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3522 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3523 if (delta) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3524 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3525 /* 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
|
3526 if (!save_restore_orig_size (root, CHECK_ORIG_SIZES)) |
|
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3527 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
|
3528 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3529 /* Shrink other windows. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3530 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
|
3531 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3532 /* Grow the mini-window. */ |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3533 w->top = make_number (XFASTINT (root->top) + XFASTINT (root)->height); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3534 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
|
3535 XSETFASTINT (w->last_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3536 XSETFASTINT (w->last_overlay_modified, 0); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3537 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3538 adjust_glyphs (f); |
|
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 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3542 |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3543 /* 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
|
3544 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
|
3545 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
|
3546 line. */ |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3547 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3548 void |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3549 shrink_mini_window (w) |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3550 struct window *w; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3551 { |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3552 struct frame *f = XFRAME (w->frame); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3553 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
|
3554 |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3555 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
|
3556 { |
|
26046
9204dfa34c1b
(enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25797
diff
changeset
|
3557 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
|
3558 adjust_glyphs (f); |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3559 FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3560 windows_or_buffers_changed = 1; |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3561 } |
|
25797
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3562 else if (XFASTINT (w->height) > 1) |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3563 { |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3564 Lisp_Object window; |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3565 XSETWINDOW (window, w); |
|
0d73a1e7b7f2
(enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents:
25792
diff
changeset
|
3566 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
|
3567 } |
|
25792
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3568 } |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3569 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3570 |
|
80e84cb91f1e
(window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25739
diff
changeset
|
3571 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3572 /* 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
|
3573 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
|
3574 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
|
3575 the frame are cleared. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3576 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3577 void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3578 mark_window_cursors_off (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3579 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3580 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3581 while (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3582 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3583 if (!NILP (w->hchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3584 mark_window_cursors_off (XWINDOW (w->hchild)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3585 else if (!NILP (w->vchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3586 mark_window_cursors_off (XWINDOW (w->vchild)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3587 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3588 w->phys_cursor_on_p = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3589 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3590 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3591 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3592 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3593 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3594 |
| 265 | 3595 /* Return number of lines of text (not counting mode line) in W. */ |
| 3596 | |
| 3597 int | |
| 3598 window_internal_height (w) | |
| 3599 struct window *w; | |
| 3600 { | |
| 3601 int ht = XFASTINT (w->height); | |
| 3602 | |
| 3603 if (MINI_WINDOW_P (w)) | |
| 3604 return ht; | |
| 3605 | |
| 485 | 3606 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild) |
| 3607 || !NILP (w->next) || !NILP (w->prev) | |
| 769 | 3608 || FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (w)))) |
| 265 | 3609 return ht - 1; |
| 3610 | |
| 3611 return ht; | |
| 3612 } | |
| 3613 | |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3614 |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3615 /* 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
|
3616 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
|
3617 separating W from the sibling to its right. */ |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3618 |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3619 int |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3620 window_internal_width (w) |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3621 struct window *w; |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3622 { |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3623 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
|
3624 int width = XINT (w->width); |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3625 |
|
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1931
diff
changeset
|
3626 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3627 /* Scroll bars occupy a few columns. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3628 width -= FRAME_SCROLL_BAR_COLS (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3629 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
|
3630 /* The column of `|' characters separating side-by-side windows |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3631 occupies one column only. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3632 width -= 1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3633 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3634 /* 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
|
3635 are used to display bitmaps there. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3636 if (FRAME_WINDOW_P (f)) |
|
25462
19b101d6ee2a
(coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents:
25402
diff
changeset
|
3637 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
|
3638 |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
3639 return width; |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3640 } |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
3641 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3642 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3643 /************************************************************************ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3644 Window Scrolling |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3645 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3646 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3647 /* 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
|
3648 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
|
3649 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
|
3650 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
|
3651 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
|
3652 respectively. */ |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3653 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3654 static void |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3655 window_scroll (window, n, whole, noerror) |
| 265 | 3656 Lisp_Object window; |
| 3657 int n; | |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3658 int whole; |
| 522 | 3659 int noerror; |
| 265 | 3660 { |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3661 /* 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
|
3662 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
|
3663 if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3664 window_scroll_pixel_based (window, n, whole, noerror); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3665 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3666 window_scroll_line_based (window, n, whole, noerror); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3667 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3668 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3669 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3670 /* 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
|
3671 heights. See the comment of window_scroll for parameter |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3672 descriptions. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3673 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3674 static void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3675 window_scroll_pixel_based (window, n, whole, noerror) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3676 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3677 int n; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3678 int whole; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3679 int noerror; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3680 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3681 struct it it; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3682 struct window *w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3683 struct text_pos start; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3684 Lisp_Object tem; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3685 int this_scroll_margin; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3686 int preserve_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3687 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3688 SET_TEXT_POS_FROM_MARKER (start, w->start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3689 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3690 /* 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
|
3691 the screen. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3692 XSETFASTINT (tem, PT); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3693 tem = Fpos_visible_in_window_p (tem, window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3694 if (NILP (tem)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3695 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3696 /* 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
|
3697 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
|
3698 results for variable height lines. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3699 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
|
3700 it.current_y = it.last_visible_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3701 move_it_vertically (&it, -it.last_visible_y / 2); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3702 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3703 /* 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
|
3704 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
|
3705 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
|
3706 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
|
3707 start of the line containing PT in this case. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3708 if (it.current_y <= 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3709 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3710 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
|
3711 move_it_vertically (&it, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3712 it.current_y = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3713 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3714 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3715 start = it.current.pos; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3716 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3717 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3718 /* 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
|
3719 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
|
3720 if (!NILP (Vscroll_preserve_screen_position)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3721 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3722 start_display (&it, w, start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3723 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
|
3724 preserve_y = it.current_y; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3725 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3726 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3727 preserve_y = -1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3728 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3729 /* 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
|
3730 backward. The result is the new window start. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3731 start_display (&it, w, start); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3732 if (whole) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3733 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3734 int screen_full = (it.last_visible_y |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3735 - next_screen_context_lines * CANON_Y_UNIT (it.f)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3736 int direction = n < 0 ? -1 : 1; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3737 move_it_vertically (&it, direction * screen_full); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3738 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3739 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3740 move_it_by_lines (&it, n, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3741 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3742 /* End if we end up at ZV or BEGV. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3743 if ((n > 0 && IT_CHARPOS (it) == ZV) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3744 || (n < 0 && IT_CHARPOS (it) == CHARPOS (start))) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3745 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3746 if (noerror) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3747 return; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3748 else if (IT_CHARPOS (it) == ZV) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3749 Fsignal (Qend_of_buffer, Qnil); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3750 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3751 Fsignal (Qbeginning_of_buffer, Qnil); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3752 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3753 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3754 /* Set the window start, and set up the window for redisplay. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3755 set_marker_restricted (w->start, make_number (IT_CHARPOS (it)), w->buffer); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3756 w->start_at_line_beg = Fbolp (); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3757 w->update_mode_line = Qt; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3758 XSETFASTINT (w->last_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3759 XSETFASTINT (w->last_overlay_modified, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3760 /* Set force_start so that redisplay_window will run the |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3761 window-scroll-functions. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3762 w->force_start = Qt; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3763 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3764 it.current_y = it.vpos = 0; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3765 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3766 /* Preserve the screen position if we must. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3767 if (preserve_y >= 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3768 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3769 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
|
3770 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3771 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3772 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3773 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3774 /* Move PT out of scroll margins. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3775 this_scroll_margin = max (0, scroll_margin); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3776 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
|
3777 this_scroll_margin *= CANON_Y_UNIT (it.f); |
|
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 if (n > 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3780 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3781 /* 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
|
3782 in the scroll margin at the top. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3783 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
|
3784 while (it.current_y < this_scroll_margin) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3785 move_it_by_lines (&it, 1, 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3786 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3787 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3788 else if (n < 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3789 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3790 /* 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
|
3791 in the scroll margin at the bottom. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3792 move_it_to (&it, PT, -1, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3793 it.last_visible_y - this_scroll_margin - 1, -1, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3794 MOVE_TO_POS | MOVE_TO_Y); |
|
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 /* Don't put point on a partially visible line at the end. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3797 if (it.current_y + it.max_ascent + it.max_descent |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3798 > it.last_visible_y) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3799 move_it_by_lines (&it, -1, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3800 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3801 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3802 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3803 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3804 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3805 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3806 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3807 /* 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
|
3808 See the comment of window_scroll for parameter descriptions. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3809 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3810 static void |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3811 window_scroll_line_based (window, n, whole, noerror) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3812 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3813 int n; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3814 int whole; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3815 int noerror; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3816 { |
| 265 | 3817 register struct window *w = XWINDOW (window); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3818 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
|
3819 register int pos, pos_byte; |
| 265 | 3820 register int ht = window_internal_height (w); |
| 3821 register Lisp_Object tem; | |
| 3822 int lose; | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3823 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
|
3824 int startpos; |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3825 struct position posit; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3826 int original_vpos; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3827 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3828 startpos = marker_position (w->start); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3829 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3830 posit = *compute_motion (startpos, 0, 0, 0, |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3831 PT, ht, 0, |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3832 window_internal_width (w), XINT (w->hscroll), |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3833 0, w); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3834 original_vpos = posit.vpos; |
|
13102
960db92441d8
(window_scroll): Always set force_start.
Richard M. Stallman <rms@gnu.org>
parents:
12981
diff
changeset
|
3835 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3836 XSETFASTINT (tem, PT); |
| 265 | 3837 tem = Fpos_visible_in_window_p (tem, window); |
| 3838 | |
| 485 | 3839 if (NILP (tem)) |
| 265 | 3840 { |
|
6341
dfc758dd2b08
(window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents:
6326
diff
changeset
|
3841 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
|
3842 startpos = PT; |
| 265 | 3843 } |
|
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
|
3844 |
|
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
|
3845 SET_PT (startpos); |
| 7347 | 3846 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
|
3847 Fvertical_motion (make_number (n), window); |
| 7347 | 3848 pos = PT; |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3849 pos_byte = PT_BYTE; |
| 265 | 3850 bolp = Fbolp (); |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3851 SET_PT_BOTH (opoint, opoint_byte); |
| 265 | 3852 |
| 3853 if (lose) | |
| 522 | 3854 { |
| 3855 if (noerror) | |
| 3856 return; | |
| 3857 else | |
| 3858 Fsignal (Qbeginning_of_buffer, Qnil); | |
| 3859 } | |
| 265 | 3860 |
| 3861 if (pos < ZV) | |
| 3862 { | |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3863 int this_scroll_margin = scroll_margin; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3864 |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3865 /* 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
|
3866 if (this_scroll_margin < 0) |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3867 this_scroll_margin = 0; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3868 |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3869 if (XINT (w->height) < 4 * scroll_margin) |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3870 this_scroll_margin = XINT (w->height) / 4; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3871 |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3872 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); |
| 265 | 3873 w->start_at_line_beg = bolp; |
| 3874 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
|
3875 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
|
3876 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
|
3877 /* 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
|
3878 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
|
3879 w->force_start = Qt; |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3880 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3881 if (whole && !NILP (Vscroll_preserve_screen_position)) |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3882 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3883 SET_PT_BOTH (pos, pos_byte); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3884 Fvertical_motion (make_number (original_vpos), window); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3885 } |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3886 /* 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
|
3887 that it is outside the scroll margin. */ |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3888 else if (n > 0) |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3889 { |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3890 int top_margin; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3891 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3892 if (this_scroll_margin > 0) |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3893 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3894 SET_PT_BOTH (pos, pos_byte); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3895 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
|
3896 top_margin = PT; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3897 } |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3898 else |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3899 top_margin = pos; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3900 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3901 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
|
3902 SET_PT_BOTH (opoint, opoint_byte); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3903 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
|
3904 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3905 SET_PT_BOTH (pos, pos_byte); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3906 Fvertical_motion (make_number (original_vpos), window); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3907 } |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3908 else |
|
20046
8baac8399a29
(window_scroll): When scrolling forward and point is
Karl Heuer <kwzh@gnu.org>
parents:
19667
diff
changeset
|
3909 SET_PT (top_margin); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3910 } |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3911 else if (n < 0) |
| 265 | 3912 { |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3913 int bottom_margin; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3914 |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3915 /* 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
|
3916 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
|
3917 SET_PT_BOTH (pos, pos_byte); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
3918 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
|
3919 if (XFASTINT (tem) == ht - this_scroll_margin) |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3920 bottom_margin = PT; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3921 else |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3922 bottom_margin = PT + 1; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3923 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3924 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
|
3925 SET_PT_BOTH (opoint, opoint_byte); |
| 265 | 3926 else |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3927 { |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3928 if (!NILP (Vscroll_preserve_screen_position)) |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3929 { |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
3930 SET_PT_BOTH (pos, pos_byte); |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3931 Fvertical_motion (make_number (original_vpos), window); |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3932 } |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3933 else |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3934 Fvertical_motion (make_number (-1), window); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3935 } |
| 265 | 3936 } |
| 3937 } | |
| 3938 else | |
| 522 | 3939 { |
| 3940 if (noerror) | |
| 3941 return; | |
| 3942 else | |
| 3943 Fsignal (Qend_of_buffer, Qnil); | |
| 3944 } | |
| 265 | 3945 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3946 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3947 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3948 /* 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
|
3949 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
|
3950 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
|
3951 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
|
3952 up. This is the guts of Fscroll_up and Fscroll_down. */ |
| 265 | 3953 |
| 3954 static void | |
| 3955 scroll_command (n, direction) | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3956 Lisp_Object n; |
| 265 | 3957 int direction; |
| 3958 { | |
| 3959 register int defalt; | |
| 3960 int count = specpdl_ptr - specpdl; | |
| 3961 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3962 xassert (abs (direction) == 1); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3963 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3964 /* 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
|
3965 the moment. But don't screw up if window_scroll gets an error. */ |
| 265 | 3966 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
| 548 | 3967 { |
| 3968 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
| 3969 Fset_buffer (XWINDOW (selected_window)->buffer); | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3970 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3971 /* Make redisplay consider other windows than just selected_window. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
3972 ++windows_or_buffers_changed; |
| 548 | 3973 } |
| 265 | 3974 |
| 3975 defalt = (window_internal_height (XWINDOW (selected_window)) | |
| 3976 - next_screen_context_lines); | |
| 3977 defalt = direction * (defalt < 1 ? 1 : defalt); | |
| 3978 | |
| 485 | 3979 if (NILP (n)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3980 window_scroll (selected_window, defalt, 1, 0); |
| 265 | 3981 else if (EQ (n, Qminus)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3982 window_scroll (selected_window, - defalt, 1, 0); |
| 265 | 3983 else |
| 3984 { | |
| 3985 n = Fprefix_numeric_value (n); | |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
3986 window_scroll (selected_window, XINT (n) * direction, 0, 0); |
| 265 | 3987 } |
| 548 | 3988 |
| 3989 unbind_to (count, Qnil); | |
| 265 | 3990 } |
| 3991 | |
| 3992 DEFUN ("scroll-up", Fscroll_up, Sscroll_up, 0, 1, "P", | |
| 3993 "Scroll text of current window upward ARG lines; or near full screen if no ARG.\n\ | |
| 3994 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
|
3995 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
|
3996 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
|
3997 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
|
3998 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3999 Lisp_Object arg; |
| 265 | 4000 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4001 scroll_command (arg, 1); |
| 265 | 4002 return Qnil; |
| 4003 } | |
| 4004 | |
| 4005 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
|
4006 "Scroll text of current window down ARG lines; or near full screen if no ARG.\n\ |
| 265 | 4007 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
|
4008 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
|
4009 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
|
4010 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
|
4011 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4012 Lisp_Object arg; |
| 265 | 4013 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4014 scroll_command (arg, -1); |
| 265 | 4015 return Qnil; |
| 4016 } | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4017 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4018 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
|
4019 "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
|
4020 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
|
4021 specifies the window.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4022 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
|
4023 showing that buffer is used.") |
|
8059
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
4024 () |
| 265 | 4025 { |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4026 Lisp_Object window; |
| 265 | 4027 |
| 4028 if (MINI_WINDOW_P (XWINDOW (selected_window)) | |
| 485 | 4029 && !NILP (Vminibuf_scroll_window)) |
| 265 | 4030 window = Vminibuf_scroll_window; |
| 4031 /* If buffer is specified, scroll that buffer. */ | |
| 485 | 4032 else if (!NILP (Vother_window_scroll_buffer)) |
| 265 | 4033 { |
| 4034 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); | |
| 485 | 4035 if (NILP (window)) |
|
20867
fccf74829150
(Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents:
20777
diff
changeset
|
4036 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt, Qnil); |
| 265 | 4037 } |
| 4038 else | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4039 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4040 /* 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
|
4041 frame. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4042 window = Fnext_window (selected_window, Qnil, Qnil); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4043 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4044 if (EQ (window, selected_window)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4045 /* 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
|
4046 visible frame. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4047 do |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4048 window = Fnext_window (window, Qnil, Qt); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4049 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
|
4050 && ! EQ (window, selected_window)); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4051 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
4052 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4053 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 4054 |
| 4055 if (EQ (window, selected_window)) | |
| 4056 error ("There is no other window"); | |
| 4057 | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4058 return window; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4059 } |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4060 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4061 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
|
4062 "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
|
4063 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
|
4064 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
|
4065 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
|
4066 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
|
4067 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
|
4068 \n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4069 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
|
4070 specifies the window to scroll.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4071 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
|
4072 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
|
4073 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4074 register Lisp_Object arg; |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4075 { |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4076 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
|
4077 register int defalt; |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4078 register struct window *w; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4079 register int count = specpdl_ptr - specpdl; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4080 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4081 window = Fother_window_for_scrolling (); |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
4082 |
| 265 | 4083 w = XWINDOW (window); |
|
10373
c5c1ffa3755e
(Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents:
10302
diff
changeset
|
4084 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
|
4085 if (defalt < 1) defalt = 1; |
| 265 | 4086 |
| 4087 /* Don't screw up if window_scroll gets an error. */ | |
| 4088 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
|
4089 ++windows_or_buffers_changed; |
| 265 | 4090 |
| 4091 Fset_buffer (w->buffer); | |
| 4092 SET_PT (marker_position (w->pointm)); | |
| 4093 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4094 if (NILP (arg)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4095 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
|
4096 else if (EQ (arg, Qminus)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4097 window_scroll (window, -defalt, 1, 1); |
| 265 | 4098 else |
| 4099 { | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4100 if (CONSP (arg)) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4101 arg = Fcar (arg); |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4102 CHECK_NUMBER (arg, 0); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
4103 window_scroll (window, XINT (arg), 0, 1); |
| 265 | 4104 } |
| 4105 | |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4106 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
|
4107 unbind_to (count, Qnil); |
| 265 | 4108 |
| 4109 return Qnil; | |
| 4110 } | |
| 4111 | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
4112 DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P", |
| 265 | 4113 "Scroll selected window display ARG columns left.\n\ |
| 4114 Default for ARG is window width minus 2.") | |
| 4115 (arg) | |
| 4116 register Lisp_Object arg; | |
| 4117 { | |
| 4118 | |
| 485 | 4119 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
|
4120 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
| 265 | 4121 else |
| 4122 arg = Fprefix_numeric_value (arg); | |
| 4123 | |
| 4124 return | |
| 4125 Fset_window_hscroll (selected_window, | |
| 4126 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
| 4127 + XINT (arg))); | |
| 4128 } | |
| 4129 | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
4130 DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P", |
| 265 | 4131 "Scroll selected window display ARG columns right.\n\ |
| 4132 Default for ARG is window width minus 2.") | |
| 4133 (arg) | |
| 4134 register Lisp_Object arg; | |
| 4135 { | |
| 485 | 4136 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
|
4137 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
| 265 | 4138 else |
| 4139 arg = Fprefix_numeric_value (arg); | |
| 4140 | |
| 4141 return | |
| 4142 Fset_window_hscroll (selected_window, | |
| 4143 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
| 4144 - XINT (arg))); | |
| 4145 } | |
| 4146 | |
| 4147 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", | |
| 769 | 4148 "Center point in window and redisplay frame. With ARG, put point on line ARG.\n\ |
| 265 | 4149 The desired position of point is always relative to the current window.\n\ |
| 769 | 4150 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
|
4151 If ARG is omitted or nil, erases the entire frame and then\n\ |
| 769 | 4152 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
|
4153 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4154 register Lisp_Object arg; |
| 265 | 4155 { |
| 4156 register struct window *w = XWINDOW (selected_window); | |
| 4157 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
|
4158 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
|
4159 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
|
4160 struct buffer *obuf = current_buffer; |
| 265 | 4161 |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4162 if (NILP (arg)) |
| 265 | 4163 { |
| 769 | 4164 extern int frame_garbaged; |
|
26873
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4165 int i; |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4166 |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4167 /* Invalidate pixel data calculated for all compositions. */ |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4168 for (i = 0; i < n_compositions; i++) |
|
5281eb29603f
(Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents:
26761
diff
changeset
|
4169 composition_table[i]->font = NULL; |
| 265 | 4170 |
|
25402
857e8b5b1194
(Frecenter): Clear frame if called with nil or no arg.
Gerd Moellmann <gerd@gnu.org>
parents:
25387
diff
changeset
|
4171 Fredraw_frame (w->frame); |
| 769 | 4172 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
|
4173 XSETFASTINT (arg, ht / 2); |
| 265 | 4174 } |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4175 else if (CONSP (arg)) /* Just C-u. */ |
| 265 | 4176 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4177 XSETFASTINT (arg, ht / 2); |
| 265 | 4178 } |
| 4179 else | |
| 4180 { | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4181 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
|
4182 CHECK_NUMBER (arg, 0); |
| 265 | 4183 } |
| 4184 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4185 if (XINT (arg) < 0) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4186 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
|
4187 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4188 set_buffer_internal (buf); |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15905
diff
changeset
|
4189 pos = *vmotion (PT, - XINT (arg), w); |
|
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
4190 |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4191 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
|
4192 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
|
4193 || FETCH_BYTE (pos.bytepos - 1) == '\n') |
|
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
4194 ? Qt : Qnil); |
| 265 | 4195 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
|
4196 set_buffer_internal (obuf); |
| 265 | 4197 |
| 4198 return Qnil; | |
| 4199 } | |
| 4200 | |
| 4201 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, | |
| 4202 1, 1, "P", | |
| 4203 "Position point relative to window.\n\ | |
|
8411
9a68cba600fc
(Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8366
diff
changeset
|
4204 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
|
4205 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
|
4206 zero means top of window, negative means relative to bottom of window.") |
| 265 | 4207 (arg) |
| 4208 register Lisp_Object arg; | |
| 4209 { | |
| 4210 register struct window *w = XWINDOW (selected_window); | |
| 4211 register int height = window_internal_height (w); | |
| 4212 register int start; | |
|
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
4213 Lisp_Object window; |
| 265 | 4214 |
| 485 | 4215 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
|
4216 XSETFASTINT (arg, height / 2); |
| 265 | 4217 else |
| 4218 { | |
| 4219 arg = Fprefix_numeric_value (arg); | |
| 4220 if (XINT (arg) < 0) | |
| 4221 XSETINT (arg, XINT (arg) + height); | |
| 4222 } | |
| 4223 | |
| 4224 start = marker_position (w->start); | |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
4225 XSETWINDOW (window, w); |
| 265 | 4226 if (start < BEGV || start > ZV) |
| 4227 { | |
|
6341
dfc758dd2b08
(window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents:
6326
diff
changeset
|
4228 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
|
4229 set_marker_both (w->start, w->buffer, PT, PT_BYTE); |
| 265 | 4230 w->start_at_line_beg = Fbolp (); |
| 4231 w->force_start = Qt; | |
| 4232 } | |
| 4233 else | |
|
20535
3094e3fd9764
(unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20351
diff
changeset
|
4234 Fgoto_char (w->start); |
| 265 | 4235 |
|
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
4236 return Fvertical_motion (arg, window); |
| 265 | 4237 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4238 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4239 |
| 265 | 4240 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4241 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4242 Window Configuration |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4243 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4244 |
| 265 | 4245 struct save_window_data |
| 4246 { | |
|
15712
a272ccf6c225
(struct save_window_data, struct saved_window): First
Karl Heuer <kwzh@gnu.org>
parents:
15385
diff
changeset
|
4247 EMACS_INT size_from_Lisp_Vector_struct; |
| 265 | 4248 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
|
4249 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
|
4250 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
|
4251 Lisp_Object selected_frame; |
| 265 | 4252 Lisp_Object current_window; |
| 4253 Lisp_Object current_buffer; | |
| 4254 Lisp_Object minibuf_scroll_window; | |
| 4255 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
|
4256 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
|
4257 /* 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
|
4258 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
|
4259 Lisp_Object min_width, min_height; |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4260 /* 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
|
4261 for one window. */ |
| 265 | 4262 Lisp_Object saved_windows; |
| 4263 }; | |
|
1326
709532b86646
* window.c (SAVE_WINDOW_DATA_SIZE): Define this using sizeof,
Jim Blandy <jimb@redhat.com>
parents:
1325
diff
changeset
|
4264 |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4265 /* This is saved as a Lisp_Vector */ |
| 265 | 4266 struct saved_window |
| 4267 { | |
| 4268 /* 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
|
4269 EMACS_INT size_from_Lisp_Vector_struct; |
| 265 | 4270 struct Lisp_Vector *next_from_Lisp_Vector_struct; |
| 4271 | |
| 4272 Lisp_Object window; | |
| 4273 Lisp_Object buffer, start, pointm, mark; | |
| 4274 Lisp_Object left, top, width, height, hscroll; | |
| 4275 Lisp_Object parent, prev; | |
| 4276 Lisp_Object start_at_line_beg; | |
| 4277 Lisp_Object display_table; | |
| 4278 }; | |
| 4279 #define SAVED_WINDOW_VECTOR_SIZE 14 /* Arg to Fmake_vector */ | |
| 4280 | |
| 4281 #define SAVED_WINDOW_N(swv,n) \ | |
| 4282 ((struct saved_window *) (XVECTOR ((swv)->contents[(n)]))) | |
| 4283 | |
| 4284 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
|
4285 "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
|
4286 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4287 Lisp_Object object; |
| 265 | 4288 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
4289 if (WINDOW_CONFIGURATIONP (object)) |
| 265 | 4290 return Qt; |
| 4291 return Qnil; | |
| 4292 } | |
| 4293 | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4294 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
|
4295 "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
|
4296 (config) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4297 Lisp_Object config; |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4298 { |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4299 register struct save_window_data *data; |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4300 struct Lisp_Vector *saved_windows; |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4301 |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4302 if (! WINDOW_CONFIGURATIONP (config)) |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4303 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
|
4304 |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4305 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
|
4306 saved_windows = XVECTOR (data->saved_windows); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4307 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
|
4308 } |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4309 |
|
2297
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
4310 DEFUN ("set-window-configuration", Fset_window_configuration, |
|
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
4311 Sset_window_configuration, 1, 1, 0, |
| 265 | 4312 "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\ |
| 4313 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
|
4314 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
|
4315 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
|
4316 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
|
4317 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
|
4318 (configuration) |
|
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
4319 Lisp_Object configuration; |
| 265 | 4320 { |
| 4321 register struct save_window_data *data; | |
| 4322 struct Lisp_Vector *saved_windows; | |
| 4323 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
|
4324 Lisp_Object frame; |
| 769 | 4325 FRAME_PTR f; |
| 18657 | 4326 int old_point = -1; |
| 265 | 4327 |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
4328 while (!WINDOW_CONFIGURATIONP (configuration)) |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4329 wrong_type_argument (Qwindow_configuration_p, configuration); |
| 265 | 4330 |
|
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
4331 data = (struct save_window_data *) XVECTOR (configuration); |
| 265 | 4332 saved_windows = XVECTOR (data->saved_windows); |
| 4333 | |
| 4334 new_current_buffer = data->current_buffer; | |
| 485 | 4335 if (NILP (XBUFFER (new_current_buffer)->name)) |
| 265 | 4336 new_current_buffer = Qnil; |
| 18657 | 4337 else |
| 4338 { | |
| 4339 if (XBUFFER (new_current_buffer) == current_buffer) | |
| 4340 old_point = PT; | |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
4341 |
| 18657 | 4342 } |
| 265 | 4343 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4344 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
|
4345 f = XFRAME (frame); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4346 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4347 /* 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
|
4348 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
|
4349 if (FRAME_LIVE_P (f)) |
| 265 | 4350 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4351 register struct window *w; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4352 register struct saved_window *p; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4353 struct window *root_window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4354 struct window **leaf_windows; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4355 int n_leaf_windows; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4356 int k, i; |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4357 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4358 /* 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
|
4359 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
|
4360 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
|
4361 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
|
4362 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
|
4363 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
|
4364 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
|
4365 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
|
4366 |
| 18657 | 4367 /* The mouse highlighting code could get screwed up |
| 4368 if it runs during this. */ | |
| 4369 BLOCK_INPUT; | |
| 4370 | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4371 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
|
4372 || 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
|
4373 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
|
4374 XFASTINT (data->frame_width), 0, 0, 0); |
|
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
4375 #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
|
4376 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
|
4377 != previous_frame_menu_bar_lines) |
|
21533
b7df83bf15ff
(Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents:
21514
diff
changeset
|
4378 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
|
4379 #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
|
4380 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
|
4381 != 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
|
4382 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
|
4383 #endif |
|
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4384 #endif |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4385 |
|
20627
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4386 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
|
4387 { |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4388 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
|
4389 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
|
4390 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
|
4391 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
|
4392 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
|
4393 } |
|
0753fa7a67f3
(Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents:
20535
diff
changeset
|
4394 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4395 windows_or_buffers_changed++; |
|
10666
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
4396 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
|
4397 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4398 /* Problem: Freeing all matrices and later allocating them again |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4399 is a serious redisplay flickering problem. What we would |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4400 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
|
4401 below. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4402 root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4403 leaf_windows |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4404 = (struct window **) alloca (count_windows (root_window) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4405 * sizeof (struct window *)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4406 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
|
4407 |
|
8931
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
4408 /* 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
|
4409 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
|
4410 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
|
4411 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
|
4412 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4413 /* Kludge Alert! |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4414 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
|
4415 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
|
4416 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4417 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
|
4418 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
|
4419 dead. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4420 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
|
4421 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4422 for (k = 0; k < saved_windows->size; k++) |
| 265 | 4423 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4424 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
|
4425 w = XWINDOW (p->window); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4426 w->next = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4427 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4428 if (!NILP (p->parent)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4429 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
|
4430 XFASTINT (p->parent))->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4431 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4432 w->parent = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4433 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4434 if (!NILP (p->prev)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4435 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4436 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
|
4437 XFASTINT (p->prev))->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4438 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
|
4439 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4440 else |
| 265 | 4441 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4442 w->prev = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4443 if (!NILP (w->parent)) |
| 265 | 4444 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4445 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
|
4446 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4447 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
|
4448 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
|
4449 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4450 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4451 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4452 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
|
4453 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
|
4454 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4455 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4456 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4457 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4458 /* 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
|
4459 restore it now. */ |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
4460 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
|
4461 w->buffer = w->height; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4462 w->left = p->left; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4463 w->top = p->top; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4464 w->width = p->width; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4465 w->height = p->height; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4466 w->hscroll = p->hscroll; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4467 w->display_table = p->display_table; |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4468 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
|
4469 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
|
4470 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4471 /* 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
|
4472 if (NILP (p->buffer)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4473 w->buffer = p->buffer; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4474 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4475 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4476 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
|
4477 /* 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
|
4478 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4479 w->buffer = p->buffer; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4480 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
|
4481 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
|
4482 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
|
4483 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
|
4484 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
|
4485 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4486 /* 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
|
4487 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
|
4488 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
|
4489 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
|
4490 && 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
|
4491 Fgoto_char (w->pointm); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4492 } |
|
3535
581c09f72dbd
(Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents:
3354
diff
changeset
|
4493 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
|
4494 /* 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
|
4495 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4496 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
|
4497 /* 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
|
4498 range. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4499 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
|
4500 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
|
4501 w->start_at_line_beg = Qt; |
| 265 | 4502 } |
| 4503 else | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4504 /* 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
|
4505 are real. */ |
| 265 | 4506 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4507 /* 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
|
4508 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
|
4509 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
|
4510 w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4511 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
|
4512 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
|
4513 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
|
4514 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
|
4515 w->start_at_line_beg = Qt; |
| 265 | 4516 } |
| 4517 } | |
| 4518 } | |
|
1237
3929b2135e58
* window.c (delete_all_subwindows): Save the window's buffer in
Jim Blandy <jimb@redhat.com>
parents:
1123
diff
changeset
|
4519 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4520 FRAME_ROOT_WINDOW (f) = data->root_window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4521 Fselect_window (data->current_window); |
|
17678
c13cd575945a
(Fset_window_configuration): Set last_selected_window
Richard M. Stallman <rms@gnu.org>
parents:
17628
diff
changeset
|
4522 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
|
4523 = selected_window; |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4524 |
|
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4525 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
|
4526 || (FRAMEP (data->focus_frame) |
|
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4527 && FRAME_LIVE_P (XFRAME (data->focus_frame)))) |
|
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
4528 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
|
4529 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4530 #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
|
4531 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
|
4532 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
|
4533 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
|
4534 Qnil, 0); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4535 #endif |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4536 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4537 /* 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
|
4538 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
|
4539 || 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
|
4540 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
|
4541 0, 0, 0); |
|
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
4542 #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
|
4543 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
|
4544 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
|
4545 make_number (0)); |
|
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4546 #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
|
4547 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
|
4548 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
|
4549 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
|
4550 #endif |
|
25115
2105537c5916
(Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents:
25044
diff
changeset
|
4551 #endif |
| 18657 | 4552 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4553 /* Now, free glyph matrices in windows that were not reused. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4554 for (i = 0; i < n_leaf_windows; ++i) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4555 if (NILP (leaf_windows[i]->buffer)) |
|
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 /* Assert it's not reused as a combination. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4558 xassert (NILP (leaf_windows[i]->hchild) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4559 && NILP (leaf_windows[i]->vchild)); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4560 free_window_matrices (leaf_windows[i]); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4561 SET_FRAME_GARBAGED (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4562 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4563 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4564 adjust_glyphs (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4565 |
| 18657 | 4566 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
|
4567 |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4568 /* 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
|
4569 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
|
4570 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
|
4571 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
|
4572 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
|
4573 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
|
4574 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
|
4575 |
|
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4576 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
|
4577 && ! 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
|
4578 call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
| 265 | 4579 } |
| 4580 | |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4581 if (!NILP (new_current_buffer)) |
| 18657 | 4582 { |
| 4583 Fset_buffer (new_current_buffer); | |
| 4584 | |
| 4585 /* If the buffer that is current now is the same | |
| 4586 that was current before setting the window configuration, | |
| 4587 don't alter its PT. */ | |
| 4588 if (old_point >= 0) | |
| 4589 SET_PT (old_point); | |
| 4590 } | |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
4591 |
|
21198
10518dc95b25
(Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents:
21022
diff
changeset
|
4592 /* 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
|
4593 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
|
4594 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
|
4595 |
| 265 | 4596 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
|
4597 |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
4598 return (FRAME_LIVE_P (f) ? Qt : Qnil); |
| 265 | 4599 } |
| 4600 | |
| 769 | 4601 /* Mark all windows now on frame as deleted |
| 265 | 4602 by setting their buffers to nil. */ |
| 4603 | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
4604 void |
| 265 | 4605 delete_all_subwindows (w) |
| 4606 register struct window *w; | |
| 4607 { | |
| 485 | 4608 if (!NILP (w->next)) |
| 265 | 4609 delete_all_subwindows (XWINDOW (w->next)); |
| 485 | 4610 if (!NILP (w->vchild)) |
| 265 | 4611 delete_all_subwindows (XWINDOW (w->vchild)); |
| 485 | 4612 if (!NILP (w->hchild)) |
| 265 | 4613 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
|
4614 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4615 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
|
4616 |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4617 if (!NILP (w->buffer)) |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4618 unshow_buffer (w); |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
4619 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4620 /* 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
|
4621 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
|
4622 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
|
4623 vchild or hchild set. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4624 w->buffer = Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4625 w->vchild = Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
4626 w->hchild = Qnil; |
| 265 | 4627 } |
| 4628 | |
| 4629 static int | |
| 4630 count_windows (window) | |
| 4631 register struct window *window; | |
| 4632 { | |
| 4633 register int count = 1; | |
| 485 | 4634 if (!NILP (window->next)) |
| 265 | 4635 count += count_windows (XWINDOW (window->next)); |
| 485 | 4636 if (!NILP (window->vchild)) |
| 265 | 4637 count += count_windows (XWINDOW (window->vchild)); |
| 485 | 4638 if (!NILP (window->hchild)) |
| 265 | 4639 count += count_windows (XWINDOW (window->hchild)); |
| 4640 return count; | |
| 4641 } | |
| 4642 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4643 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4644 /* 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
|
4645 Value is last index + 1. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4646 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4647 static int |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4648 get_leaf_windows (w, flat, i) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4649 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4650 struct window **flat; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4651 int i; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4652 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4653 while (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4654 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4655 if (!NILP (w->hchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4656 i = get_leaf_windows (XWINDOW (w->hchild), flat, i); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4657 else if (!NILP (w->vchild)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4658 i = get_leaf_windows (XWINDOW (w->vchild), flat, i); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4659 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4660 flat[i++] = w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4661 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4662 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4663 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4664 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4665 return i; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4666 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4667 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4668 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4669 /* 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
|
4670 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
|
4671 can be returned. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4672 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4673 struct glyph * |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4674 get_phys_cursor_glyph (w) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4675 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4676 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4677 struct glyph_row *row; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4678 struct glyph *glyph; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4679 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4680 if (w->phys_cursor.vpos >= 0 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4681 && w->phys_cursor.vpos < w->current_matrix->nrows |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4682 && (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
|
4683 row->enabled_p) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4684 && row->used[TEXT_AREA] > w->phys_cursor.hpos) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4685 glyph = row->glyphs[TEXT_AREA] + w->phys_cursor.hpos; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4686 else |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4687 glyph = NULL; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4688 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4689 return glyph; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4690 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4691 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4692 |
| 265 | 4693 static int |
| 4694 save_window_save (window, vector, i) | |
| 4695 Lisp_Object window; | |
| 4696 struct Lisp_Vector *vector; | |
| 4697 int i; | |
| 4698 { | |
| 4699 register struct saved_window *p; | |
| 4700 register struct window *w; | |
| 4701 register Lisp_Object tem; | |
| 4702 | |
| 485 | 4703 for (;!NILP (window); window = w->next) |
| 265 | 4704 { |
| 4705 p = SAVED_WINDOW_N (vector, i); | |
| 4706 w = XWINDOW (window); | |
| 4707 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4708 XSETFASTINT (w->temslot, i++); |
| 265 | 4709 p->window = window; |
| 4710 p->buffer = w->buffer; | |
| 4711 p->left = w->left; | |
| 4712 p->top = w->top; | |
| 4713 p->width = w->width; | |
| 4714 p->height = w->height; | |
| 4715 p->hscroll = w->hscroll; | |
| 4716 p->display_table = w->display_table; | |
| 485 | 4717 if (!NILP (w->buffer)) |
| 265 | 4718 { |
| 4719 /* Save w's value of point in the window configuration. | |
| 4720 If w is the selected window, then get the value of point | |
| 4721 from the buffer; pointm is garbage in the selected window. */ | |
| 4722 if (EQ (window, selected_window)) | |
| 4723 { | |
| 4724 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
|
4725 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
|
4726 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
|
4727 BUF_PT_BYTE (XBUFFER (w->buffer))); |
| 265 | 4728 } |
| 4729 else | |
|
12981
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
4730 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
|
4731 |
|
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
4732 p->start = Fcopy_marker (w->start, Qnil); |
| 265 | 4733 p->start_at_line_beg = w->start_at_line_beg; |
| 4734 | |
| 4735 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
|
4736 p->mark = Fcopy_marker (tem, Qnil); |
| 265 | 4737 } |
| 4738 else | |
| 4739 { | |
| 4740 p->pointm = Qnil; | |
| 4741 p->start = Qnil; | |
| 4742 p->mark = Qnil; | |
| 4743 p->start_at_line_beg = Qnil; | |
| 4744 } | |
| 4745 | |
| 485 | 4746 if (NILP (w->parent)) |
| 265 | 4747 p->parent = Qnil; |
| 4748 else | |
| 4749 p->parent = XWINDOW (w->parent)->temslot; | |
| 4750 | |
| 485 | 4751 if (NILP (w->prev)) |
| 265 | 4752 p->prev = Qnil; |
| 4753 else | |
| 4754 p->prev = XWINDOW (w->prev)->temslot; | |
| 4755 | |
| 485 | 4756 if (!NILP (w->vchild)) |
| 265 | 4757 i = save_window_save (w->vchild, vector, i); |
| 485 | 4758 if (!NILP (w->hchild)) |
| 265 | 4759 i = save_window_save (w->hchild, vector, i); |
| 4760 } | |
| 4761 | |
| 4762 return i; | |
| 4763 } | |
| 4764 | |
|
16485
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
4765 DEFUN ("current-window-configuration", Fcurrent_window_configuration, |
|
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
4766 Scurrent_window_configuration, 0, 1, 0, |
| 769 | 4767 "Return an object representing the current window configuration of FRAME.\n\ |
| 4768 If FRAME is nil or omitted, use the selected frame.\n\ | |
| 265 | 4769 This describes the number of windows, their sizes and current buffers,\n\ |
| 4770 and for each displayed buffer, where display starts, and the positions of\n\ | |
| 4771 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
|
4772 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
|
4773 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
|
4774 redirection (see `redirect-frame-focus').") |
| 769 | 4775 (frame) |
| 4776 Lisp_Object frame; | |
| 265 | 4777 { |
| 4778 register Lisp_Object tem; | |
| 4779 register int n_windows; | |
| 4780 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
|
4781 register struct Lisp_Vector *vec; |
| 265 | 4782 register int i; |
| 769 | 4783 FRAME_PTR f; |
| 265 | 4784 |
| 769 | 4785 if (NILP (frame)) |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
4786 frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
4787 CHECK_LIVE_FRAME (frame, 0); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
4788 f = XFRAME (frame); |
| 358 | 4789 |
| 769 | 4790 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
|
4791 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
|
4792 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
|
4793 vec->contents[i] = Qnil; |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4794 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
|
4795 data = (struct save_window_data *)vec; |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
4796 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
4797 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
|
4798 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
|
4799 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
|
4800 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
|
4801 data->selected_frame = selected_frame; |
| 769 | 4802 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
|
4803 XSETBUFFER (data->current_buffer, current_buffer); |
| 265 | 4804 data->minibuf_scroll_window = Vminibuf_scroll_window; |
| 769 | 4805 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
|
4806 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
|
4807 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
|
4808 XSETINT (data->min_width, window_min_width); |
| 265 | 4809 tem = Fmake_vector (make_number (n_windows), Qnil); |
| 4810 data->saved_windows = tem; | |
| 4811 for (i = 0; i < n_windows; i++) | |
| 4812 XVECTOR (tem)->contents[i] | |
| 4813 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil); | |
| 769 | 4814 save_window_save (FRAME_ROOT_WINDOW (f), |
| 265 | 4815 XVECTOR (tem), 0); |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
4816 XSETWINDOW_CONFIGURATION (tem, data); |
| 265 | 4817 return (tem); |
| 4818 } | |
| 4819 | |
| 4820 DEFUN ("save-window-excursion", Fsave_window_excursion, Ssave_window_excursion, | |
| 4821 0, UNEVALLED, 0, | |
| 4822 "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
|
4823 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
|
4824 and the value of point and mark for each window.\n\ |
|
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
4825 Also restore which buffer is current.\n\ |
| 265 | 4826 Does not restore the value of point in current buffer.") |
| 4827 (args) | |
| 4828 Lisp_Object args; | |
| 4829 { | |
| 4830 register Lisp_Object val; | |
| 4831 register int count = specpdl_ptr - specpdl; | |
| 4832 | |
| 4833 record_unwind_protect (Fset_window_configuration, | |
| 358 | 4834 Fcurrent_window_configuration (Qnil)); |
| 265 | 4835 val = Fprogn (args); |
| 4836 return unbind_to (count, val); | |
| 4837 } | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4838 |
| 265 | 4839 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4840 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4841 Marginal Areas |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4842 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4843 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4844 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
|
4845 2, 3, 0, |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4846 "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
|
4847 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
|
4848 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
|
4849 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
|
4850 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
|
4851 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
|
4852 (window, left, right) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4853 Lisp_Object window, left, right; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4854 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4855 struct window *w = decode_window (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4856 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4857 if (!NILP (left)) |
|
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
4858 CHECK_NUMBER_OR_FLOAT (left, 1); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4859 if (!NILP (right)) |
|
25591
d58d733a75d6
(Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents:
25549
diff
changeset
|
4860 CHECK_NUMBER_OR_FLOAT (right, 2); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4861 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4862 /* 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
|
4863 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
|
4864 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
|
4865 || (FLOATP (left) && XFLOAT_DATA (left) <= 0)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4866 XSETFASTINT (left, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4867 if (INTEGERP (left) && XFASTINT (left) == 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4868 left = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4869 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4870 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
|
4871 || (FLOATP (right) && XFLOAT_DATA (right) <= 0)) |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4872 XSETFASTINT (right, 0); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4873 if (INTEGERP (right) && XFASTINT (right) == 0) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4874 right = Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4875 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4876 w->left_margin_width = left; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4877 w->right_margin_width = right; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4878 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4879 ++windows_or_buffers_changed; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4880 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4881 return Qnil; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4882 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4883 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4884 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4885 DEFUN ("window-margins", Fwindow_margins, Swindow_margins, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4886 0, 1, 0, |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4887 "Get width of marginal areas of window WINDOW.\n\ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4888 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
|
4889 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
|
4890 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
|
4891 as nil.") |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4892 (window) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4893 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4894 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4895 struct window *w = decode_window (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4896 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
|
4897 } |
|
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 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4900 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4901 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4902 Smooth scrolling |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4903 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4904 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4905 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
|
4906 "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
|
4907 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
|
4908 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
|
4909 (window) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4910 Lisp_Object window; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4911 { |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4912 Lisp_Object result; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4913 struct frame *f; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4914 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4915 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4916 if (NILP (window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4917 window = selected_window; |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4918 else |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4919 CHECK_WINDOW (window, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4920 w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4921 f = XFRAME (w->frame); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4922 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4923 if (FRAME_WINDOW_P (f)) |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4924 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
|
4925 else |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4926 result = make_number (0); |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4927 return result; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4928 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4929 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4930 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4931 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
|
4932 2, 2, 0, |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4933 "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
|
4934 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
|
4935 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
|
4936 (window, vscroll) |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4937 Lisp_Object window, vscroll; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4938 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4939 struct window *w; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4940 struct frame *f; |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4941 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4942 if (NILP (window)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4943 window = selected_window; |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4944 else |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4945 CHECK_WINDOW (window, 0); |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4946 CHECK_NUMBER_OR_FLOAT (vscroll, 1); |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4947 |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4948 w = XWINDOW (window); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4949 f = XFRAME (w->frame); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4950 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4951 if (FRAME_WINDOW_P (f)) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4952 { |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4953 int old_dy = w->vscroll; |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4954 |
|
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4955 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
|
4956 w->vscroll = min (w->vscroll, 0); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4957 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4958 /* 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
|
4959 area becomes larger than before. */ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4960 if (w->vscroll < 0 && w->vscroll < old_dy) |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4961 adjust_glyphs (f); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4962 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4963 /* Prevent redisplay shortcuts. */ |
| 25375 | 4964 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4965 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4966 |
|
25549
63deb587dce1
(Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4967 return Fwindow_vscroll (window); |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4968 } |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
4969 |
|
25517
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4970 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4971 /* 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
|
4972 first argument being a pointer to the leaf window, and with |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4973 additional arguments A1..A4. */ |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4974 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4975 void |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4976 foreach_window (f, fn, a1, a2, a3, a4) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4977 struct frame *f; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4978 void (* fn) (); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4979 int a1, a2, a3, a4; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4980 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4981 foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, a1, a2, a3, a4); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4982 } |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4983 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4984 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4985 /* 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
|
4986 reachable from W. FN is called with the first argument being a |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4987 pointer to the leaf window, and with additional arguments A1..A4. */ |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4988 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4989 static void |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4990 foreach_window_1 (w, fn, a1, a2, a3, a4) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4991 struct window *w; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4992 void (* fn) (); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4993 int a1, a2, a3, a4; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4994 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4995 while (w) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4996 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4997 if (!NILP (w->hchild)) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4998 foreach_window_1 (XWINDOW (w->hchild), fn, a1, a2, a3, a4); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
4999 else if (!NILP (w->vchild)) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5000 foreach_window_1 (XWINDOW (w->vchild), fn, a1, a2, a3, a4); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5001 else |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5002 fn (w, a1, a2, a3, a4); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5003 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5004 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5005 } |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5006 } |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5007 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5008 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5009 /* Freeze or unfreeze the window start of W if unless it is a |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5010 mini-window or the selected window. FREEZE_P non-zero means freeze |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5011 the window start. */ |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5012 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5013 static void |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5014 freeze_window_start (w, freeze_p) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5015 struct window *w; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5016 int freeze_p; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5017 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5018 if (w == XWINDOW (selected_window) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5019 || MINI_WINDOW_P (w) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5020 || (MINI_WINDOW_P (XWINDOW (selected_window)) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5021 && w == XWINDOW (Vminibuf_scroll_window))) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5022 freeze_p = 0; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5023 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5024 w->frozen_window_start_p = freeze_p; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5025 } |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5026 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5027 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5028 /* 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
|
5029 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
|
5030 means freeze the window start. */ |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5031 |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5032 void |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5033 freeze_window_starts (f, freeze_p) |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5034 struct frame *f; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5035 int freeze_p; |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5036 { |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5037 foreach_window (f, freeze_window_start, freeze_p); |
|
619897099dc4
(foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents:
25462
diff
changeset
|
5038 } |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5039 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5040 |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5041 /*********************************************************************** |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5042 Initialization |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5043 ***********************************************************************/ |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5044 |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5045 /* Return 1 if window configurations C1 and C2 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5046 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
|
5047 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5048 int |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5049 compare_window_configurations (c1, c2, ignore_positions) |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5050 Lisp_Object c1, c2; |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5051 int ignore_positions; |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5052 { |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5053 register struct save_window_data *d1, *d2; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5054 struct Lisp_Vector *sw1, *sw2; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5055 int i; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5056 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5057 d1 = (struct save_window_data *) XVECTOR (c1); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5058 d2 = (struct save_window_data *) XVECTOR (c2); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5059 sw1 = XVECTOR (d1->saved_windows); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5060 sw2 = XVECTOR (d2->saved_windows); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5061 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5062 if (! EQ (d1->frame_width, d2->frame_width)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5063 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5064 if (! EQ (d1->frame_height, d2->frame_height)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5065 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5066 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
|
5067 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5068 if (! EQ (d1->selected_frame, d2->selected_frame)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5069 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5070 /* Don't compare the current_window field directly. |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5071 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
|
5072 if (! EQ (d1->current_buffer, d2->current_buffer)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5073 return 0; |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5074 if (! ignore_positions) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5075 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
|
5076 return 0; |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5077 /* Don't compare the root_window field. |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5078 We don't require the two configurations |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5079 to use the same window object, |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5080 and the two root windows must be equivalent |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5081 if everything else compares equal. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5082 if (! EQ (d1->focus_frame, d2->focus_frame)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5083 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5084 if (! EQ (d1->min_width, d2->min_width)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5085 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5086 if (! EQ (d1->min_height, d2->min_height)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5087 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5088 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5089 /* 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
|
5090 if (sw1->size != sw2->size) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5091 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5092 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5093 for (i = 0; i < sw1->size; i++) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5094 { |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5095 struct saved_window *p1, *p2; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5096 int w1_is_current, w2_is_current; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5097 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5098 p1 = SAVED_WINDOW_N (sw1, i); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5099 p2 = SAVED_WINDOW_N (sw2, i); |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5100 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5101 /* Verify that the current windows in the two |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5102 configurations correspond to each other. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5103 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
|
5104 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
|
5105 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5106 if (w1_is_current != w2_is_current) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5107 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5108 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5109 /* Verify that the corresponding windows do match. */ |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5110 if (! EQ (p1->buffer, p2->buffer)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5111 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5112 if (! EQ (p1->left, p2->left)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5113 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5114 if (! EQ (p1->top, p2->top)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5115 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5116 if (! EQ (p1->width, p2->width)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5117 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5118 if (! EQ (p1->height, p2->height)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5119 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5120 if (! EQ (p1->display_table, p2->display_table)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5121 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5122 if (! EQ (p1->parent, p2->parent)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5123 return 0; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5124 if (! EQ (p1->prev, p2->prev)) |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5125 return 0; |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5126 if (! ignore_positions) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5127 { |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5128 if (! EQ (p1->hscroll, p2->hscroll)) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5129 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5130 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
|
5131 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5132 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
|
5133 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5134 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
|
5135 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5136 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
|
5137 return 0; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5138 } |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5139 } |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5140 |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5141 return 1; |
|
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5142 } |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5143 |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5144 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
|
5145 Scompare_window_configurations, 2, 2, 0, |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5146 "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
|
5147 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
|
5148 and scrolling positions.") |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5149 (x, y) |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5150 Lisp_Object x, y; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5151 { |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5152 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
|
5153 return Qt; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5154 return Qnil; |
|
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5155 } |
|
20777
a9e1b9bf06e3
(compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents:
20708
diff
changeset
|
5156 |
| 21514 | 5157 void |
| 265 | 5158 init_window_once () |
| 5159 { | |
|
25676
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5160 struct frame *f = make_terminal_frame (); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5161 XSETFRAME (selected_frame, f); |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5162 Vterminal_frame = selected_frame; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5163 minibuf_window = f->minibuffer_window; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5164 selected_window = f->selected_window; |
|
70c6d3f2f3b9
(Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25591
diff
changeset
|
5165 last_nonminibuf_frame = f; |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
5166 |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
5167 window_initialized = 1; |
| 265 | 5168 } |
| 5169 | |
| 21514 | 5170 void |
| 265 | 5171 syms_of_window () |
| 5172 { | |
|
25315
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5173 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
|
5174 staticpro (&Qleft_bitmap_area); |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5175 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
|
5176 staticpro (&Qright_bitmap_area); |
|
79bb4978ab2e
(Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents:
25300
diff
changeset
|
5177 |
|
25540
2b4bdd114899
(Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents:
25517
diff
changeset
|
5178 Qwindow_size_fixed = intern ("window-size-fixed"); |
|
2b4bdd114899
(Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents:
25517
diff
changeset
|
5179 staticpro (&Qwindow_size_fixed); |
| 25268 | 5180 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5181 staticpro (&Qwindow_configuration_change_hook); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5182 Qwindow_configuration_change_hook |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5183 = intern ("window-configuration-change-hook"); |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5184 |
| 265 | 5185 Qwindowp = intern ("windowp"); |
| 5186 staticpro (&Qwindowp); | |
| 5187 | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5188 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
|
5189 staticpro (&Qwindow_configuration_p); |
|
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5190 |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
5191 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
|
5192 staticpro (&Qwindow_live_p); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
5193 |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
5194 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
|
5195 staticpro (&Qtemp_buffer_show_hook); |
|
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
5196 |
| 265 | 5197 DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, |
| 5198 "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
|
5199 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
|
5200 Used by `with-output-to-temp-buffer'.\n\ |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
5201 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
|
5202 the buffer; `temp-buffer-show-hook' is not run unless this function runs it."); |
| 265 | 5203 Vtemp_buffer_show_function = Qnil; |
| 5204 | |
| 5205 DEFVAR_LISP ("display-buffer-function", &Vdisplay_buffer_function, | |
| 5206 "If non-nil, function to call to handle `display-buffer'.\n\ | |
| 5207 It will receive two args, the buffer and a flag which if non-nil means\n\ | |
| 5208 that the currently selected window is not acceptable.\n\ | |
| 5209 Commands such as `switch-to-buffer-other-window' and `find-file-other-window'\n\ | |
| 5210 work using this function."); | |
| 5211 Vdisplay_buffer_function = Qnil; | |
| 5212 | |
| 5213 DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window, | |
| 5214 "Non-nil means it is the window that C-M-v in minibuffer should scroll."); | |
| 5215 Vminibuf_scroll_window = Qnil; | |
| 5216 | |
| 5217 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer, | |
| 5218 "If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window."); | |
| 5219 Vother_window_scroll_buffer = Qnil; | |
| 5220 | |
| 769 | 5221 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames, |
| 780 | 5222 "*Non-nil means `display-buffer' should make a separate frame."); |
| 769 | 5223 pop_up_frames = 0; |
| 265 | 5224 |
| 769 | 5225 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
|
5226 "Function to call to handle automatic new frame creation.\n\ |
| 769 | 5227 It is called with no arguments and should return a newly created frame.\n\ |
| 265 | 5228 \n\ |
| 769 | 5229 A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ |
| 5230 where `pop-up-frame-alist' would hold the default frame parameters."); | |
| 5231 Vpop_up_frame_function = Qnil; | |
| 265 | 5232 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5233 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
|
5234 "*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
|
5235 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
|
5236 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
|
5237 \n\ |
|
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5238 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
|
5239 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
|
5240 (BUFFER FRAME-PARAMETERS...) (BUFFER FUNCTION OTHER-ARGS...)\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5241 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
|
5242 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
|
5243 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
|
5244 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
|
5245 \n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5246 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
|
5247 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
|
5248 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
|
5249 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
|
5250 Vspecial_display_buffer_names = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5251 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5252 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
|
5253 "*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
|
5254 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
|
5255 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
|
5256 using `special-display-function'.\n\ |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
5257 \n\ |
|
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5258 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
|
5259 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
|
5260 (REGEXP FRAME-PARAMETERS...) (REGEXP FUNCTION OTHER-ARGS...)\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
5261 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
|
5262 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
|
5263 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
|
5264 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
|
5265 \n\ |
|
0651874195c7
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
18900
diff
changeset
|
5266 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
|
5267 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
|
5268 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
|
5269 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
|
5270 Vspecial_display_regexps = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5271 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5272 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
|
5273 "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
|
5274 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
|
5275 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
|
5276 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
|
5277 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
|
5278 \n\ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5279 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
|
5280 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
|
5281 Vspecial_display_function = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
5282 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5283 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
|
5284 "*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
|
5285 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
|
5286 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
|
5287 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
|
5288 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5289 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
|
5290 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
|
5291 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
|
5292 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
|
5293 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5294 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
|
5295 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
|
5296 |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5297 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
|
5298 "*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
|
5299 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
|
5300 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
|
5301 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
|
5302 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5303 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
|
5304 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
|
5305 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
|
5306 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
|
5307 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5308 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
|
5309 Vsame_window_regexps = Qnil; |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
5310 |
| 265 | 5311 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, |
| 5312 "*Non-nil means display-buffer should make new windows."); | |
| 5313 pop_up_windows = 1; | |
| 5314 | |
| 5315 DEFVAR_INT ("next-screen-context-lines", &next_screen_context_lines, | |
| 5316 "*Number of lines of continuity when scrolling by screenfuls."); | |
| 5317 next_screen_context_lines = 2; | |
| 5318 | |
| 5319 DEFVAR_INT ("split-height-threshold", &split_height_threshold, | |
| 5320 "*display-buffer would prefer to split the largest window if this large.\n\ | |
| 5321 If there is only one window, it is split regardless of this value."); | |
| 5322 split_height_threshold = 500; | |
| 5323 | |
| 5324 DEFVAR_INT ("window-min-height", &window_min_height, | |
| 5325 "*Delete any window less than this tall (including its mode line)."); | |
| 5326 window_min_height = 4; | |
| 5327 | |
| 5328 DEFVAR_INT ("window-min-width", &window_min_width, | |
| 5329 "*Delete any window less than this wide."); | |
| 5330 window_min_width = 10; | |
| 5331 | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5332 DEFVAR_LISP ("scroll-preserve-screen-position", |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5333 &Vscroll_preserve_screen_position, |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
5334 "*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
|
5335 Vscroll_preserve_screen_position = Qnil; |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
5336 |
|
17281
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5337 DEFVAR_LISP ("window-configuration-change-hook", |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5338 &Vwindow_configuration_change_hook, |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5339 "Functions to call when window configuration changes.\n\ |
| 20090 | 5340 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
|
5341 Vwindow_configuration_change_hook = Qnil; |
|
4f3c71b28278
(Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17226
diff
changeset
|
5342 |
| 265 | 5343 defsubr (&Sselected_window); |
| 5344 defsubr (&Sminibuffer_window); | |
| 5345 defsubr (&Swindow_minibuffer_p); | |
| 5346 defsubr (&Swindowp); | |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
5347 defsubr (&Swindow_live_p); |
| 265 | 5348 defsubr (&Spos_visible_in_window_p); |
| 5349 defsubr (&Swindow_buffer); | |
| 5350 defsubr (&Swindow_height); | |
| 5351 defsubr (&Swindow_width); | |
| 5352 defsubr (&Swindow_hscroll); | |
| 5353 defsubr (&Sset_window_hscroll); | |
|
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
5354 defsubr (&Swindow_redisplay_end_trigger); |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
5355 defsubr (&Sset_window_redisplay_end_trigger); |
| 265 | 5356 defsubr (&Swindow_edges); |
| 432 | 5357 defsubr (&Scoordinates_in_window_p); |
| 5358 defsubr (&Swindow_at); | |
| 265 | 5359 defsubr (&Swindow_point); |
| 5360 defsubr (&Swindow_start); | |
| 5361 defsubr (&Swindow_end); | |
| 5362 defsubr (&Sset_window_point); | |
| 5363 defsubr (&Sset_window_start); | |
| 5364 defsubr (&Swindow_dedicated_p); | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
5365 defsubr (&Sset_window_dedicated_p); |
| 265 | 5366 defsubr (&Swindow_display_table); |
| 5367 defsubr (&Sset_window_display_table); | |
| 5368 defsubr (&Snext_window); | |
| 5369 defsubr (&Sprevious_window); | |
| 5370 defsubr (&Sother_window); | |
| 5371 defsubr (&Sget_lru_window); | |
| 5372 defsubr (&Sget_largest_window); | |
| 5373 defsubr (&Sget_buffer_window); | |
| 5374 defsubr (&Sdelete_other_windows); | |
| 5375 defsubr (&Sdelete_windows_on); | |
| 5376 defsubr (&Sreplace_buffer_in_windows); | |
| 5377 defsubr (&Sdelete_window); | |
| 5378 defsubr (&Sset_window_buffer); | |
| 5379 defsubr (&Sselect_window); | |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
5380 defsubr (&Sspecial_display_p); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
5381 defsubr (&Ssame_window_p); |
| 265 | 5382 defsubr (&Sdisplay_buffer); |
| 5383 defsubr (&Ssplit_window); | |
| 5384 defsubr (&Senlarge_window); | |
| 5385 defsubr (&Sshrink_window); | |
| 5386 defsubr (&Sscroll_up); | |
| 5387 defsubr (&Sscroll_down); | |
| 5388 defsubr (&Sscroll_left); | |
| 5389 defsubr (&Sscroll_right); | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
5390 defsubr (&Sother_window_for_scrolling); |
| 265 | 5391 defsubr (&Sscroll_other_window); |
| 5392 defsubr (&Srecenter); | |
| 5393 defsubr (&Smove_to_window_line); | |
| 5394 defsubr (&Swindow_configuration_p); | |
|
23410
02cc44ea2455
(window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents:
22923
diff
changeset
|
5395 defsubr (&Swindow_configuration_frame); |
| 265 | 5396 defsubr (&Sset_window_configuration); |
| 5397 defsubr (&Scurrent_window_configuration); | |
| 5398 defsubr (&Ssave_window_excursion); | |
|
24997
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5399 defsubr (&Sset_window_margins); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5400 defsubr (&Swindow_margins); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5401 defsubr (&Swindow_vscroll); |
|
5e507b813c1d
(Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents:
24230
diff
changeset
|
5402 defsubr (&Sset_window_vscroll); |
|
21022
52bc6b672a50
(compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents:
20867
diff
changeset
|
5403 defsubr (&Scompare_window_configurations); |
| 265 | 5404 } |
| 5405 | |
| 21514 | 5406 void |
| 265 | 5407 keys_of_window () |
| 5408 { | |
| 5409 initial_define_key (control_x_map, '1', "delete-other-windows"); | |
| 5410 initial_define_key (control_x_map, '2', "split-window"); | |
| 5411 initial_define_key (control_x_map, '0', "delete-window"); | |
| 5412 initial_define_key (control_x_map, 'o', "other-window"); | |
| 5413 initial_define_key (control_x_map, '^', "enlarge-window"); | |
| 5414 initial_define_key (control_x_map, '<', "scroll-left"); | |
| 5415 initial_define_key (control_x_map, '>', "scroll-right"); | |
| 5416 | |
| 5417 initial_define_key (global_map, Ctl ('V'), "scroll-up"); | |
| 5418 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); | |
| 5419 initial_define_key (meta_map, 'v', "scroll-down"); | |
| 5420 | |
| 5421 initial_define_key (global_map, Ctl('L'), "recenter"); | |
| 5422 initial_define_key (meta_map, 'r', "move-to-window-line"); | |
| 5423 } |
