Mercurial > emacs
annotate src/window.c @ 17226:8a8bcf6d7a0c
(Fset_window_buffer): Increment display_count if it is an integer.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Sat, 22 Mar 1997 04:18:04 +0000 |
| parents | 05385a7a18c9 |
| children | 4f3c71b28278 |
| rev | line source |
|---|---|
| 265 | 1 /* Window creation, deletion and examination for GNU Emacs. |
| 2 Does not include redisplay. | |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
3 Copyright (C) 1985, 86, 87, 93, 94, 95, 96 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" |
| 265 | 32 |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
33 Lisp_Object Qwindowp, Qwindow_live_p; |
| 265 | 34 |
| 35 Lisp_Object Fnext_window (), Fdelete_window (), Fselect_window (); | |
| 36 Lisp_Object Fset_window_buffer (), Fsplit_window (), Frecenter (); | |
| 37 | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
38 void delete_all_subwindows (); |
| 265 | 39 static struct window *decode_window(); |
| 40 | |
| 41 /* This is the window in which the terminal's cursor should | |
| 42 be left when nothing is being done with it. This must | |
| 43 always be a leaf window, and its buffer is selected by | |
| 44 the top level editing loop at the end of each command. | |
| 45 | |
| 46 This value is always the same as | |
| 769 | 47 FRAME_SELECTED_WINDOW (selected_frame). */ |
| 265 | 48 |
| 49 Lisp_Object selected_window; | |
| 50 | |
| 769 | 51 /* The minibuffer window of the selected frame. |
| 265 | 52 Note that you cannot test for minibufferness of an arbitrary window |
| 53 by comparing against this; but you can test for minibufferness of | |
| 54 the selected window. */ | |
| 55 Lisp_Object minibuf_window; | |
| 56 | |
| 57 /* Non-nil means it is the window for C-M-v to scroll | |
| 58 when the minibuffer is selected. */ | |
| 59 Lisp_Object Vminibuf_scroll_window; | |
| 60 | |
| 61 /* Non-nil means this is the buffer whose window C-M-v should scroll. */ | |
| 62 Lisp_Object Vother_window_scroll_buffer; | |
| 63 | |
| 64 /* Non-nil means it's function to call to display temp buffers. */ | |
| 65 Lisp_Object Vtemp_buffer_show_function; | |
| 66 | |
| 67 /* If a window gets smaller than either of these, it is removed. */ | |
| 68 int window_min_height; | |
| 69 int window_min_width; | |
| 70 | |
| 71 /* Nonzero implies Fdisplay_buffer should create windows. */ | |
| 72 int pop_up_windows; | |
| 73 | |
| 769 | 74 /* Nonzero implies make new frames for Fdisplay_buffer. */ |
| 75 int pop_up_frames; | |
| 265 | 76 |
| 77 /* Non-nil means use this function instead of default */ | |
| 769 | 78 Lisp_Object Vpop_up_frame_function; |
| 265 | 79 |
| 80 /* Function to call to handle Fdisplay_buffer. */ | |
| 81 Lisp_Object Vdisplay_buffer_function; | |
| 82 | |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
83 /* List of buffer *names* for buffers that should have their own frames. */ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
84 Lisp_Object Vspecial_display_buffer_names; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
85 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
86 /* List of regexps for buffer names that should have their own frames. */ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
87 Lisp_Object Vspecial_display_regexps; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
88 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
89 /* Function to pop up a special frame. */ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
90 Lisp_Object Vspecial_display_function; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
91 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
92 /* List of buffer *names* for buffers to appear in selected window. */ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
93 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
|
94 |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
95 /* List of regexps for buffer names to appear in selected window. */ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
96 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
|
97 |
|
10461
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
98 /* Hook run at end of temp_output_buffer_show. */ |
|
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
99 Lisp_Object Qtemp_buffer_show_hook; |
|
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
100 |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
101 /* Fdisplay_buffer always splits the largest window |
| 265 | 102 if that window is more than this high. */ |
| 103 int split_height_threshold; | |
| 104 | |
| 105 /* Number of lines of continuity in scrolling by screenfuls. */ | |
| 106 int next_screen_context_lines; | |
| 107 | |
| 108 /* Incremented for each window created. */ | |
| 109 static int sequence_number; | |
| 110 | |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
111 /* Nonzero after init_window_once has finished. */ |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
112 static int window_initialized; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
113 |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
114 /* 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
|
115 at the same screen height as previously. */ |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
116 static int scroll_preserve_screen_position; |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
117 |
| 265 | 118 #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
|
119 |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
120 extern int scroll_margin; |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
121 |
|
14149
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
122 extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; |
| 265 | 123 |
| 124 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
|
125 "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
|
126 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
127 Lisp_Object object; |
| 265 | 128 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
129 return WINDOWP (object) ? Qt : Qnil; |
| 265 | 130 } |
| 131 | |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
132 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
|
133 "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
|
134 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
135 Lisp_Object object; |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
136 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
137 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
|
138 } |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
139 |
| 265 | 140 Lisp_Object |
| 141 make_window () | |
| 142 { | |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
143 Lisp_Object val; |
| 265 | 144 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
|
145 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
|
146 int i; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
147 |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
148 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
|
149 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
|
150 vec->contents[i] = Qnil; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 XSETFASTINT (p->hscroll, 0); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
159 XSETFASTINT (p->last_point_x, 0); |
|
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
160 XSETFASTINT (p->last_point_y, 0); |
| 265 | 161 p->start = Fmake_marker (); |
| 162 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
|
163 XSETFASTINT (p->use_time, 0); |
| 769 | 164 p->frame = Qnil; |
| 265 | 165 p->display_table = Qnil; |
| 166 p->dedicated = Qnil; | |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
167 XSETWINDOW (val, p); |
| 265 | 168 return val; |
| 169 } | |
| 170 | |
| 171 DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, | |
| 172 "Return the window that the cursor now appears in and commands apply to.") | |
| 173 () | |
| 174 { | |
| 175 return selected_window; | |
| 176 } | |
| 177 | |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
178 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
|
179 "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
|
180 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
|
181 used by that frame.") |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
182 (frame) |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
183 Lisp_Object frame; |
| 265 | 184 { |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
185 if (NILP (frame)) |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
186 XSETFRAME (frame, selected_frame); |
|
1123
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
187 else |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
188 CHECK_LIVE_FRAME (frame, 0); |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
189 |
|
55e605674fb1
* window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents:
1049
diff
changeset
|
190 return FRAME_MINIBUF_WINDOW (XFRAME (frame)); |
| 265 | 191 } |
| 192 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
193 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, |
| 265 | 194 "Returns non-nil if WINDOW is a minibuffer window.") |
| 195 (window) | |
| 196 Lisp_Object window; | |
| 197 { | |
| 198 struct window *w = decode_window (window); | |
| 199 return (MINI_WINDOW_P (w) ? Qt : Qnil); | |
| 200 } | |
| 201 | |
| 202 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | |
| 203 Spos_visible_in_window_p, 0, 2, 0, | |
| 769 | 204 "Return t if position POS is currently on the frame in WINDOW.\n\ |
| 265 | 205 Returns nil if that position is scrolled vertically out of view.\n\ |
| 206 POS defaults to point; WINDOW, to the selected window.") | |
| 207 (pos, window) | |
| 208 Lisp_Object pos, window; | |
| 209 { | |
| 210 register struct window *w; | |
| 211 register int top; | |
| 212 register int height; | |
| 213 register int posint; | |
| 214 register struct buffer *buf; | |
| 215 struct position posval; | |
|
5886
08286e54ad0e
(Fpos_visible_in_window_p): Take hscroll into account.
Karl Heuer <kwzh@gnu.org>
parents:
5738
diff
changeset
|
216 int hscroll; |
| 265 | 217 |
| 485 | 218 if (NILP (pos)) |
| 7347 | 219 posint = PT; |
| 265 | 220 else |
| 221 { | |
| 222 CHECK_NUMBER_COERCE_MARKER (pos, 0); | |
| 223 posint = XINT (pos); | |
| 224 } | |
| 225 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
226 w = decode_window (window); |
| 265 | 227 top = marker_position (w->start); |
|
5886
08286e54ad0e
(Fpos_visible_in_window_p): Take hscroll into account.
Karl Heuer <kwzh@gnu.org>
parents:
5738
diff
changeset
|
228 hscroll = XINT (w->hscroll); |
| 265 | 229 |
| 230 if (posint < top) | |
| 231 return Qnil; | |
| 232 | |
| 233 height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); | |
| 234 | |
| 235 buf = XBUFFER (w->buffer); | |
|
16208
e3a834653117
(Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
16068
diff
changeset
|
236 if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) |
|
e3a834653117
(Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
16068
diff
changeset
|
237 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf)) |
| 265 | 238 { |
| 769 | 239 /* If frame is up to date, |
| 265 | 240 use the info recorded about how much text fit on it. */ |
| 241 if (posint < BUF_Z (buf) - XFASTINT (w->window_end_pos) | |
| 242 || (XFASTINT (w->window_end_vpos) < height)) | |
| 243 return Qt; | |
| 244 return Qnil; | |
| 245 } | |
| 246 else | |
| 247 { | |
|
5738
730f63010940
(Fpos_visible_in_window_p): Return nil if POS > ZV.
Karl Heuer <kwzh@gnu.org>
parents:
5232
diff
changeset
|
248 if (posint > BUF_ZV (buf)) |
| 265 | 249 return Qnil; |
| 250 | |
|
8486
52b7441e731b
(Fpos_visible_in_window_p): Do something reasonable
Richard M. Stallman <rms@gnu.org>
parents:
8435
diff
changeset
|
251 /* w->start can be out of range. If it is, do something reasonable. */ |
|
52b7441e731b
(Fpos_visible_in_window_p): Do something reasonable
Richard M. Stallman <rms@gnu.org>
parents:
8435
diff
changeset
|
252 if (top < BUF_BEGV (buf) || top > BUF_ZV (buf)) |
|
52b7441e731b
(Fpos_visible_in_window_p): Do something reasonable
Richard M. Stallman <rms@gnu.org>
parents:
8435
diff
changeset
|
253 return Qnil; |
|
52b7441e731b
(Fpos_visible_in_window_p): Do something reasonable
Richard M. Stallman <rms@gnu.org>
parents:
8435
diff
changeset
|
254 |
| 265 | 255 /* If that info is not correct, calculate afresh */ |
|
17019
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
256 /* BUG FIX for the 7th arg (TOHPOS). |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
257 |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
258 '0' is harmless, however, ' - (1 << (BITS_PER_SHORT - 1))' is |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
259 more appropriate here. In case of HSCROLL > 0, this can avoid |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
260 needless calculation done until (HPOS == 0). |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
261 |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
262 We want to determine if the position POSINT is in HEIGHT or |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
263 not. We don't have to do calculation until (HPOS == 0). We |
|
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
264 can stop it when VPOS goes beyond HEIGHT. */ |
|
11852
35b170692e4a
(Fpos_visible_in_window_p): New arg to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
11829
diff
changeset
|
265 posval = *compute_motion (top, 0, (hscroll ? 1 - hscroll : 0), 0, |
|
17019
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
266 posint, height, - (1 << (BITS_PER_SHORT - 1)), |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
267 window_internal_width (w) - 1, |
|
6692
43a79400a664
Add window argument on calls to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
6576
diff
changeset
|
268 hscroll, 0, w); |
| 265 | 269 |
| 270 return posval.vpos < height ? Qt : Qnil; | |
| 271 } | |
| 272 } | |
| 273 | |
| 274 static struct window * | |
| 275 decode_window (window) | |
| 276 register Lisp_Object window; | |
| 277 { | |
| 485 | 278 if (NILP (window)) |
| 265 | 279 return XWINDOW (selected_window); |
| 280 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
281 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 282 return XWINDOW (window); |
| 283 } | |
| 284 | |
| 285 DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, | |
| 286 "Return the buffer that WINDOW is displaying.") | |
| 287 (window) | |
| 288 Lisp_Object window; | |
| 289 { | |
| 290 return decode_window (window)->buffer; | |
| 291 } | |
| 292 | |
| 293 DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, | |
| 294 "Return the number of lines in WINDOW (including its mode line).") | |
| 295 (window) | |
| 296 Lisp_Object window; | |
| 297 { | |
| 298 return decode_window (window)->height; | |
| 299 } | |
| 300 | |
| 301 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
|
302 "Return the number of display columns in WINDOW.\n\ |
|
ed4b06e1975b
(Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6232
diff
changeset
|
303 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
|
304 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
|
305 use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))).") |
| 265 | 306 (window) |
| 307 Lisp_Object window; | |
| 308 { | |
|
6576
851ee89bae86
(Fwindow_width): Delete unnecessary variable declarations.
Karl Heuer <kwzh@gnu.org>
parents:
6517
diff
changeset
|
309 return make_number (window_internal_width (decode_window (window))); |
| 265 | 310 } |
| 311 | |
| 312 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |
| 313 "Return the number of columns by which WINDOW is scrolled from left margin.") | |
| 314 (window) | |
| 315 Lisp_Object window; | |
| 316 { | |
| 317 return decode_window (window)->hscroll; | |
| 318 } | |
| 319 | |
| 320 DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | |
| 321 "Set number of columns WINDOW is scrolled from left margin to NCOL.\n\ | |
| 322 NCOL should be zero or positive.") | |
| 323 (window, ncol) | |
| 324 register Lisp_Object window, ncol; | |
| 325 { | |
| 326 register struct window *w; | |
| 327 | |
| 328 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
|
329 if (XINT (ncol) < 0) XSETFASTINT (ncol, 0); |
| 265 | 330 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
|
331 if (XINT (w->hscroll) != XINT (ncol)) |
|
12492
27497b336977
(Fset_window_hscroll): Set clip_changed in the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
12387
diff
changeset
|
332 XBUFFER (w->buffer)->clip_changed = 1; /* Prevent redisplay shortcuts */ |
| 265 | 333 w->hscroll = ncol; |
| 334 return ncol; | |
| 335 } | |
| 336 | |
|
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
337 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
|
338 Swindow_redisplay_end_trigger, 0, 1, 0, |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
339 "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
|
340 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
|
341 (window) |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
342 Lisp_Object window; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
343 { |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
344 return decode_window (window)->redisplay_end_trigger; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
345 } |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
346 |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
347 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
|
348 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
|
349 "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
|
350 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
|
351 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
|
352 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
|
353 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
|
354 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
|
355 (window, value) |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
356 register Lisp_Object window, value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
357 { |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
358 register struct window *w; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
359 |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
360 w = decode_window (window); |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
361 w->redisplay_end_trigger = value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
362 return value; |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
363 } |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
364 |
| 265 | 365 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, |
| 366 "Return a list of the edge coordinates of WINDOW.\n\ | |
| 769 | 367 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame.\n\ |
| 265 | 368 RIGHT is one more than the rightmost column used by WINDOW,\n\ |
| 369 and BOTTOM is one more than the bottommost row used by WINDOW\n\ | |
| 370 and its mode-line.") | |
| 371 (window) | |
| 372 Lisp_Object window; | |
| 373 { | |
| 374 register struct window *w = decode_window (window); | |
| 375 | |
| 376 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
|
377 Fcons (make_number (WINDOW_RIGHT_EDGE (w)), |
| 265 | 378 Fcons (make_number (XFASTINT (w->top) |
| 379 + XFASTINT (w->height)), | |
| 380 Qnil)))); | |
| 381 } | |
| 382 | |
| 432 | 383 /* Test if the character at column *x, row *y is within window *w. |
| 384 If it is not, return 0; | |
| 385 if it is in the window's text area, | |
| 386 set *x and *y to its location relative to the upper left corner | |
| 387 of the window, and | |
| 388 return 1; | |
| 389 if it is on the window's modeline, return 2; | |
| 390 if it is on the border between the window and its right sibling, | |
| 391 return 3. */ | |
| 392 static int | |
| 393 coordinates_in_window (w, x, y) | |
| 394 register struct window *w; | |
| 395 register int *x, *y; | |
| 396 { | |
| 397 register int left = XINT (w->left); | |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
398 register int right_edge = WINDOW_RIGHT_EDGE (w); |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
399 register int left_margin = WINDOW_LEFT_MARGIN (w); |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
400 register int right_margin = WINDOW_RIGHT_MARGIN (w); |
| 432 | 401 register int window_height = XINT (w->height); |
| 402 register int top = XFASTINT (w->top); | |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
403 |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
404 if ( *x < left || *x >= right_edge |
| 432 | 405 || *y < top || *y >= top + window_height) |
| 406 return 0; | |
| 407 | |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
408 if (left_margin != left && *x < left_margin && *x >= left) |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
409 return 3; |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
410 |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
411 if (right_margin != right_edge && *x >= right_margin && *x < right_edge) |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
412 return 3; |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
413 |
| 432 | 414 /* Is the character is the mode line? */ |
| 415 if (*y == top + window_height - 1 | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
416 && ! MINI_WINDOW_P (w)) |
| 432 | 417 return 2; |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
418 |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
419 *x -= WINDOW_LEFT_MARGIN (w); |
| 432 | 420 *y -= top; |
| 421 return 1; | |
| 422 } | |
| 423 | |
| 424 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, | |
| 425 Scoordinates_in_window_p, 2, 2, 0, | |
| 426 "Return non-nil if COORDINATES are in WINDOW.\n\ | |
| 708 | 427 COORDINATES is a cons of the form (X . Y), X and Y being distances\n\ |
| 769 | 428 measured in characters from the upper-left corner of the frame.\n\ |
| 708 | 429 (0 . 0) denotes the character in the upper left corner of the\n\ |
| 769 | 430 frame.\n\ |
| 432 | 431 If COORDINATES are in the text portion of WINDOW,\n\ |
| 432 the coordinates relative to the window are returned.\n\ | |
| 732 | 433 If they are in the mode line of WINDOW, `mode-line' is returned.\n\ |
| 432 | 434 If they are on the border between WINDOW and its right sibling,\n\ |
| 732 | 435 `vertical-line' is returned.") |
| 432 | 436 (coordinates, window) |
| 437 register Lisp_Object coordinates, window; | |
| 438 { | |
| 439 int x, y; | |
| 440 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
441 CHECK_LIVE_WINDOW (window, 0); |
| 432 | 442 CHECK_CONS (coordinates, 1); |
| 443 x = XINT (Fcar (coordinates)); | |
| 444 y = XINT (Fcdr (coordinates)); | |
| 445 | |
| 446 switch (coordinates_in_window (XWINDOW (window), &x, &y)) | |
| 447 { | |
| 448 case 0: /* NOT in window at all. */ | |
| 449 return Qnil; | |
| 450 | |
| 451 case 1: /* In text part of window. */ | |
| 452 return Fcons (x, y); | |
| 453 | |
| 454 case 2: /* In mode line of window. */ | |
| 455 return Qmode_line; | |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
456 |
| 432 | 457 case 3: /* On right border of window. */ |
| 732 | 458 return Qvertical_line; |
| 432 | 459 |
| 460 default: | |
| 461 abort (); | |
| 462 } | |
| 463 } | |
| 464 | |
| 265 | 465 /* Find the window containing column x, row y, and return it as a |
| 432 | 466 Lisp_Object. If x, y is on the window's modeline, set *part |
| 467 to 1; if it is on the separating line between the window and its | |
| 468 right sibling, set it to 2; otherwise set it to 0. If there is no | |
| 469 window under x, y return nil and leave *part unmodified. */ | |
| 265 | 470 Lisp_Object |
| 769 | 471 window_from_coordinates (frame, x, y, part) |
| 472 FRAME_PTR frame; | |
| 265 | 473 int x, y; |
| 432 | 474 int *part; |
| 265 | 475 { |
| 476 register Lisp_Object tem, first; | |
| 477 | |
| 769 | 478 tem = first = FRAME_SELECTED_WINDOW (frame); |
| 265 | 479 |
| 432 | 480 do |
| 265 | 481 { |
| 482 int found = coordinates_in_window (XWINDOW (tem), &x, &y); | |
| 483 | |
| 484 if (found) | |
| 485 { | |
| 432 | 486 *part = found - 1; |
| 265 | 487 return tem; |
| 488 } | |
| 489 | |
| 432 | 490 tem = Fnext_window (tem, Qt, Qlambda); |
| 265 | 491 } |
| 432 | 492 while (! EQ (tem, first)); |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
493 |
| 432 | 494 return Qnil; |
| 265 | 495 } |
| 496 | |
|
681
026f978690be
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
555
diff
changeset
|
497 DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, |
| 1798 | 498 "Return window containing coordinates X and Y on FRAME.\n\ |
| 769 | 499 If omitted, FRAME defaults to the currently selected frame.\n\ |
| 500 The top left corner of the frame is considered to be row 0,\n\ | |
| 548 | 501 column 0.") |
| 1798 | 502 (x, y, frame) |
| 503 Lisp_Object x, y, frame; | |
| 265 | 504 { |
| 505 int part; | |
| 506 | |
| 769 | 507 if (NILP (frame)) |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
508 XSETFRAME (frame, selected_frame); |
| 432 | 509 else |
| 769 | 510 CHECK_LIVE_FRAME (frame, 2); |
| 1798 | 511 CHECK_NUMBER (x, 0); |
| 512 CHECK_NUMBER (y, 1); | |
| 265 | 513 |
| 769 | 514 return window_from_coordinates (XFRAME (frame), |
| 1798 | 515 XINT (x), XINT (y), |
| 265 | 516 &part); |
| 517 } | |
| 518 | |
| 519 DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | |
| 520 "Return current value of point in WINDOW.\n\ | |
| 521 For a nonselected window, this is the value point would have\n\ | |
| 522 if that window were selected.\n\ | |
| 523 \n\ | |
| 524 Note that, when WINDOW is the selected window and its buffer\n\ | |
| 525 is also currently selected, the value returned is the same as (point).\n\ | |
| 526 It would be more strictly correct to return the `top-level' value\n\ | |
| 527 of point, outside of any save-excursion forms.\n\ | |
| 528 But that is hard to define.") | |
| 529 (window) | |
| 530 Lisp_Object window; | |
| 531 { | |
| 532 register struct window *w = decode_window (window); | |
| 533 | |
| 534 if (w == XWINDOW (selected_window) | |
| 535 && current_buffer == XBUFFER (w->buffer)) | |
| 536 return Fpoint (); | |
| 537 return Fmarker_position (w->pointm); | |
| 538 } | |
| 539 | |
| 540 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
|
541 "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
|
542 This is updated by redisplay or by calling `set-window-start'.") |
| 265 | 543 (window) |
| 544 Lisp_Object window; | |
| 545 { | |
| 546 return Fmarker_position (decode_window (window)->start); | |
| 547 } | |
| 548 | |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
549 /* 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
|
550 |
|
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
551 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
|
552 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
|
553 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
|
554 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
|
555 (save-excursion\n\ |
|
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
556 (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
|
557 (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
|
558 (point))") */ |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
559 |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
560 DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 1, 0, |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
561 "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
|
562 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
|
563 Simply changing the buffer text or setting `window-start'\n\ |
|
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
564 does not update this value.") |
| 265 | 565 (window) |
| 566 Lisp_Object window; | |
| 567 { | |
| 568 Lisp_Object value; | |
| 569 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
|
570 Lisp_Object buf; |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
571 |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
572 buf = w->buffer; |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
573 CHECK_BUFFER (buf, 0); |
|
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
574 |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
575 #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
|
576 /* 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
|
577 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
|
578 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
|
579 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
|
580 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
|
581 return Qnil; |
|
8508
6d2f0901efe9
(Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8492
diff
changeset
|
582 #endif |
|
8492
865daa7a9faf
(Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents:
8486
diff
changeset
|
583 |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
584 XSETINT (value, |
|
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
585 BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); |
| 265 | 586 |
| 587 return value; | |
| 588 } | |
| 589 | |
| 590 DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, | |
| 591 "Make point value in WINDOW be at position POS in WINDOW's buffer.") | |
| 592 (window, pos) | |
| 593 Lisp_Object window, pos; | |
| 594 { | |
| 595 register struct window *w = decode_window (window); | |
| 596 | |
| 597 CHECK_NUMBER_COERCE_MARKER (pos, 1); | |
| 598 if (w == XWINDOW (selected_window)) | |
| 599 Fgoto_char (pos); | |
| 600 else | |
| 601 set_marker_restricted (w->pointm, pos, w->buffer); | |
| 602 | |
| 603 return pos; | |
| 604 } | |
| 605 | |
| 606 DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, | |
| 607 "Make display in WINDOW start at position POS in WINDOW's buffer.\n\ | |
| 608 Optional third arg NOFORCE non-nil inhibits next redisplay\n\ | |
| 609 from overriding motion of point in order to display at this exact start.") | |
| 610 (window, pos, noforce) | |
| 611 Lisp_Object window, pos, noforce; | |
| 612 { | |
| 613 register struct window *w = decode_window (window); | |
| 614 | |
| 615 CHECK_NUMBER_COERCE_MARKER (pos, 1); | |
| 616 set_marker_restricted (w->start, pos, w->buffer); | |
| 617 /* this is not right, but much easier than doing what is right. */ | |
| 618 w->start_at_line_beg = Qnil; | |
| 485 | 619 if (NILP (noforce)) |
| 265 | 620 w->force_start = Qt; |
| 621 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
|
622 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
|
623 XSETFASTINT (w->last_overlay_modified, 0); |
| 338 | 624 if (!EQ (window, selected_window)) |
| 625 windows_or_buffers_changed++; | |
| 265 | 626 return pos; |
| 627 } | |
| 628 | |
| 629 DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | |
| 630 1, 1, 0, | |
| 631 "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
|
632 See also `set-window-dedicated-p'.") |
| 265 | 633 (window) |
| 634 Lisp_Object window; | |
| 635 { | |
| 636 return decode_window (window)->dedicated; | |
| 637 } | |
| 638 | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
639 DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
640 Sset_window_dedicated_p, 2, 2, 0, |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
641 "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
|
642 If it is dedicated, Emacs will not automatically change\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
643 which buffer appears in it.\n\ |
|
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
644 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
|
645 non-nil means yes.") |
| 265 | 646 (window, arg) |
| 647 Lisp_Object window, arg; | |
| 648 { | |
| 649 register struct window *w = decode_window (window); | |
| 650 | |
| 485 | 651 if (NILP (arg)) |
| 265 | 652 w->dedicated = Qnil; |
| 653 else | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
654 w->dedicated = Qt; |
| 265 | 655 |
| 656 return w->dedicated; | |
| 657 } | |
| 658 | |
| 659 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, | |
| 660 0, 1, 0, | |
| 661 "Return the display-table that WINDOW is using.") | |
| 662 (window) | |
| 663 Lisp_Object window; | |
| 664 { | |
| 665 return decode_window (window)->display_table; | |
| 666 } | |
| 667 | |
| 668 /* Get the display table for use currently on window W. | |
| 669 This is either W's display table or W's buffer's display table. | |
| 670 Ignore the specified tables if they are not valid; | |
| 671 if no valid table is specified, return 0. */ | |
| 672 | |
|
13187
1a4cee562d33
(window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents:
13126
diff
changeset
|
673 struct Lisp_Char_Table * |
| 265 | 674 window_display_table (w) |
| 675 struct window *w; | |
| 676 { | |
| 677 Lisp_Object tem; | |
| 678 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
|
679 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
|
680 return XCHAR_TABLE (tem); |
| 265 | 681 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
|
682 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
|
683 return XCHAR_TABLE (tem); |
| 265 | 684 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
|
685 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
|
686 return XCHAR_TABLE (tem); |
| 265 | 687 return 0; |
| 688 } | |
| 689 | |
| 555 | 690 DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, |
| 265 | 691 "Set WINDOW's display-table to TABLE.") |
| 692 (window, table) | |
| 693 register Lisp_Object window, table; | |
| 694 { | |
| 695 register struct window *w; | |
| 696 register Lisp_Object z; /* Return value. */ | |
| 697 | |
| 698 w = decode_window (window); | |
| 699 w->display_table = table; | |
| 700 return table; | |
| 701 } | |
| 702 | |
| 703 /* Record info on buffer window w is displaying | |
| 704 when it is about to cease to display that buffer. */ | |
| 705 static | |
| 706 unshow_buffer (w) | |
| 707 register struct window *w; | |
| 708 { | |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
709 Lisp_Object buf; |
|
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
710 |
|
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
711 buf = w->buffer; |
| 265 | 712 if (XBUFFER (buf) != XMARKER (w->pointm)->buffer) |
| 713 abort (); | |
| 714 | |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
715 if (w == XWINDOW (XBUFFER (buf)->last_selected_window)) |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
716 XBUFFER (buf)->last_selected_window = Qnil; |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
717 |
|
5990
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
718 #if 0 |
| 265 | 719 if (w == XWINDOW (selected_window) |
| 720 || ! EQ (buf, XWINDOW (selected_window)->buffer)) | |
| 721 /* Do this except when the selected window's buffer | |
| 722 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
|
723 #endif |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
724 /* 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
|
725 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
|
726 Now that this statement is unconditional, |
|
936d4a988148
(unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents:
5988
diff
changeset
|
727 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
|
728 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
|
729 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
|
730 Some people might say that might be a good thing. Let's see. */ |
| 265 | 731 XBUFFER (buf)->last_window_start = marker_position (w->start); |
| 732 | |
| 733 /* Point in the selected window's buffer | |
| 734 is actually stored in that buffer, and the window's pointm isn't used. | |
| 735 So don't clobber point in that buffer. */ | |
| 736 if (! EQ (buf, XWINDOW (selected_window)->buffer)) | |
| 737 BUF_PT (XBUFFER (buf)) | |
| 738 = clip_to_bounds (BUF_BEGV (XBUFFER (buf)), | |
| 739 marker_position (w->pointm), | |
| 740 BUF_ZV (XBUFFER (buf))); | |
| 741 } | |
| 742 | |
| 743 /* Put replacement into the window structure in place of old. */ | |
| 744 static | |
| 745 replace_window (old, replacement) | |
| 746 Lisp_Object old, replacement; | |
| 747 { | |
| 748 register Lisp_Object tem; | |
| 749 register struct window *o = XWINDOW (old), *p = XWINDOW (replacement); | |
| 750 | |
| 769 | 751 /* If OLD is its frame's root_window, then replacement is the new |
| 752 root_window for that frame. */ | |
| 265 | 753 |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
754 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) |
| 769 | 755 FRAME_ROOT_WINDOW (XFRAME (o->frame)) = replacement; |
| 265 | 756 |
| 757 p->left = o->left; | |
| 758 p->top = o->top; | |
| 759 p->width = o->width; | |
| 760 p->height = o->height; | |
| 761 | |
| 762 p->next = tem = o->next; | |
| 485 | 763 if (!NILP (tem)) |
| 265 | 764 XWINDOW (tem)->prev = replacement; |
| 765 | |
| 766 p->prev = tem = o->prev; | |
| 485 | 767 if (!NILP (tem)) |
| 265 | 768 XWINDOW (tem)->next = replacement; |
| 769 | |
| 770 p->parent = tem = o->parent; | |
| 485 | 771 if (!NILP (tem)) |
| 265 | 772 { |
| 773 if (EQ (XWINDOW (tem)->vchild, old)) | |
| 774 XWINDOW (tem)->vchild = replacement; | |
| 775 if (EQ (XWINDOW (tem)->hchild, old)) | |
| 776 XWINDOW (tem)->hchild = replacement; | |
| 777 } | |
| 778 | |
| 779 /*** Here, if replacement is a vertical combination | |
| 780 and so is its new parent, we should make replacement's | |
| 781 children be children of that parent instead. ***/ | |
| 782 } | |
| 783 | |
| 784 DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "", | |
| 785 "Remove WINDOW from the display. Default is selected window.") | |
| 786 (window) | |
| 787 register Lisp_Object window; | |
| 788 { | |
| 789 register Lisp_Object tem, parent, sib; | |
| 790 register struct window *p; | |
| 791 register struct window *par; | |
| 792 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
793 /* 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
|
794 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
|
795 so we can't decode_window here. */ |
| 485 | 796 if (NILP (window)) |
| 265 | 797 window = selected_window; |
| 798 else | |
| 799 CHECK_WINDOW (window, 0); | |
| 800 p = XWINDOW (window); | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
801 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
802 /* 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
|
803 if (NILP (p->buffer) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
804 && NILP (p->hchild) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
805 && NILP (p->vchild)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
806 return Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
807 |
| 265 | 808 parent = p->parent; |
| 485 | 809 if (NILP (parent)) |
| 265 | 810 error ("Attempt to delete minibuffer or sole ordinary window"); |
| 811 par = XWINDOW (parent); | |
| 812 | |
| 813 windows_or_buffers_changed++; | |
|
10666
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
814 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (p))) = 1; |
| 265 | 815 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
816 /* 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
|
817 { |
|
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
818 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
|
819 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
820 /* 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
|
821 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
|
822 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
|
823 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
|
824 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
|
825 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
826 while (!NILP (pwindow)) |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
827 { |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
828 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
|
829 break; |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
830 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
|
831 } |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
832 |
|
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
833 if (EQ (window, pwindow)) |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
834 { |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
835 Lisp_Object alternative; |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
836 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
|
837 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
838 /* 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
|
839 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
|
840 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
|
841 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
|
842 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
|
843 if (EQ (window, selected_window)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
844 Fselect_window (alternative); |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
845 else |
|
3723
ccb9c93aac80
(Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3688
diff
changeset
|
846 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
|
847 } |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
848 } |
| 265 | 849 |
| 850 tem = p->buffer; | |
| 851 /* tem is null for dummy parent windows | |
| 852 (which have inferiors but not any contents themselves) */ | |
| 485 | 853 if (!NILP (tem)) |
| 265 | 854 { |
| 855 unshow_buffer (p); | |
| 856 unchain_marker (p->pointm); | |
| 857 unchain_marker (p->start); | |
| 858 } | |
| 859 | |
| 860 tem = p->next; | |
| 485 | 861 if (!NILP (tem)) |
| 265 | 862 XWINDOW (tem)->prev = p->prev; |
| 863 | |
| 864 tem = p->prev; | |
| 485 | 865 if (!NILP (tem)) |
| 265 | 866 XWINDOW (tem)->next = p->next; |
| 867 | |
| 868 if (EQ (window, par->hchild)) | |
| 869 par->hchild = p->next; | |
| 870 if (EQ (window, par->vchild)) | |
| 871 par->vchild = p->next; | |
| 872 | |
| 873 /* Find one of our siblings to give our space to. */ | |
| 874 sib = p->prev; | |
| 485 | 875 if (NILP (sib)) |
| 265 | 876 { |
| 877 /* If p gives its space to its next sibling, that sibling needs | |
| 878 to have its top/left side pulled back to where p's is. | |
| 879 set_window_{height,width} will re-position the sibling's | |
| 880 children. */ | |
| 881 sib = p->next; | |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
882 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
|
883 XWINDOW (sib)->left = p->left; |
| 265 | 884 } |
| 885 | |
| 886 /* Stretch that sibling. */ | |
| 485 | 887 if (!NILP (par->vchild)) |
| 265 | 888 set_window_height (sib, |
| 889 XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height), | |
| 890 1); | |
| 485 | 891 if (!NILP (par->hchild)) |
| 265 | 892 set_window_width (sib, |
| 893 XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width), | |
| 894 1); | |
| 895 | |
| 896 /* If parent now has only one child, | |
| 897 put the child into the parent's place. */ | |
| 898 tem = par->hchild; | |
| 485 | 899 if (NILP (tem)) |
| 265 | 900 tem = par->vchild; |
| 485 | 901 if (NILP (XWINDOW (tem)->next)) |
| 265 | 902 replace_window (parent, tem); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
903 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
904 /* 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
|
905 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
|
906 if (! NILP (p->hchild)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
907 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
|
908 else if (! NILP (p->vchild)) |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
909 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
|
910 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
911 /* Mark this window as deleted. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
912 p->buffer = p->hchild = p->vchild = Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
913 |
| 265 | 914 return Qnil; |
| 915 } | |
| 916 | |
| 432 | 917 |
| 769 | 918 extern Lisp_Object next_frame (), prev_frame (); |
| 432 | 919 |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
920 /* 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
|
921 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
|
922 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
|
923 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
924 DEFUN ("next-window", Ffoo, Sfoo, 0, 3, 0, |
| 432 | 925 "Return next window after WINDOW in canonical ordering of windows.\n\ |
| 926 If omitted, WINDOW defaults to the selected window.\n\ | |
| 927 \n\ | |
| 928 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
| 929 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
| 930 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
| 931 minibuffer even if it is active.\n\ | |
| 932 \n\ | |
| 769 | 933 Several frames may share a single minibuffer; if the minibuffer\n\ |
| 934 counts, all windows on all frames that share that minibuffer count\n\ | |
| 8139 | 935 too. Therefore, `next-window' can be used to iterate through the\n\ |
| 769 | 936 set of windows even when the minibuffer is on another frame. If the\n\ |
| 937 minibuffer does not count, only windows from WINDOW's frame count.\n\ | |
| 432 | 938 \n\ |
| 769 | 939 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
| 940 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
|
941 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
|
942 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
|
943 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
|
944 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
|
945 \n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
946 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
|
947 `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
|
948 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
|
949 `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
|
950 (window, minibuf, all_frames) */ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
951 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
952 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
|
953 0) |
| 769 | 954 (window, minibuf, all_frames) |
| 955 register Lisp_Object window, minibuf, all_frames; | |
| 265 | 956 { |
| 432 | 957 register Lisp_Object tem; |
| 958 Lisp_Object start_window; | |
| 265 | 959 |
| 485 | 960 if (NILP (window)) |
| 432 | 961 window = selected_window; |
| 962 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
963 CHECK_LIVE_WINDOW (window, 0); |
| 432 | 964 |
| 965 start_window = window; | |
| 966 | |
| 967 /* minibuf == nil may or may not include minibuffers. | |
| 968 Decide if it does. */ | |
| 485 | 969 if (NILP (minibuf)) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
970 minibuf = (minibuf_level ? minibuf_window : Qlambda); |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
971 else if (! EQ (minibuf, Qt)) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
972 minibuf = Qlambda; |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
973 /* 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
|
974 lambda => count none of them, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
975 or a specific minibuffer window (the active one) to count. */ |
| 432 | 976 |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
977 /* all_frames == nil doesn't specify which frames to include. */ |
| 769 | 978 if (NILP (all_frames)) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
979 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
|
980 ? (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
|
981 (XFRAME |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
982 (WINDOW_FRAME |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
983 (XWINDOW (window))))) |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
984 : Qnil); |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
985 else if (EQ (all_frames, Qvisible)) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
986 ; |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
987 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
|
988 ; |
|
11307
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
989 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
|
990 /* 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
|
991 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
|
992 return Fframe_first_window (all_frames); |
| 769 | 993 else if (! EQ (all_frames, Qt)) |
| 994 all_frames = Qnil; | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
995 /* 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
|
996 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
|
997 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
|
998 0 meaning search visible and iconified frames, |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
999 or a window, meaning search the frame that window belongs to. */ |
| 432 | 1000 |
| 265 | 1001 /* Do this loop at least once, to get the next window, and perhaps |
| 1002 again, if we hit the minibuffer and that is not acceptable. */ | |
| 1003 do | |
| 1004 { | |
| 1005 /* Find a window that actually has a next one. This loop | |
| 1006 climbs up the tree. */ | |
| 485 | 1007 while (tem = XWINDOW (window)->next, NILP (tem)) |
| 1008 if (tem = XWINDOW (window)->parent, !NILP (tem)) | |
| 265 | 1009 window = tem; |
| 432 | 1010 else |
| 265 | 1011 { |
| 769 | 1012 /* We've reached the end of this frame. |
| 1013 Which other frames are acceptable? */ | |
| 1014 tem = WINDOW_FRAME (XWINDOW (window)); | |
| 1015 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
|
1016 { |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1017 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
|
1018 |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1019 tem1 = tem; |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1020 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
|
1021 /* 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
|
1022 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
|
1023 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
|
1024 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
|
1025 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
|
1026 if (EQ (tem, tem1)) |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
1027 XSETFRAME (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
|
1028 } |
| 769 | 1029 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); |
| 432 | 1030 |
| 265 | 1031 break; |
| 1032 } | |
| 1033 | |
| 1034 window = tem; | |
| 432 | 1035 |
| 265 | 1036 /* If we're in a combination window, find its first child and |
| 1037 recurse on that. Otherwise, we've found the window we want. */ | |
| 1038 while (1) | |
| 1039 { | |
| 485 | 1040 if (!NILP (XWINDOW (window)->hchild)) |
| 265 | 1041 window = XWINDOW (window)->hchild; |
| 485 | 1042 else if (!NILP (XWINDOW (window)->vchild)) |
| 265 | 1043 window = XWINDOW (window)->vchild; |
| 1044 else break; | |
| 1045 } | |
| 1046 } | |
|
13946
b7670a09033c
(Fprevious_window, Fwindow_configuration_p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13918
diff
changeset
|
1047 /* Which windows are acceptable? |
| 432 | 1048 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
|
1049 this isn't a minibuffer window, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1050 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
|
1051 or this is the active minibuffer and we are accepting that one, or |
| 432 | 1052 we've come all the way around and we're back at the original window. */ |
| 265 | 1053 while (MINI_WINDOW_P (XWINDOW (window)) |
| 432 | 1054 && ! EQ (minibuf, Qt) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1055 && ! EQ (minibuf, window) |
|
1525
f79a22ad87d0
* window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents:
1444
diff
changeset
|
1056 && ! EQ (window, start_window)); |
| 265 | 1057 |
| 1058 return window; | |
| 1059 } | |
| 1060 | |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1061 /* 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
|
1062 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
|
1063 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
|
1064 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1065 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
|
1066 "Return the window preceding WINDOW in canonical ordering of windows.\n\ |
| 432 | 1067 If omitted, WINDOW defaults to the selected window.\n\ |
| 1068 \n\ | |
| 1069 Optional second arg MINIBUF t means count the minibuffer window even\n\ | |
| 1070 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | |
| 1071 it is active. MINIBUF neither t nor nil means not to count the\n\ | |
| 1072 minibuffer even if it is active.\n\ | |
| 1073 \n\ | |
| 769 | 1074 Several frames may share a single minibuffer; if the minibuffer\n\ |
| 1075 counts, all windows on all frames that share that minibuffer count\n\ | |
| 8139 | 1076 too. Therefore, `previous-window' can be used to iterate through\n\ |
| 769 | 1077 the set of windows even when the minibuffer is on another frame. If\n\ |
| 8139 | 1078 the minibuffer does not count, only windows from WINDOW's frame count\n\ |
| 432 | 1079 \n\ |
| 769 | 1080 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
| 1081 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
|
1082 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
|
1083 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
|
1084 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
|
1085 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
|
1086 \n\ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1087 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
|
1088 `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
|
1089 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
|
1090 `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
|
1091 (window, minibuf, all_frames) */ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1092 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1093 |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1094 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
|
1095 0) |
| 769 | 1096 (window, minibuf, all_frames) |
| 1097 register Lisp_Object window, minibuf, all_frames; | |
| 265 | 1098 { |
| 1099 register Lisp_Object tem; | |
| 432 | 1100 Lisp_Object start_window; |
| 265 | 1101 |
| 485 | 1102 if (NILP (window)) |
| 265 | 1103 window = selected_window; |
| 1104 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1105 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 1106 |
| 432 | 1107 start_window = window; |
| 265 | 1108 |
| 432 | 1109 /* minibuf == nil may or may not include minibuffers. |
| 1110 Decide if it does. */ | |
| 485 | 1111 if (NILP (minibuf)) |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1112 minibuf = (minibuf_level ? minibuf_window : Qlambda); |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1113 else if (! EQ (minibuf, Qt)) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1114 minibuf = Qlambda; |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1115 /* 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
|
1116 lambda => count none of them, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1117 or a specific minibuffer window (the active one) to count. */ |
| 265 | 1118 |
| 769 | 1119 /* all_frames == nil doesn't specify which frames to include. |
| 1120 Decide which frames it includes. */ | |
| 1121 if (NILP (all_frames)) | |
|
12643
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1122 all_frames = (! EQ (minibuf, Qlambda) |
| 769 | 1123 ? (FRAME_MINIBUF_WINDOW |
| 1124 (XFRAME | |
| 1125 (WINDOW_FRAME | |
| 432 | 1126 (XWINDOW (window))))) |
| 1127 : Qnil); | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1128 else if (EQ (all_frames, Qvisible)) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1129 ; |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1130 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
|
1131 ; |
|
11307
f6b6a67ff758
(Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1132 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
|
1133 /* 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
|
1134 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
|
1135 return Fframe_first_window (all_frames); |
| 769 | 1136 else if (! EQ (all_frames, Qt)) |
| 1137 all_frames = Qnil; | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1138 /* 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
|
1139 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
|
1140 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
|
1141 0 meaning search visible and iconified frames, |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1142 or a window, meaning search the frame that window belongs to. */ |
| 265 | 1143 |
| 1144 /* Do this loop at least once, to get the previous window, and perhaps | |
| 1145 again, if we hit the minibuffer and that is not acceptable. */ | |
| 1146 do | |
| 1147 { | |
| 1148 /* Find a window that actually has a previous one. This loop | |
| 1149 climbs up the tree. */ | |
| 485 | 1150 while (tem = XWINDOW (window)->prev, NILP (tem)) |
| 1151 if (tem = XWINDOW (window)->parent, !NILP (tem)) | |
| 265 | 1152 window = tem; |
| 432 | 1153 else |
| 265 | 1154 { |
| 769 | 1155 /* We have found the top window on the frame. |
| 1156 Which frames are acceptable? */ | |
| 1157 tem = WINDOW_FRAME (XWINDOW (window)); | |
| 1158 if (! NILP (all_frames)) | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1159 /* 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
|
1160 rather than next_frame. All the windows acceptable |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1161 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
|
1162 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
|
1163 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
|
1164 then Fnext_window and Fprevious_window take different |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1165 paths through the set of acceptable windows. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1166 window_loop assumes that these `ring' requirement are |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
1167 met. */ |
|
8323
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1168 { |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1169 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
|
1170 |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1171 tem1 = tem; |
|
30755be9badb
(Fnext_window, Fprevious_window): Don't get stuck in a loop
Richard M. Stallman <rms@gnu.org>
parents:
8263
diff
changeset
|
1172 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
|
1173 /* 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
|
1174 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
|
1175 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
|
1176 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
|
1177 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
|
1178 if (EQ (tem, tem1)) |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
1179 XSETFRAME (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
|
1180 } |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1181 /* 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
|
1182 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
|
1183 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
|
1184 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
|
1185 else |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
1186 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); |
| 432 | 1187 |
| 265 | 1188 break; |
| 1189 } | |
| 1190 | |
| 1191 window = tem; | |
| 1192 /* If we're in a combination window, find its last child and | |
| 1193 recurse on that. Otherwise, we've found the window we want. */ | |
| 1194 while (1) | |
| 1195 { | |
| 485 | 1196 if (!NILP (XWINDOW (window)->hchild)) |
| 265 | 1197 window = XWINDOW (window)->hchild; |
| 485 | 1198 else if (!NILP (XWINDOW (window)->vchild)) |
| 265 | 1199 window = XWINDOW (window)->vchild; |
| 1200 else break; | |
| 485 | 1201 while (tem = XWINDOW (window)->next, !NILP (tem)) |
| 265 | 1202 window = tem; |
| 1203 } | |
| 1204 } | |
|
13946
b7670a09033c
(Fprevious_window, Fwindow_configuration_p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13918
diff
changeset
|
1205 /* Which windows are acceptable? |
| 432 | 1206 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
|
1207 this isn't a minibuffer window, |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1208 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
|
1209 or this is the active minibuffer and we are accepting that one, or |
| 432 | 1210 we've come all the way around and we're back at the original window. */ |
| 265 | 1211 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
|
1212 && ! EQ (minibuf, Qt) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1213 && ! EQ (minibuf, window) |
|
45ada337053e
(Fprevious_window, Fnext_window): When minibuf = nil,
Richard M. Stallman <rms@gnu.org>
parents:
12597
diff
changeset
|
1214 && ! EQ (window, start_window)); |
| 265 | 1215 |
| 1216 return window; | |
| 1217 } | |
| 1218 | |
| 338 | 1219 DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", |
| 769 | 1220 "Select the ARG'th different window on this frame.\n\ |
| 1221 All windows on current frame are arranged in a cyclic order.\n\ | |
| 265 | 1222 This command selects the window ARG steps away in that order.\n\ |
| 1223 A negative ARG moves in the opposite order. If the optional second\n\ | |
| 769 | 1224 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
|
1225 (arg, all_frames) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1226 register Lisp_Object arg, all_frames; |
| 265 | 1227 { |
| 1228 register int i; | |
| 1229 register Lisp_Object w; | |
| 1230 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1231 CHECK_NUMBER (arg, 0); |
| 265 | 1232 w = selected_window; |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
1233 i = XINT (arg); |
| 265 | 1234 |
| 1235 while (i > 0) | |
| 1236 { | |
| 769 | 1237 w = Fnext_window (w, Qnil, all_frames); |
| 265 | 1238 i--; |
| 1239 } | |
| 1240 while (i < 0) | |
| 1241 { | |
| 769 | 1242 w = Fprevious_window (w, Qnil, all_frames); |
| 265 | 1243 i++; |
| 1244 } | |
| 1245 Fselect_window (w); | |
| 1246 return Qnil; | |
| 1247 } | |
| 1248 | |
| 1249 /* Look at all windows, performing an operation specified by TYPE | |
| 1250 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
|
1251 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
|
1252 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
|
1253 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
|
1254 a frame, just look at windows on that frame. |
| 265 | 1255 If MINI is non-zero, perform the operation on minibuffer windows too. |
| 1256 */ | |
| 1257 | |
| 1258 enum window_loop | |
| 1259 { | |
| 1260 WINDOW_LOOP_UNUSED, | |
| 1261 GET_BUFFER_WINDOW, /* Arg is buffer */ | |
| 1262 GET_LRU_WINDOW, /* Arg is t for full-width windows only */ | |
| 1263 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ | |
| 1264 DELETE_BUFFER_WINDOWS, /* Arg is buffer */ | |
| 1265 GET_LARGEST_WINDOW, | |
|
4570
eee89de88c9d
(enum window_loop): Delete final comma.
Richard M. Stallman <rms@gnu.org>
parents:
4564
diff
changeset
|
1266 UNSHOW_BUFFER /* Arg is buffer */ |
| 265 | 1267 }; |
| 1268 | |
| 1269 static Lisp_Object | |
| 769 | 1270 window_loop (type, obj, mini, frames) |
| 265 | 1271 enum window_loop type; |
| 769 | 1272 register Lisp_Object obj, frames; |
| 265 | 1273 int mini; |
| 1274 { | |
| 1275 register Lisp_Object w; | |
| 1276 register Lisp_Object best_window; | |
| 1277 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
|
1278 register Lisp_Object last_window; |
| 769 | 1279 FRAME_PTR frame; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1280 Lisp_Object frame_arg; |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1281 frame_arg = Qt; |
| 265 | 1282 |
| 769 | 1283 /* If we're only looping through windows on a particular frame, |
| 1284 frame points to that frame. If we're looping through windows | |
| 1285 on all frames, frame is 0. */ | |
| 1286 if (FRAMEP (frames)) | |
| 1287 frame = XFRAME (frames); | |
| 1288 else if (NILP (frames)) | |
| 1289 frame = selected_frame; | |
| 265 | 1290 else |
| 769 | 1291 frame = 0; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1292 if (frame) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1293 frame_arg = Qlambda; |
|
8167
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1294 else if (XFASTINT (frames) == 0) |
|
ae9b49cc645f
(Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents:
8139
diff
changeset
|
1295 frame_arg = frames; |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1296 else if (EQ (frames, Qvisible)) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1297 frame_arg = frames; |
| 265 | 1298 |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1299 /* 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
|
1300 Qvisible to consider all visible frames, |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1301 or Qt otherwise. */ |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1302 |
| 265 | 1303 /* 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
|
1304 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
|
1305 w = obj; |
| 769 | 1306 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
|
1307 w = FRAME_SELECTED_WINDOW (frame); |
| 265 | 1308 else |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1309 w = FRAME_SELECTED_WINDOW (selected_frame); |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1310 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1311 /* 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
|
1312 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
|
1313 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
|
1314 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1315 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
|
1316 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
|
1317 |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1318 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
|
1319 |
| 265 | 1320 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
|
1321 for (;;) |
| 265 | 1322 { |
|
3785
3455cbb3339d
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3765
diff
changeset
|
1323 FRAME_PTR w_frame = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
|
3455cbb3339d
Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents:
3765
diff
changeset
|
1324 |
| 265 | 1325 /* Pick the next window now, since some operations will delete |
| 1326 the current window. */ | |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1327 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
|
1328 |
|
6268
43853122823f
(window_loop): Delete MULTI_FRAME
Richard M. Stallman <rms@gnu.org>
parents:
6267
diff
changeset
|
1329 /* 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
|
1330 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
|
1331 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
|
1332 if (! MINI_WINDOW_P (XWINDOW (w)) |
| 265 | 1333 || (mini && minibuf_level > 0)) |
| 1334 switch (type) | |
| 1335 { | |
| 1336 case GET_BUFFER_WINDOW: | |
|
16522
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1337 if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj) |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1338 /* Don't find any minibuffer window |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1339 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
|
1340 && (MINI_WINDOW_P (XWINDOW (w)) |
|
63ca7c6ceeff
(window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents:
16485
diff
changeset
|
1341 ? EQ (w, minibuf_window) : 1)) |
| 265 | 1342 return w; |
| 1343 break; | |
| 1344 | |
| 1345 case GET_LRU_WINDOW: | |
| 1346 /* 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
|
1347 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (XWINDOW (w))) |
| 265 | 1348 break; |
| 1349 /* Ignore dedicated windows and minibuffers. */ | |
| 1350 if (MINI_WINDOW_P (XWINDOW (w)) | |
| 485 | 1351 || !NILP (XWINDOW (w)->dedicated)) |
| 265 | 1352 break; |
| 485 | 1353 if (NILP (best_window) |
| 265 | 1354 || (XFASTINT (XWINDOW (best_window)->use_time) |
| 1355 > XFASTINT (XWINDOW (w)->use_time))) | |
| 1356 best_window = w; | |
| 1357 break; | |
| 1358 | |
| 1359 case DELETE_OTHER_WINDOWS: | |
| 1360 if (XWINDOW (w) != XWINDOW (obj)) | |
| 1361 Fdelete_window (w); | |
| 1362 break; | |
| 1363 | |
| 1364 case DELETE_BUFFER_WINDOWS: | |
| 1365 if (EQ (XWINDOW (w)->buffer, obj)) | |
| 1366 { | |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1367 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
|
1368 |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1369 /* 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
|
1370 kill the frame. */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1371 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
|
1372 && !NILP (XWINDOW (w)->dedicated) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1373 && other_visible_frames (f)) |
| 265 | 1374 { |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1375 /* 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
|
1376 There might be one, the minibuffer! */ |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1377 if (! EQ (w, last_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1378 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
|
1379 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1380 /* 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
|
1381 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
|
1382 if (EQ (next_window, last_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1383 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1384 last_window = w; |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1385 break; |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1386 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1387 next_window = Fnext_window (next_window, |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1388 mini ? Qt : Qnil, |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1389 frame_arg); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1390 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1391 /* 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
|
1392 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
| 265 | 1393 } |
| 1394 else | |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1395 /* 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
|
1396 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
|
1397 if (NILP (XWINDOW (w)->parent)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1398 { |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1399 Lisp_Object new_buffer; |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1400 new_buffer = Fother_buffer (obj, Qnil); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1401 if (NILP (new_buffer)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1402 new_buffer |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1403 = Fget_buffer_create (build_string ("*scratch*")); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1404 Fset_window_buffer (w, new_buffer); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1405 if (EQ (w, selected_window)) |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1406 Fset_buffer (XWINDOW (w)->buffer); |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1407 } |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1408 else |
|
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
1409 Fdelete_window (w); |
| 265 | 1410 } |
| 1411 break; | |
| 1412 | |
| 1413 case GET_LARGEST_WINDOW: | |
| 1414 /* Ignore dedicated windows and minibuffers. */ | |
| 1415 if (MINI_WINDOW_P (XWINDOW (w)) | |
| 485 | 1416 || !NILP (XWINDOW (w)->dedicated)) |
| 265 | 1417 break; |
| 1418 { | |
| 1419 struct window *best_window_ptr = XWINDOW (best_window); | |
| 1420 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
|
1421 if (NILP (best_window) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1422 || (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
|
1423 > (XFASTINT (best_window_ptr->height) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
1424 * XFASTINT (best_window_ptr->width)))) |
| 265 | 1425 best_window = w; |
| 1426 } | |
| 1427 break; | |
| 1428 | |
| 1429 case UNSHOW_BUFFER: | |
| 1430 if (EQ (XWINDOW (w)->buffer, obj)) | |
| 1431 { | |
| 1432 /* 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
|
1433 Lisp_Object another_buffer; |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1434 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
1435 another_buffer = Fother_buffer (obj, Qnil); |
| 485 | 1436 if (NILP (another_buffer)) |
| 265 | 1437 another_buffer |
| 1438 = Fget_buffer_create (build_string ("*scratch*")); | |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1439 /* 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
|
1440 kill the frame. */ |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1441 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
|
1442 && !NILP (XWINDOW (w)->dedicated) |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1443 && other_visible_frames (f)) |
|
8536
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1444 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1445 /* Skip the other windows on this frame. |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1446 There might be one, the minibuffer! */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1447 if (! EQ (w, last_window)) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1448 while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window)))) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1449 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1450 /* 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
|
1451 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
|
1452 if (EQ (next_window, last_window)) |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1453 { |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1454 last_window = w; |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1455 break; |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1456 } |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1457 next_window = Fnext_window (next_window, |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1458 mini ? Qt : Qnil, |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1459 frame_arg); |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1460 } |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1461 /* Now we can safely delete the frame. */ |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1462 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
|
b97057eb17d3
(window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents:
8508
diff
changeset
|
1463 } |
|
7647
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1464 else |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1465 { |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1466 /* Otherwise show a different buffer in the window. */ |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1467 XWINDOW (w)->dedicated = Qnil; |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1468 Fset_window_buffer (w, another_buffer); |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1469 if (EQ (w, selected_window)) |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1470 Fset_buffer (XWINDOW (w)->buffer); |
|
d93dff6fbc73
(window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents:
7618
diff
changeset
|
1471 } |
| 265 | 1472 } |
| 1473 break; | |
| 1474 } | |
|
983
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1475 |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1476 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
|
1477 break; |
|
eb19dfaec9c4
* window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents:
972
diff
changeset
|
1478 |
| 265 | 1479 w = next_window; |
| 1480 } | |
| 1481 | |
| 1482 return best_window; | |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
1483 } |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1484 |
| 265 | 1485 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
| 1486 "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
|
1487 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
|
1488 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
|
1489 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
|
1490 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
|
1491 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
|
1492 (frame) |
|
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1493 Lisp_Object frame; |
| 265 | 1494 { |
| 1495 register Lisp_Object w; | |
| 1496 /* 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
|
1497 w = window_loop (GET_LRU_WINDOW, Qt, 0, frame); |
| 485 | 1498 if (!NILP (w) && !EQ (w, selected_window)) |
| 265 | 1499 return w; |
| 1500 /* 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
|
1501 return window_loop (GET_LRU_WINDOW, Qnil, 0, frame); |
| 265 | 1502 } |
| 1503 | |
| 1504 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, | |
| 1505 "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
|
1506 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
|
1507 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
|
1508 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
|
1509 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
|
1510 If FRAME is a frame, search only that frame.") |
| 769 | 1511 (frame) |
| 1512 Lisp_Object frame; | |
| 265 | 1513 { |
| 1514 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, | |
| 769 | 1515 frame); |
| 265 | 1516 } |
| 1517 | |
| 1518 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, | |
| 1519 "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
|
1520 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
|
1521 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
|
1522 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
|
1523 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
|
1524 If FRAME is a frame, search only that frame.") |
| 769 | 1525 (buffer, frame) |
| 1526 Lisp_Object buffer, frame; | |
| 265 | 1527 { |
| 1528 buffer = Fget_buffer (buffer); | |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
1529 if (BUFFERP (buffer)) |
| 769 | 1530 return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame); |
| 265 | 1531 else |
| 1532 return Qnil; | |
| 1533 } | |
| 1534 | |
| 1535 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows, | |
| 1536 0, 1, "", | |
| 769 | 1537 "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
|
1538 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
|
1539 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
|
1540 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
|
1541 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
|
1542 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
|
1543 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
|
1544 value is reasonable when this function is called.") |
| 265 | 1545 (window) |
| 1546 Lisp_Object window; | |
| 1547 { | |
| 1548 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
|
1549 int startpos; |
| 265 | 1550 int top; |
| 1551 | |
| 485 | 1552 if (NILP (window)) |
| 265 | 1553 window = selected_window; |
| 1554 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1555 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 1556 |
| 1557 w = XWINDOW (window); | |
|
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1558 |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1559 startpos = marker_position (w->start); |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1560 top = XFASTINT (w->top) - FRAME_MENU_BAR_LINES (XFRAME (WINDOW_FRAME (w))); |
| 265 | 1561 |
|
9028
74119e5602eb
(Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents:
8991
diff
changeset
|
1562 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
|
1563 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
|
1564 |
|
2190
482c7827b968
(Fdelete_other_windows): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
1565 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); |
| 265 | 1566 |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1567 /* 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
|
1568 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
|
1569 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
|
1570 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
|
1571 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
|
1572 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
|
1573 && 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
|
1574 { |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1575 struct position pos; |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1576 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
|
1577 |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1578 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
|
1579 /* 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
|
1580 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
|
1581 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
|
1582 |
|
7348
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1583 Fset_marker (w->start, make_number (pos.bufpos), w->buffer); |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1584 w->start_at_line_beg = ((pos.bufpos == BEGV |
|
17019
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
1585 || FETCH_BYTE (pos.bufpos - 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
|
1586 : Qnil); |
|
13198
43d90596da34
(Fdelete_other_windows): Set w->force_start.
Richard M. Stallman <rms@gnu.org>
parents:
13187
diff
changeset
|
1587 /* 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
|
1588 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
|
1589 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
|
1590 |
|
99b9c9068761
(Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents:
7347
diff
changeset
|
1591 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
|
1592 } |
| 265 | 1593 return Qnil; |
| 1594 } | |
| 1595 | |
| 1596 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
|
1597 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
|
1598 "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
|
1599 Optional second argument FRAME controls which frames are affected.\n\ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1600 If nil or omitted, delete all windows showing BUFFER in any frame.\n\ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1601 If t, delete only windows showing BUFFER in the selected frame.\n\ |
|
6247
22d4037cbce2
(Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents:
6242
diff
changeset
|
1602 If `visible', delete all windows showing BUFFER in any visible frame.\n\ |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1603 If a frame, delete only windows showing BUFFER in that frame.") |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1604 (buffer, frame) |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1605 Lisp_Object buffer, frame; |
| 265 | 1606 { |
|
4145
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1607 /* 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
|
1608 expects. */ |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1609 if (! FRAMEP (frame)) |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1610 frame = NILP (frame) ? Qt : Qnil; |
|
a0b726903a1f
* window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents:
3803
diff
changeset
|
1611 |
| 485 | 1612 if (!NILP (buffer)) |
| 265 | 1613 { |
| 1614 buffer = Fget_buffer (buffer); | |
| 1615 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
|
1616 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame); |
| 265 | 1617 } |
| 1618 return Qnil; | |
| 1619 } | |
| 1620 | |
| 1621 DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows, | |
| 1622 Sreplace_buffer_in_windows, | |
| 1623 1, 1, "bReplace buffer in windows: ", | |
| 1624 "Replace BUFFER with some other buffer in all windows showing it.") | |
| 1625 (buffer) | |
| 1626 Lisp_Object buffer; | |
| 1627 { | |
| 485 | 1628 if (!NILP (buffer)) |
| 265 | 1629 { |
| 1630 buffer = Fget_buffer (buffer); | |
| 1631 CHECK_BUFFER (buffer, 0); | |
| 1632 window_loop (UNSHOW_BUFFER, buffer, 0, Qt); | |
| 1633 } | |
| 1634 return Qnil; | |
| 1635 } | |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1636 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1637 /* 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
|
1638 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
|
1639 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1640 void |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1641 replace_buffer_in_all_windows (buffer) |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1642 Lisp_Object buffer; |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1643 { |
|
14204
c0b44d3a8312
(replace_buffer_in_all_windows): Don't change selected
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1644 #ifdef MULTI_KBOARD |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1645 Lisp_Object tail, frame; |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1646 |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1647 /* 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
|
1648 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
|
1649 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
|
1650 FOR_EACH_FRAME (tail, frame) |
|
14204
c0b44d3a8312
(replace_buffer_in_all_windows): Don't change selected
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1651 window_loop (UNSHOW_BUFFER, buffer, 0, frame); |
|
13918
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1652 #else |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1653 window_loop (UNSHOW_BUFFER, buffer, 0, Qt); |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1654 #endif |
|
2f6eaea659da
(replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13780
diff
changeset
|
1655 } |
| 265 | 1656 |
| 1657 /* 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
|
1658 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1659 /* 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
|
1660 might crash Emacs. */ |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1661 #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
|
1662 #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
|
1663 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1664 /* 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
|
1665 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
|
1666 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1667 static void |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1668 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
|
1669 { |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1670 /* 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
|
1671 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
|
1672 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
|
1673 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
|
1674 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
|
1675 } |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1676 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1677 /* 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
|
1678 minimum allowable size. */ |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1679 void |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1680 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
|
1681 FRAME_PTR frame; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1682 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
|
1683 { |
|
4347
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
1684 /* 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
|
1685 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
|
1686 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
|
1687 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
|
1688 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
|
1689 (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
|
1690 : (! 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
|
1691 : 2 * MIN_SAFE_WINDOW_HEIGHT - 1); |
|
4347
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
1692 if (FRAME_MENU_BAR_LINES (frame) > 0) |
|
d6b289b1a6dc
* window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents:
4292
diff
changeset
|
1693 min_height += FRAME_MENU_BAR_LINES (frame); |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1694 |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1695 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
|
1696 *rows = min_height; |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1697 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
|
1698 *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
|
1699 } |
|
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1700 |
| 265 | 1701 /* Normally the window is deleted if it gets too small. |
| 1702 nodelete nonzero means do not do this. | |
| 1703 (The caller should check later and do so if appropriate) */ | |
| 1704 | |
| 1705 set_window_height (window, height, nodelete) | |
| 1706 Lisp_Object window; | |
| 1707 int height; | |
| 1708 int nodelete; | |
| 1709 { | |
| 1710 register struct window *w = XWINDOW (window); | |
| 1711 register struct window *c; | |
| 1712 int oheight = XFASTINT (w->height); | |
| 1713 int top, pos, lastbot, opos, lastobot; | |
| 1714 Lisp_Object child; | |
| 1715 | |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
1716 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
|
1717 |
| 265 | 1718 if (!nodelete |
| 485 | 1719 && ! NILP (w->parent) |
| 265 | 1720 && height < window_min_height) |
| 1721 { | |
| 1722 Fdelete_window (window); | |
| 1723 return; | |
| 1724 } | |
| 1725 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1726 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
|
1727 XSETFASTINT (w->last_overlay_modified, 0); |
| 265 | 1728 windows_or_buffers_changed++; |
|
10666
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
1729 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1; |
|
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
1730 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1731 XSETFASTINT (w->height, height); |
| 485 | 1732 if (!NILP (w->hchild)) |
| 265 | 1733 { |
| 485 | 1734 for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next) |
| 265 | 1735 { |
| 1736 XWINDOW (child)->top = w->top; | |
| 1737 set_window_height (child, height, nodelete); | |
| 1738 } | |
| 1739 } | |
| 485 | 1740 else if (!NILP (w->vchild)) |
| 265 | 1741 { |
| 1742 lastbot = top = XFASTINT (w->top); | |
| 1743 lastobot = 0; | |
| 485 | 1744 for (child = w->vchild; !NILP (child); child = c->next) |
| 265 | 1745 { |
| 1746 c = XWINDOW (child); | |
| 1747 | |
| 1748 opos = lastobot + XFASTINT (c->height); | |
| 1749 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1750 XSETFASTINT (c->top, lastbot); |
| 265 | 1751 |
| 1752 pos = (((opos * height) << 1) + oheight) / (oheight << 1); | |
| 1753 | |
| 1754 /* Avoid confusion: inhibit deletion of child if becomes too small */ | |
| 1755 set_window_height (child, pos + top - lastbot, 1); | |
| 1756 | |
| 1757 /* Now advance child to next window, | |
| 1758 and set lastbot if child was not just deleted. */ | |
| 1759 lastbot = pos + top; | |
| 1760 lastobot = opos; | |
| 1761 } | |
| 1762 /* Now delete any children that became too small. */ | |
| 1763 if (!nodelete) | |
| 485 | 1764 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) |
| 265 | 1765 { |
| 1766 set_window_height (child, XINT (XWINDOW (child)->height), 0); | |
| 1767 } | |
| 1768 } | |
| 1769 } | |
| 1770 | |
| 1771 /* Recursively set width of WINDOW and its inferiors. */ | |
| 1772 | |
| 1773 set_window_width (window, width, nodelete) | |
| 1774 Lisp_Object window; | |
| 1775 int width; | |
| 1776 int nodelete; | |
| 1777 { | |
| 1778 register struct window *w = XWINDOW (window); | |
| 1779 register struct window *c; | |
| 1780 int owidth = XFASTINT (w->width); | |
| 1781 int left, pos, lastright, opos, lastoright; | |
| 1782 Lisp_Object child; | |
| 1783 | |
|
6982
5137d3777e4a
(set_window_width): Don't delete root window for being too narrow.
Richard M. Stallman <rms@gnu.org>
parents:
6852
diff
changeset
|
1784 if (!nodelete && width < window_min_width && !NILP (w->parent)) |
| 265 | 1785 { |
| 1786 Fdelete_window (window); | |
| 1787 return; | |
| 1788 } | |
| 1789 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1790 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
|
1791 XSETFASTINT (w->last_overlay_modified, 0); |
| 265 | 1792 windows_or_buffers_changed++; |
|
10666
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
1793 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1; |
|
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
1794 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1795 XSETFASTINT (w->width, width); |
| 485 | 1796 if (!NILP (w->vchild)) |
| 265 | 1797 { |
| 485 | 1798 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) |
| 265 | 1799 { |
| 1800 XWINDOW (child)->left = w->left; | |
| 1801 set_window_width (child, width, nodelete); | |
| 1802 } | |
| 1803 } | |
| 485 | 1804 else if (!NILP (w->hchild)) |
| 265 | 1805 { |
| 1806 lastright = left = XFASTINT (w->left); | |
| 1807 lastoright = 0; | |
| 485 | 1808 for (child = w->hchild; !NILP (child); child = c->next) |
| 265 | 1809 { |
| 1810 c = XWINDOW (child); | |
| 1811 | |
| 1812 opos = lastoright + XFASTINT (c->width); | |
| 1813 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1814 XSETFASTINT (c->left, lastright); |
| 265 | 1815 |
| 1816 pos = (((opos * width) << 1) + owidth) / (owidth << 1); | |
| 1817 | |
| 1818 /* Inhibit deletion for becoming too small */ | |
| 1819 set_window_width (child, pos + left - lastright, 1); | |
| 1820 | |
| 1821 /* Now advance child to next window, | |
| 1822 and set lastright if child was not just deleted. */ | |
| 1823 lastright = pos + left, lastoright = opos; | |
| 1824 } | |
| 1825 /* Delete children that became too small */ | |
| 1826 if (!nodelete) | |
| 485 | 1827 for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next) |
| 265 | 1828 { |
| 1829 set_window_width (child, XINT (XWINDOW (child)->width), 0); | |
| 1830 } | |
| 1831 } | |
| 1832 } | |
| 1833 | |
| 362 | 1834 int window_select_count; |
| 265 | 1835 |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1836 Lisp_Object |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1837 Fset_window_buffer_unwind (obuf) |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1838 Lisp_Object obuf; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1839 { |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1840 Fset_buffer (obuf); |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1841 return Qnil; |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1842 } |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1843 |
| 265 | 1844 DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 2, 0, |
| 1845 "Make WINDOW display BUFFER as its contents.\n\ | |
| 1846 BUFFER can be a buffer or buffer name.") | |
| 1847 (window, buffer) | |
| 1848 register Lisp_Object window, buffer; | |
| 1849 { | |
| 1850 register Lisp_Object tem; | |
| 1851 register struct window *w = decode_window (window); | |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1852 int count = specpdl_ptr - specpdl; |
| 265 | 1853 |
| 1854 buffer = Fget_buffer (buffer); | |
| 1855 CHECK_BUFFER (buffer, 1); | |
| 1856 | |
| 485 | 1857 if (NILP (XBUFFER (buffer)->name)) |
| 265 | 1858 error ("Attempt to display deleted buffer"); |
| 1859 | |
| 1860 tem = w->buffer; | |
| 485 | 1861 if (NILP (tem)) |
| 265 | 1862 error ("Window is deleted"); |
| 1863 else if (! EQ (tem, Qt)) /* w->buffer is t when the window | |
| 1864 is first being set up. */ | |
| 1865 { | |
| 485 | 1866 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
|
1867 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
|
1868 XSTRING (XBUFFER (tem)->name)->data); |
| 265 | 1869 |
| 1870 unshow_buffer (w); | |
| 1871 } | |
| 1872 | |
| 1873 w->buffer = buffer; | |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
1874 |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
1875 if (EQ (window, selected_window)) |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
1876 XBUFFER (w->buffer)->last_selected_window = window; |
|
17226
8a8bcf6d7a0c
(Fset_window_buffer): Increment display_count if it is an integer.
Richard M. Stallman <rms@gnu.org>
parents:
17156
diff
changeset
|
1877 if (INTEGERP (XBUFFER (buffer)->display_count)) |
|
8a8bcf6d7a0c
(Fset_window_buffer): Increment display_count if it is an integer.
Richard M. Stallman <rms@gnu.org>
parents:
17156
diff
changeset
|
1878 XSETINT (XBUFFER (buffer)->display_count, |
|
8a8bcf6d7a0c
(Fset_window_buffer): Increment display_count if it is an integer.
Richard M. Stallman <rms@gnu.org>
parents:
17156
diff
changeset
|
1879 XBUFFER (buffer)->display_count + 1); |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
1880 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1881 XSETFASTINT (w->window_end_pos, 0); |
|
4292
990f6ee7f527
(Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents:
4145
diff
changeset
|
1882 w->window_end_valid = Qnil; |
|
14149
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
1883 XSETFASTINT (w->hscroll, 0); |
| 265 | 1884 Fset_marker (w->pointm, |
| 1885 make_number (BUF_PT (XBUFFER (buffer))), | |
| 1886 buffer); | |
| 1887 set_marker_restricted (w->start, | |
| 1888 make_number (XBUFFER (buffer)->last_window_start), | |
| 1889 buffer); | |
| 1890 w->start_at_line_beg = Qnil; | |
|
3354
0b71a5329961
(Fset_window_buffer): Set window's force_start to Qnil.
Richard M. Stallman <rms@gnu.org>
parents:
3164
diff
changeset
|
1891 w->force_start = Qnil; |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1892 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
|
1893 XSETFASTINT (w->last_overlay_modified, 0); |
| 265 | 1894 windows_or_buffers_changed++; |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1895 |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1896 /* We must select BUFFER for running the window-scroll-functions. |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1897 If WINDOW is selected, switch permanently. |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1898 Otherwise, switch but go back to the ambient buffer afterward. */ |
| 265 | 1899 if (EQ (window, selected_window)) |
| 1900 Fset_buffer (buffer); | |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1901 /* We can't check ! NILP (Vwindow_scroll_functions) here |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1902 because that might itself be a local variable. */ |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1903 else if (window_initialized) |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1904 { |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1905 record_unwind_protect (Fset_window_buffer_unwind, Fcurrent_buffer ()); |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1906 Fset_buffer (buffer); |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1907 } |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1908 |
|
14149
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
1909 if (! NILP (Vwindow_scroll_functions)) |
|
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
1910 run_hook_with_args_2 (Qwindow_scroll_functions, window, |
|
0d67df27dc2a
(Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents:
14089
diff
changeset
|
1911 Fmarker_position (w->start)); |
| 265 | 1912 |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1913 unbind_to (count, Qnil); |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
1914 |
| 265 | 1915 return Qnil; |
| 1916 } | |
| 1917 | |
| 1918 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, | |
| 1919 "Select WINDOW. Most editing will apply to WINDOW's buffer.\n\ | |
| 1920 The main editor command loop selects the buffer of the selected window\n\ | |
| 1921 before each command.") | |
| 1922 (window) | |
| 1923 register Lisp_Object window; | |
| 1924 { | |
| 1925 register struct window *w; | |
| 1926 register struct window *ow = XWINDOW (selected_window); | |
| 1927 | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
1928 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 1929 |
| 1930 w = XWINDOW (window); | |
| 1931 | |
| 485 | 1932 if (NILP (w->buffer)) |
| 265 | 1933 error ("Trying to select deleted window or non-leaf window"); |
| 1934 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
1935 XSETFASTINT (w->use_time, ++window_select_count); |
| 265 | 1936 if (EQ (window, selected_window)) |
| 1937 return window; | |
| 1938 | |
| 1939 Fset_marker (ow->pointm, make_number (BUF_PT (XBUFFER (ow->buffer))), | |
| 1940 ow->buffer); | |
| 1941 | |
| 1942 selected_window = window; | |
| 769 | 1943 if (XFRAME (WINDOW_FRAME (w)) != selected_frame) |
| 265 | 1944 { |
| 769 | 1945 XFRAME (WINDOW_FRAME (w))->selected_window = window; |
|
7080
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
1946 /* Use this rather than Fhandle_switch_frame |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
1947 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
|
1948 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
|
1949 frame is active. */ |
|
4751ee5f263e
(Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents:
7056
diff
changeset
|
1950 Fselect_frame (WINDOW_FRAME (w), Qnil); |
| 265 | 1951 } |
| 1952 else | |
| 769 | 1953 selected_frame->selected_window = window; |
| 265 | 1954 |
| 1955 record_buffer (w->buffer); | |
| 1956 Fset_buffer (w->buffer); | |
| 1957 | |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
1958 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
|
1959 |
| 265 | 1960 /* Go to the point recorded in the window. |
| 1961 This is important when the buffer is in more | |
| 1962 than one window. It also matters when | |
| 1963 redisplay_window has altered point after scrolling, | |
| 1964 because it makes the change only in the window. */ | |
| 1965 { | |
| 1966 register int new_point = marker_position (w->pointm); | |
| 1967 if (new_point < BEGV) | |
| 1968 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
|
1969 else if (new_point > ZV) |
| 265 | 1970 SET_PT (ZV); |
| 1971 else | |
| 1972 SET_PT (new_point); | |
| 1973 } | |
| 1974 | |
| 1975 windows_or_buffers_changed++; | |
| 1976 return window; | |
| 1977 } | |
| 1978 | |
|
14175
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
1979 /* 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
|
1980 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
|
1981 then return WINDOW. |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
1982 |
|
ace33b55f549
(display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents:
14166
diff
changeset
|
1983 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
|
1984 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
|
1985 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
|
1986 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
|
1987 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
|
1988 |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
1989 static Lisp_Object |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
1990 display_buffer_1 (window) |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
1991 Lisp_Object window; |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
1992 { |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
1993 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (window))); |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
1994 FRAME_SAMPLE_VISIBILITY (f); |
|
14535
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
1995 if (f != selected_frame) |
|
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
1996 { |
|
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
1997 if (FRAME_ICONIFIED_P (f)) |
|
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
1998 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
1999 else if (FRAME_VISIBLE_P (f)) |
|
14535
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2000 Fraise_frame (WINDOW_FRAME (XWINDOW (window))); |
|
8ca7e641c144
(display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents:
14445
diff
changeset
|
2001 } |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2002 return window; |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2003 } |
|
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2004 |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2005 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
|
2006 "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
|
2007 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
|
2008 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
|
2009 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
|
2010 (buffer_name) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2011 Lisp_Object buffer_name; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2012 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2013 Lisp_Object tem; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2014 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2015 CHECK_STRING (buffer_name, 1); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2016 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2017 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
|
2018 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2019 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2020 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2021 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
|
2022 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2023 return XCDR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2024 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2025 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
|
2026 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2027 Lisp_Object car = XCAR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2028 if (STRINGP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2029 && 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
|
2030 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2031 else if (CONSP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2032 && STRINGP (XCAR (car)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2033 && 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
|
2034 return XCDR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2035 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2036 return Qnil; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2037 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2038 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2039 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
|
2040 "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
|
2041 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
|
2042 (buffer_name) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2043 Lisp_Object buffer_name; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2044 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2045 Lisp_Object tem; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2046 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2047 CHECK_STRING (buffer_name, 1); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2048 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2049 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
|
2050 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2051 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2052 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2053 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
|
2054 if (!NILP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2055 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2056 |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2057 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
|
2058 { |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2059 Lisp_Object car = XCAR (tem); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2060 if (STRINGP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2061 && 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
|
2062 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2063 else if (CONSP (car) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2064 && STRINGP (XCAR (car)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2065 && 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
|
2066 return Qt; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2067 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2068 return Qnil; |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2069 } |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2070 |
| 735 | 2071 DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 2, |
|
10043
62e8ccc5b3b9
(Fdisplay_buffer): Use `b' to read existing buffer name.
Richard M. Stallman <rms@gnu.org>
parents:
9974
diff
changeset
|
2072 "bDisplay buffer: \nP", |
| 265 | 2073 "Make BUFFER appear in some window but don't select it.\n\ |
| 2074 BUFFER can be a buffer or a buffer name.\n\ | |
| 2075 If BUFFER is shown already in some window, just use that one,\n\ | |
| 2076 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
|
2077 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
|
2078 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
|
2079 Returns the window displaying BUFFER.\n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2080 \n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2081 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
|
2082 `same-window-buffer-names', and `same-window-regexps' customize how certain\n\ |
|
00619dd2f972
(Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14536
diff
changeset
|
2083 buffer names are handled.") |
| 265 | 2084 (buffer, not_this_window) |
| 2085 register Lisp_Object buffer, not_this_window; | |
| 2086 { | |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2087 register Lisp_Object window, tem; |
| 265 | 2088 |
| 2089 buffer = Fget_buffer (buffer); | |
| 2090 CHECK_BUFFER (buffer, 0); | |
| 2091 | |
| 485 | 2092 if (!NILP (Vdisplay_buffer_function)) |
| 265 | 2093 return call2 (Vdisplay_buffer_function, buffer, not_this_window); |
| 2094 | |
| 485 | 2095 if (NILP (not_this_window) |
| 265 | 2096 && 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
|
2097 return display_buffer_1 (selected_window); |
| 265 | 2098 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2099 /* 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
|
2100 in the selected window. */ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2101 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
|
2102 { |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2103 tem = Fsame_window_p (XBUFFER (buffer)->name); |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2104 if (!NILP (tem)) |
|
11003
71304a70d0f6
(Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents:
10958
diff
changeset
|
2105 { |
|
71304a70d0f6
(Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents:
10958
diff
changeset
|
2106 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
|
2107 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
|
2108 } |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2109 } |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
2110 |
|
6262
930d259c1f95
(Fdisplay_buffer): If pop_up_frames != 0,
Richard M. Stallman <rms@gnu.org>
parents:
6247
diff
changeset
|
2111 /* If pop_up_frames, |
|
11427
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2112 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
|
2113 Otherwise search only the current frame. */ |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2114 if (pop_up_frames || last_nonminibuf_frame == 0) |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2115 XSETFASTINT (tem, 0); |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2116 else |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2117 XSETFRAME (tem, last_nonminibuf_frame); |
|
c4ee56df7173
(Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents:
11405
diff
changeset
|
2118 window = Fget_buffer_window (buffer, tem); |
| 485 | 2119 if (!NILP (window) |
| 2120 && (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
|
2121 { |
|
13619
3fa8cd29e1da
(Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents:
13583
diff
changeset
|
2122 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
|
2123 } |
| 265 | 2124 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2125 /* Certain buffer names get special handling. */ |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2126 if (!NILP (Vspecial_display_function)) |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2127 { |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2128 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
|
2129 if (EQ (tem, Qt)) |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2130 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
|
2131 if (CONSP (tem)) |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
2132 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
|
2133 } |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2134 |
| 769 | 2135 /* If there are no frames open that have more than a minibuffer, |
| 2136 we need to create a new frame. */ | |
| 2137 if (pop_up_frames || last_nonminibuf_frame == 0) | |
| 265 | 2138 { |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
2139 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
| 265 | 2140 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
|
2141 return display_buffer_1 (window); |
| 265 | 2142 } |
| 2143 | |
| 358 | 2144 if (pop_up_windows |
| 769 | 2145 || FRAME_MINIBUF_ONLY_P (selected_frame) |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2146 /* 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
|
2147 don't try to reuse its windows. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2148 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->dedicated) |
| 358 | 2149 ) |
| 2150 { | |
|
6517
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2151 Lisp_Object frames; |
|
8f5f79c3091a
(unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents:
6487
diff
changeset
|
2152 |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2153 frames = Qnil; |
| 769 | 2154 if (FRAME_MINIBUF_ONLY_P (selected_frame)) |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
2155 XSETFRAME (frames, last_nonminibuf_frame); |
| 265 | 2156 /* Don't try to create a window if would get an error */ |
| 2157 if (split_height_threshold < window_min_height << 1) | |
| 2158 split_height_threshold = window_min_height << 1; | |
| 2159 | |
|
8263
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2160 /* 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
|
2161 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
|
2162 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
|
2163 |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2164 /* 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
|
2165 try other frames. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2166 if (FRAME_NO_SPLIT_P (NILP (frames) ? selected_frame |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2167 : last_nonminibuf_frame)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2168 { |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2169 /* Try visible frames first. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2170 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
|
2171 /* 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
|
2172 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2173 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
|
2174 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2175 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
|
2176 } |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2177 else |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2178 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
|
2179 |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2180 /* 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
|
2181 split it. */ |
| 485 | 2182 if (!NILP (window) |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2183 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
| 265 | 2184 && 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
|
2185 && WINDOW_FULL_WIDTH_P (XWINDOW (window))) |
| 265 | 2186 window = Fsplit_window (window, Qnil, Qnil); |
| 2187 else | |
| 2188 { | |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2189 Lisp_Object upper, lower, other; |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2190 |
| 769 | 2191 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
|
2192 /* 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
|
2193 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
|
2194 if (!NILP (window) |
|
9567
cf4f4c8a3ef6
(Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents:
9324
diff
changeset
|
2195 && ! 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
|
2196 && (EQ (window, selected_window) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2197 || EQ (XWINDOW (window)->parent, Qnil)) |
| 265 | 2198 && window_height (window) >= window_min_height << 1) |
| 2199 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
|
2200 /* If Fget_lru_window returned nil, try other approaches. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2201 /* Try visible frames first. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2202 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2203 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
|
2204 /* 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
|
2205 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2206 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
|
2207 /* Try invisible frames. */ |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2208 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2209 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
|
2210 /* 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
|
2211 if (NILP (window)) |
|
bae811318a57
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
8245
diff
changeset
|
2212 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
|
2213 /* 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
|
2214 even out their heights. */ |
|
11750
b911d6f75664
(Fdisplay_buffer): Initialize other, upper, lower.
Richard M. Stallman <rms@gnu.org>
parents:
11731
diff
changeset
|
2215 other = upper = lower = Qnil; |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2216 if (!NILP (XWINDOW (window)->prev)) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2217 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
|
2218 if (!NILP (XWINDOW (window)->next)) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2219 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
|
2220 if (!NILP (other) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2221 /* Check that OTHER and WINDOW are vertically arrayed. */ |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2222 && XWINDOW (other)->top != XWINDOW (window)->top |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2223 && XWINDOW (other)->height > XWINDOW (window)->height) |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2224 { |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2225 int total = XWINDOW (other)->height + XWINDOW (window)->height; |
|
9624
48854151266c
(Fdisplay_buffer): Make old_selected_window a Lisp_Object.
Karl Heuer <kwzh@gnu.org>
parents:
9614
diff
changeset
|
2226 Lisp_Object old_selected_window; |
|
48854151266c
(Fdisplay_buffer): Make old_selected_window a Lisp_Object.
Karl Heuer <kwzh@gnu.org>
parents:
9614
diff
changeset
|
2227 old_selected_window = selected_window; |
|
48854151266c
(Fdisplay_buffer): Make old_selected_window a Lisp_Object.
Karl Heuer <kwzh@gnu.org>
parents:
9614
diff
changeset
|
2228 |
|
48854151266c
(Fdisplay_buffer): Make old_selected_window a Lisp_Object.
Karl Heuer <kwzh@gnu.org>
parents:
9614
diff
changeset
|
2229 selected_window = upper; |
|
9614
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2230 change_window_height (total / 2 - XWINDOW (upper)->height, 0); |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2231 selected_window = old_selected_window; |
|
e466cdfd962e
(Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
2232 } |
| 265 | 2233 } |
| 2234 } | |
| 2235 else | |
| 2236 window = Fget_lru_window (Qnil); | |
| 2237 | |
| 2238 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
|
2239 return display_buffer_1 (window); |
| 265 | 2240 } |
| 2241 | |
| 2242 void | |
| 2243 temp_output_buffer_show (buf) | |
| 2244 register Lisp_Object buf; | |
| 2245 { | |
| 2246 register struct buffer *old = current_buffer; | |
| 2247 register Lisp_Object window; | |
| 2248 register struct window *w; | |
| 2249 | |
| 2250 Fset_buffer (buf); | |
|
10302
34556316a48a
(temp_output_buffer_show): Use BUF_SAVE_MODIFF.
Richard M. Stallman <rms@gnu.org>
parents:
10043
diff
changeset
|
2251 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; |
| 265 | 2252 BEGV = BEG; |
| 2253 ZV = Z; | |
| 2254 SET_PT (BEG); | |
|
12492
27497b336977
(Fset_window_hscroll): Set clip_changed in the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
12387
diff
changeset
|
2255 XBUFFER (buf)->clip_changed = 1; |
| 265 | 2256 set_buffer_internal (old); |
| 2257 | |
| 2258 if (!EQ (Vtemp_buffer_show_function, Qnil)) | |
| 2259 call1 (Vtemp_buffer_show_function, buf); | |
| 2260 else | |
| 2261 { | |
| 2262 window = Fdisplay_buffer (buf, Qnil); | |
| 2263 | |
| 769 | 2264 if (XFRAME (XWINDOW (window)->frame) != selected_frame) |
| 2265 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); | |
| 265 | 2266 Vminibuf_scroll_window = window; |
| 2267 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
|
2268 XSETFASTINT (w->hscroll, 0); |
| 265 | 2269 set_marker_restricted (w->start, make_number (1), buf); |
| 2270 set_marker_restricted (w->pointm, make_number (1), buf); | |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2271 |
|
14536
12de7dac154b
(display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents:
14535
diff
changeset
|
2272 /* Run temp-buffer-show-hook, with the chosen window selected. */ |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2273 if (!NILP (Vrun_hooks)) |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2274 { |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2275 Lisp_Object tem; |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2276 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
|
2277 if (!NILP (tem)) |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2278 { |
|
11731
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2279 tem = Fsymbol_value (Qtemp_buffer_show_hook); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2280 if (!NILP (tem)) |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2281 { |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2282 int count = specpdl_ptr - specpdl; |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2283 |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2284 /* Select the window that was chosen, for running the hook. */ |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2285 record_unwind_protect (Fset_window_configuration, |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2286 Fcurrent_window_configuration (Qnil)); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2287 |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2288 Fselect_window (window); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2289 call1 (Vrun_hooks, Qtemp_buffer_show_hook); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2290 unbind_to (count, Qnil); |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
2291 } |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2292 } |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2293 } |
|
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
2294 } |
| 265 | 2295 } |
| 2296 | |
| 2297 static | |
| 2298 make_dummy_parent (window) | |
| 2299 Lisp_Object window; | |
| 2300 { | |
|
9970
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2301 Lisp_Object new; |
| 265 | 2302 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
|
2303 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
|
2304 int i; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2305 |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2306 o = XWINDOW (window); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2307 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
|
2308 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
|
2309 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
|
2310 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
|
2311 p = (struct window *)vec; |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2312 XSETWINDOW (new, p); |
|
76910d506a80
(make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9964
diff
changeset
|
2313 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2314 XSETFASTINT (p->sequence_number, ++sequence_number); |
| 265 | 2315 |
| 2316 /* Put new into window structure in place of window */ | |
| 2317 replace_window (window, new); | |
| 2318 | |
| 2319 o->next = Qnil; | |
| 2320 o->prev = Qnil; | |
| 2321 o->vchild = Qnil; | |
| 2322 o->hchild = Qnil; | |
| 2323 o->parent = new; | |
| 2324 | |
| 2325 p->start = Qnil; | |
| 2326 p->pointm = Qnil; | |
| 2327 p->buffer = Qnil; | |
| 2328 } | |
| 2329 | |
| 2330 DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", | |
| 2331 "Split WINDOW, putting SIZE lines in the first of the pair.\n\ | |
| 2332 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
|
2333 If optional third arg HORFLAG is non-nil, split side by side\n\ |
| 265 | 2334 and put SIZE columns in the first of the pair.") |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2335 (window, size, horflag) |
|
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2336 Lisp_Object window, size, horflag; |
| 265 | 2337 { |
| 2338 register Lisp_Object new; | |
| 2339 register struct window *o, *p; | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2340 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
|
2341 register int size_int; |
| 265 | 2342 |
| 485 | 2343 if (NILP (window)) |
| 265 | 2344 window = selected_window; |
| 2345 else | |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2346 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 2347 |
| 2348 o = XWINDOW (window); | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2349 fo = XFRAME (WINDOW_FRAME (o)); |
| 265 | 2350 |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2351 if (NILP (size)) |
| 265 | 2352 { |
| 485 | 2353 if (!NILP (horflag)) |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2354 /* Calculate the size of the left-hand window, by dividing |
|
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2355 the usable space in columns by two. */ |
|
15902
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
2356 size_int = XFASTINT (o->width) >> 1; |
| 265 | 2357 else |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2358 size_int = XFASTINT (o->height) >> 1; |
| 265 | 2359 } |
| 2360 else | |
| 2361 { | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2362 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
|
2363 size_int = XINT (size); |
| 265 | 2364 } |
| 2365 | |
| 2366 if (MINI_WINDOW_P (o)) | |
| 2367 error ("Attempt to split minibuffer window"); | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2368 else if (FRAME_NO_SPLIT_P (fo)) |
| 769 | 2369 error ("Attempt to split unsplittable frame"); |
| 265 | 2370 |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2371 check_min_window_sizes (); |
| 265 | 2372 |
| 485 | 2373 if (NILP (horflag)) |
| 265 | 2374 { |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2375 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
|
2376 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
|
2377 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
|
2378 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
|
2379 XFASTINT (o->height) - size_int); |
| 485 | 2380 if (NILP (o->parent) |
| 2381 || NILP (XWINDOW (o->parent)->vchild)) | |
| 265 | 2382 { |
| 2383 make_dummy_parent (window); | |
| 2384 new = o->parent; | |
| 2385 XWINDOW (new)->vchild = window; | |
| 2386 } | |
| 2387 } | |
| 2388 else | |
| 2389 { | |
|
13780
732a8bd9c552
(Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents:
13723
diff
changeset
|
2390 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
|
2391 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
|
2392 |
|
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
2393 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
|
2394 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
|
2395 XFASTINT (o->width) - size_int); |
| 485 | 2396 if (NILP (o->parent) |
| 2397 || NILP (XWINDOW (o->parent)->hchild)) | |
| 265 | 2398 { |
| 2399 make_dummy_parent (window); | |
| 2400 new = o->parent; | |
| 2401 XWINDOW (new)->hchild = window; | |
| 2402 } | |
| 2403 } | |
| 2404 | |
| 2405 /* Now we know that window's parent is a vertical combination | |
| 2406 if we are dividing vertically, or a horizontal combination | |
| 2407 if we are making side-by-side windows */ | |
| 2408 | |
| 2409 windows_or_buffers_changed++; | |
|
13723
4e170419e83c
(Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
13619
diff
changeset
|
2410 FRAME_WINDOW_SIZES_CHANGED (fo) = 1; |
| 265 | 2411 new = make_window (); |
| 2412 p = XWINDOW (new); | |
| 2413 | |
| 769 | 2414 p->frame = o->frame; |
| 265 | 2415 p->next = o->next; |
| 485 | 2416 if (!NILP (p->next)) |
| 265 | 2417 XWINDOW (p->next)->prev = new; |
| 2418 p->prev = window; | |
| 2419 o->next = new; | |
| 2420 p->parent = o->parent; | |
| 2421 p->buffer = Qt; | |
| 2422 | |
| 2423 Fset_window_buffer (new, o->buffer); | |
| 2424 | |
| 769 | 2425 /* Apportion the available frame space among the two new windows */ |
| 265 | 2426 |
| 485 | 2427 if (!NILP (horflag)) |
| 265 | 2428 { |
| 2429 p->height = o->height; | |
| 2430 p->top = o->top; | |
|
15902
985270efc514
(Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents:
15712
diff
changeset
|
2431 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
|
2432 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
|
2433 XSETFASTINT (p->left, XFASTINT (o->left) + size_int); |
| 265 | 2434 } |
| 2435 else | |
| 2436 { | |
| 2437 p->left = o->left; | |
| 2438 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
|
2439 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
|
2440 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
|
2441 XSETFASTINT (p->top, XFASTINT (o->top) + size_int); |
| 265 | 2442 } |
| 2443 | |
| 2444 return new; | |
| 2445 } | |
| 2446 | |
| 2447 DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p", | |
| 2448 "Make current window ARG lines bigger.\n\ | |
| 2449 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
|
2450 (arg, side) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2451 register Lisp_Object arg, side; |
| 265 | 2452 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2453 CHECK_NUMBER (arg, 0); |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2454 change_window_height (XINT (arg), !NILP (side)); |
| 265 | 2455 return Qnil; |
| 2456 } | |
| 2457 | |
| 2458 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", | |
| 2459 "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
|
2460 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
|
2461 (arg, side) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2462 register Lisp_Object arg, side; |
| 265 | 2463 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2464 CHECK_NUMBER (arg, 0); |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2465 change_window_height (-XINT (arg), !NILP (side)); |
| 265 | 2466 return Qnil; |
| 2467 } | |
| 2468 | |
| 2469 int | |
| 2470 window_height (window) | |
| 2471 Lisp_Object window; | |
| 2472 { | |
| 2473 register struct window *p = XWINDOW (window); | |
| 2474 return XFASTINT (p->height); | |
| 2475 } | |
| 2476 | |
| 2477 int | |
| 2478 window_width (window) | |
| 2479 Lisp_Object window; | |
| 2480 { | |
| 2481 register struct window *p = XWINDOW (window); | |
| 2482 return XFASTINT (p->width); | |
| 2483 } | |
| 2484 | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2485 #define MINSIZE(w) \ |
|
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2486 (widthflag \ |
|
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2487 ? window_min_width \ |
|
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2488 : (MINI_WINDOW_P (XWINDOW (w)) ? 1 : window_min_height)) |
| 265 | 2489 |
| 2490 #define CURBEG(w) \ | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2491 *(widthflag ? (int *) &(XWINDOW (w)->left) : (int *) &(XWINDOW (w)->top)) |
| 265 | 2492 |
| 2493 #define CURSIZE(w) \ | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2494 *(widthflag ? (int *) &(XWINDOW (w)->width) : (int *) &(XWINDOW (w)->height)) |
| 265 | 2495 |
| 2496 /* Unlike set_window_height, this function | |
| 2497 also changes the heights of the siblings so as to | |
| 2498 keep everything consistent. */ | |
| 2499 | |
| 2500 change_window_height (delta, widthflag) | |
| 2501 register int delta; | |
| 2502 int widthflag; | |
| 2503 { | |
| 2504 register Lisp_Object parent; | |
| 2505 Lisp_Object window; | |
| 2506 register struct window *p; | |
| 2507 int *sizep; | |
| 2508 int (*sizefun) () = widthflag ? window_width : window_height; | |
| 2509 register int (*setsizefun) () = (widthflag | |
| 2510 ? set_window_width | |
| 2511 : set_window_height); | |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2512 int maximum; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2513 Lisp_Object next, prev; |
| 265 | 2514 |
|
972
f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents:
780
diff
changeset
|
2515 check_min_window_sizes (); |
| 265 | 2516 |
| 2517 window = selected_window; | |
| 2518 while (1) | |
| 2519 { | |
| 2520 p = XWINDOW (window); | |
| 2521 parent = p->parent; | |
| 485 | 2522 if (NILP (parent)) |
| 265 | 2523 { |
| 2524 if (widthflag) | |
| 2525 error ("No other window to side of this one"); | |
| 2526 break; | |
| 2527 } | |
| 485 | 2528 if (widthflag ? !NILP (XWINDOW (parent)->hchild) |
| 2529 : !NILP (XWINDOW (parent)->vchild)) | |
| 265 | 2530 break; |
| 2531 window = parent; | |
| 2532 } | |
| 2533 | |
|
1049
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2534 sizep = &CURSIZE (window); |
|
25046e48ce9a
* window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents:
1016
diff
changeset
|
2535 |
| 265 | 2536 { |
| 2537 register int maxdelta; | |
| 2538 | |
| 485 | 2539 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep |
| 2540 : !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) | |
| 2541 : !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) | |
| 769 | 2542 /* This is a frame with only one window, a minibuffer-only |
| 2543 or a minibufferless frame. */ | |
| 432 | 2544 : (delta = 0)); |
| 265 | 2545 |
| 2546 if (delta > maxdelta) | |
| 2547 /* This case traps trying to make the minibuffer | |
| 769 | 2548 the full frame, or make the only window aside from the |
| 2549 minibuffer the full frame. */ | |
| 265 | 2550 delta = maxdelta; |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2551 } |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2552 |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2553 if (*sizep + delta < MINSIZE (window)) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2554 { |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2555 Fdelete_window (window); |
| 432 | 2556 return; |
|
7618
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2557 } |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2558 |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2559 if (delta == 0) |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2560 return; |
|
45298374e242
(change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents:
7545
diff
changeset
|
2561 |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2562 /* 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
|
2563 maximum = 0; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2564 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2565 maximum += (*sizefun) (next) - MINSIZE (next); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2566 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2567 maximum += (*sizefun) (prev) - MINSIZE (prev); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2568 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2569 /* If we can get it all from them, do so. */ |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2570 if (delta < maximum) |
| 265 | 2571 { |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2572 Lisp_Object first_unaffected; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2573 Lisp_Object first_affected; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2574 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2575 next = p->next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2576 prev = p->prev; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2577 first_affected = window; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2578 /* 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
|
2579 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
|
2580 and take as much as we can get without deleting that sibling. */ |
|
17156
05385a7a18c9
(change_window_height): Handle shrink as well as enlarge.
Karl Heuer <kwzh@gnu.org>
parents:
17019
diff
changeset
|
2581 while (delta != 0) |
|
16982
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2582 { |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2583 if (delta == 0) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2584 break; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2585 if (! NILP (next)) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2586 { |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2587 int this_one = (*sizefun) (next) - MINSIZE (next); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2588 if (this_one > delta) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2589 this_one = delta; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2590 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2591 (*setsizefun) (next, (*sizefun) (next) - this_one, 0); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2592 (*setsizefun) (window, *sizep + this_one, 0); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2593 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2594 delta -= this_one; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2595 next = XWINDOW (next)->next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2596 } |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2597 if (delta == 0) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2598 break; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2599 if (! NILP (prev)) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2600 { |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2601 int this_one = (*sizefun) (prev) - MINSIZE (prev); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2602 if (this_one > delta) |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2603 this_one = delta; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2604 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2605 first_affected = prev; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2606 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2607 (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2608 (*setsizefun) (window, *sizep + this_one, 0); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2609 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2610 delta -= this_one; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2611 prev = XWINDOW (prev)->prev; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2612 } |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2613 } |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2614 |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2615 /* 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
|
2616 based on the new sizes. */ |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2617 first_unaffected = next; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2618 prev = first_affected; |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2619 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
|
2620 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
|
2621 { |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2622 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
|
2623 /* 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
|
2624 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
|
2625 (*setsizefun) (next, (*sizefun) (next), 0); |
|
8516fb50f3e5
(change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents:
16980
diff
changeset
|
2626 } |
| 265 | 2627 } |
| 2628 else | |
| 2629 { | |
| 2630 register int delta1; | |
| 2631 register int opht = (*sizefun) (parent); | |
| 2632 | |
| 2633 /* If trying to grow this window to or beyond size of the parent, | |
| 2634 make delta1 so big that, on shrinking back down, | |
| 2635 all the siblings end up with less than one line and are deleted. */ | |
| 2636 if (opht <= *sizep + delta) | |
| 2637 delta1 = opht * opht * 2; | |
| 2638 /* Otherwise, make delta1 just right so that if we add delta1 | |
| 2639 lines to this window and to the parent, and then shrink | |
| 2640 the parent back to its original size, the new proportional | |
| 2641 size of this window will increase by delta. */ | |
| 2642 else | |
| 2643 delta1 = (delta * opht * 100) / ((opht - *sizep - delta) * 100); | |
| 2644 | |
| 2645 /* Add delta1 lines or columns to this window, and to the parent, | |
| 2646 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
|
2647 CURSIZE (parent) = opht + delta1; |
| 265 | 2648 (*setsizefun) (window, *sizep + delta1, 0); |
| 2649 | |
| 2650 /* Squeeze out delta1 lines or columns from our parent, | |
| 2651 shriking this window and siblings proportionately. | |
| 2652 This brings parent back to correct size. | |
| 2653 Delta1 was calculated so this makes this window the desired size, | |
| 2654 taking it all out of the siblings. */ | |
| 2655 (*setsizefun) (parent, opht, 0); | |
| 2656 } | |
| 2657 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2658 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
|
2659 XSETFASTINT (p->last_overlay_modified, 0); |
| 265 | 2660 } |
| 2661 #undef MINSIZE | |
| 2662 #undef CURBEG | |
| 2663 #undef CURSIZE | |
| 2664 | |
| 2665 | |
| 2666 /* Return number of lines of text (not counting mode line) in W. */ | |
| 2667 | |
| 2668 int | |
| 2669 window_internal_height (w) | |
| 2670 struct window *w; | |
| 2671 { | |
| 2672 int ht = XFASTINT (w->height); | |
| 2673 | |
| 2674 if (MINI_WINDOW_P (w)) | |
| 2675 return ht; | |
| 2676 | |
| 485 | 2677 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild) |
| 2678 || !NILP (w->next) || !NILP (w->prev) | |
| 769 | 2679 || FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (w)))) |
| 265 | 2680 return ht - 1; |
| 2681 | |
| 2682 return ht; | |
| 2683 } | |
| 2684 | |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2685 |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2686 /* 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
|
2687 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
|
2688 separating W from the sibling to its right. */ |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2689 int |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2690 window_internal_width (w) |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2691 struct window *w; |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2692 { |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2693 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2694 int width = XINT (w->width); |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2695 |
|
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1931
diff
changeset
|
2696 /* Scroll bars occupy a few columns. */ |
|
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1931
diff
changeset
|
2697 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
8944
07b281d80445
(window_internal_width): Change VERTICAL_SCROLL_BAR_WIDTH to
Karl Heuer <kwzh@gnu.org>
parents:
8939
diff
changeset
|
2698 return width - FRAME_SCROLL_BAR_COLS (f); |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2699 |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2700 /* The column of `|' characters separating side-by-side windows |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2701 occupies one column only. */ |
|
16297
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
2702 if (!WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w)) |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
2703 return width - 1; |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
2704 |
|
701db778b7a4
(Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents:
16208
diff
changeset
|
2705 return width; |
|
1783
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2706 } |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2707 |
|
8e7932110418
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1716
diff
changeset
|
2708 |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2709 /* Scroll contents of window WINDOW up N lines. |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2710 If WHOLE is nonzero, it means scroll N screenfuls instead. */ |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2711 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2712 static void |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2713 window_scroll (window, n, whole, noerror) |
| 265 | 2714 Lisp_Object window; |
| 2715 int n; | |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2716 int whole; |
| 522 | 2717 int noerror; |
| 265 | 2718 { |
| 2719 register struct window *w = XWINDOW (window); | |
| 7347 | 2720 register int opoint = PT; |
| 265 | 2721 register int pos; |
| 2722 register int ht = window_internal_height (w); | |
| 2723 register Lisp_Object tem; | |
| 2724 int lose; | |
| 2725 Lisp_Object bolp, nmoved; | |
|
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
|
2726 int startpos; |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2727 struct position posit; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2728 int original_vpos; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2729 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2730 startpos = marker_position (w->start); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2731 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2732 posit = *compute_motion (startpos, 0, 0, 0, |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2733 PT, ht, 0, |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2734 window_internal_width (w), XINT (w->hscroll), |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2735 0, w); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2736 original_vpos = posit.vpos; |
|
13102
960db92441d8
(window_scroll): Always set force_start.
Richard M. Stallman <rms@gnu.org>
parents:
12981
diff
changeset
|
2737 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
2738 XSETFASTINT (tem, PT); |
| 265 | 2739 tem = Fpos_visible_in_window_p (tem, window); |
| 2740 | |
| 485 | 2741 if (NILP (tem)) |
| 265 | 2742 { |
|
6341
dfc758dd2b08
(window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents:
6326
diff
changeset
|
2743 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
|
2744 startpos = PT; |
| 265 | 2745 } |
|
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
|
2746 |
|
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
|
2747 SET_PT (startpos); |
| 7347 | 2748 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
|
2749 Fvertical_motion (make_number (n), window); |
| 7347 | 2750 pos = PT; |
| 265 | 2751 bolp = Fbolp (); |
| 2752 SET_PT (opoint); | |
| 2753 | |
| 2754 if (lose) | |
| 522 | 2755 { |
| 2756 if (noerror) | |
| 2757 return; | |
| 2758 else | |
| 2759 Fsignal (Qbeginning_of_buffer, Qnil); | |
| 2760 } | |
| 265 | 2761 |
| 2762 if (pos < ZV) | |
| 2763 { | |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2764 int this_scroll_margin = scroll_margin; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2765 |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2766 /* 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
|
2767 if (this_scroll_margin < 0) |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2768 this_scroll_margin = 0; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2769 |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2770 if (XINT (w->height) < 4 * scroll_margin) |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2771 this_scroll_margin = XINT (w->height) / 4; |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2772 |
| 265 | 2773 set_marker_restricted (w->start, make_number (pos), w->buffer); |
| 2774 w->start_at_line_beg = bolp; | |
| 2775 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
|
2776 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
|
2777 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
|
2778 /* 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
|
2779 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
|
2780 w->force_start = Qt; |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2781 |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2782 if (whole && scroll_preserve_screen_position) |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2783 { |
|
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2784 SET_PT (pos); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2785 Fvertical_motion (make_number (original_vpos), window); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2786 } |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2787 /* 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
|
2788 that it is outside the scroll margin. */ |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2789 else if (n > 0) |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2790 { |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2791 int top_margin; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2792 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2793 if (this_scroll_margin > 0) |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2794 { |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2795 SET_PT (pos); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2796 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
|
2797 top_margin = PT; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2798 } |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2799 else |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2800 top_margin = pos; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2801 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2802 if (top_margin <= opoint) |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2803 SET_PT (opoint); |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2804 else if (scroll_preserve_screen_position) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2805 { |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2806 SET_PT (pos); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2807 Fvertical_motion (make_number (original_vpos), window); |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2808 } |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2809 else |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2810 SET_PT (pos); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2811 } |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2812 else if (n < 0) |
| 265 | 2813 { |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2814 int bottom_margin; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2815 |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2816 /* 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
|
2817 but not within the scroll margin. */ |
| 265 | 2818 SET_PT (pos); |
|
16559
d62b7f309f2b
(window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents:
16555
diff
changeset
|
2819 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
|
2820 if (XFASTINT (tem) == ht - this_scroll_margin) |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2821 bottom_margin = PT; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2822 else |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2823 bottom_margin = PT + 1; |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2824 |
|
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2825 if (bottom_margin > opoint) |
| 265 | 2826 SET_PT (opoint); |
| 2827 else | |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2828 { |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2829 if (scroll_preserve_screen_position) |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2830 { |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2831 SET_PT (pos); |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2832 Fvertical_motion (make_number (original_vpos), window); |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2833 } |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2834 else |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
2835 Fvertical_motion (make_number (-1), window); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2836 } |
| 265 | 2837 } |
| 2838 } | |
| 2839 else | |
| 522 | 2840 { |
| 2841 if (noerror) | |
| 2842 return; | |
| 2843 else | |
| 2844 Fsignal (Qend_of_buffer, Qnil); | |
| 2845 } | |
| 265 | 2846 } |
| 2847 | |
| 2848 /* This is the guts of Fscroll_up and Fscroll_down. */ | |
| 2849 | |
| 2850 static void | |
| 2851 scroll_command (n, direction) | |
| 2852 register Lisp_Object n; | |
| 2853 int direction; | |
| 2854 { | |
| 2855 register int defalt; | |
| 2856 int count = specpdl_ptr - specpdl; | |
| 2857 | |
| 548 | 2858 /* If selected window's buffer isn't current, make it current for the moment. |
| 2859 But don't screw up if window_scroll gets an error. */ | |
| 265 | 2860 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
| 548 | 2861 { |
| 2862 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
| 2863 Fset_buffer (XWINDOW (selected_window)->buffer); | |
| 2864 } | |
| 265 | 2865 |
| 2866 defalt = (window_internal_height (XWINDOW (selected_window)) | |
| 2867 - next_screen_context_lines); | |
| 2868 defalt = direction * (defalt < 1 ? 1 : defalt); | |
| 2869 | |
| 485 | 2870 if (NILP (n)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2871 window_scroll (selected_window, defalt, 1, 0); |
| 265 | 2872 else if (EQ (n, Qminus)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2873 window_scroll (selected_window, - defalt, 1, 0); |
| 265 | 2874 else |
| 2875 { | |
| 2876 n = Fprefix_numeric_value (n); | |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2877 window_scroll (selected_window, XINT (n) * direction, 0, 0); |
| 265 | 2878 } |
| 548 | 2879 |
| 2880 unbind_to (count, Qnil); | |
| 265 | 2881 } |
| 2882 | |
| 2883 DEFUN ("scroll-up", Fscroll_up, Sscroll_up, 0, 1, "P", | |
| 2884 "Scroll text of current window upward ARG lines; or near full screen if no ARG.\n\ | |
| 2885 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
|
2886 Negative ARG means scroll downward.\n\ |
| 265 | 2887 When calling from a program, supply a number as argument or nil.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2888 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2889 Lisp_Object arg; |
| 265 | 2890 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2891 scroll_command (arg, 1); |
| 265 | 2892 return Qnil; |
| 2893 } | |
| 2894 | |
| 2895 DEFUN ("scroll-down", Fscroll_down, Sscroll_down, 0, 1, "P", | |
| 2896 "Scroll text of current window downward ARG lines; or near full screen if no ARG.\n\ | |
| 2897 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
|
2898 Negative ARG means scroll upward.\n\ |
| 265 | 2899 When calling from a program, supply a number as argument or nil.") |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2900 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2901 Lisp_Object arg; |
| 265 | 2902 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2903 scroll_command (arg, -1); |
| 265 | 2904 return Qnil; |
| 2905 } | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2906 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2907 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
|
2908 "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
|
2909 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
|
2910 specifies the window.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2911 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
|
2912 showing that buffer is used.") |
|
8059
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
2913 () |
| 265 | 2914 { |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2915 Lisp_Object window; |
| 265 | 2916 |
| 2917 if (MINI_WINDOW_P (XWINDOW (selected_window)) | |
| 485 | 2918 && !NILP (Vminibuf_scroll_window)) |
| 265 | 2919 window = Vminibuf_scroll_window; |
| 2920 /* If buffer is specified, scroll that buffer. */ | |
| 485 | 2921 else if (!NILP (Vother_window_scroll_buffer)) |
| 265 | 2922 { |
| 2923 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); | |
| 485 | 2924 if (NILP (window)) |
| 265 | 2925 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt); |
| 2926 } | |
| 2927 else | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2928 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2929 /* 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
|
2930 frame. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2931 window = Fnext_window (selected_window, Qnil, Qnil); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2932 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2933 if (EQ (window, selected_window)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2934 /* 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
|
2935 visible frame. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2936 do |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2937 window = Fnext_window (window, Qnil, Qt); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2938 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
|
2939 && ! EQ (window, selected_window)); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2940 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1805
diff
changeset
|
2941 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
2942 CHECK_LIVE_WINDOW (window, 0); |
| 265 | 2943 |
| 2944 if (EQ (window, selected_window)) | |
| 2945 error ("There is no other window"); | |
| 2946 | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2947 return window; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2948 } |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2949 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2950 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
|
2951 "Scroll next window upward ARG lines; or near full screen if no ARG.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2952 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
|
2953 if the current one is at the bottom. Negative ARG means scroll downward.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2954 When calling from a program, supply a number as argument or nil.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2955 \n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2956 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
|
2957 specifies the window to scroll.\n\ |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2958 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
|
2959 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
|
2960 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2961 register Lisp_Object arg; |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2962 { |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2963 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
|
2964 register int defalt; |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2965 register struct window *w; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2966 register int count = specpdl_ptr - specpdl; |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2967 |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2968 window = Fother_window_for_scrolling (); |
|
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
2969 |
| 265 | 2970 w = XWINDOW (window); |
|
10373
c5c1ffa3755e
(Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents:
10302
diff
changeset
|
2971 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
|
2972 if (defalt < 1) defalt = 1; |
| 265 | 2973 |
| 2974 /* Don't screw up if window_scroll gets an error. */ | |
| 2975 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
| 2976 | |
| 2977 Fset_buffer (w->buffer); | |
| 2978 SET_PT (marker_position (w->pointm)); | |
| 2979 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2980 if (NILP (arg)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2981 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
|
2982 else if (EQ (arg, Qminus)) |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2983 window_scroll (window, -defalt, 1, 1); |
| 265 | 2984 else |
| 2985 { | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2986 if (CONSP (arg)) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2987 arg = Fcar (arg); |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
2988 CHECK_NUMBER (arg, 0); |
|
16751
d393cbcfb69c
(window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents:
16658
diff
changeset
|
2989 window_scroll (window, XINT (arg), 0, 1); |
| 265 | 2990 } |
| 2991 | |
| 7347 | 2992 Fset_marker (w->pointm, make_number (PT), Qnil); |
|
1931
129d8225f748
* keyboard.c (recursive_edit_1, command_loop_1): Pass the proper
Jim Blandy <jimb@redhat.com>
parents:
1829
diff
changeset
|
2993 unbind_to (count, Qnil); |
| 265 | 2994 |
| 2995 return Qnil; | |
| 2996 } | |
| 2997 | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
2998 DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P", |
| 265 | 2999 "Scroll selected window display ARG columns left.\n\ |
| 3000 Default for ARG is window width minus 2.") | |
| 3001 (arg) | |
| 3002 register Lisp_Object arg; | |
| 3003 { | |
| 3004 | |
| 485 | 3005 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
|
3006 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
| 265 | 3007 else |
| 3008 arg = Fprefix_numeric_value (arg); | |
| 3009 | |
| 3010 return | |
| 3011 Fset_window_hscroll (selected_window, | |
| 3012 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
| 3013 + XINT (arg))); | |
| 3014 } | |
| 3015 | |
|
3621
0576930165ed
(Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents:
3535
diff
changeset
|
3016 DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P", |
| 265 | 3017 "Scroll selected window display ARG columns right.\n\ |
| 3018 Default for ARG is window width minus 2.") | |
| 3019 (arg) | |
| 3020 register Lisp_Object arg; | |
| 3021 { | |
| 485 | 3022 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
|
3023 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2); |
| 265 | 3024 else |
| 3025 arg = Fprefix_numeric_value (arg); | |
| 3026 | |
| 3027 return | |
| 3028 Fset_window_hscroll (selected_window, | |
| 3029 make_number (XINT (XWINDOW (selected_window)->hscroll) | |
| 3030 - XINT (arg))); | |
| 3031 } | |
| 3032 | |
| 3033 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", | |
| 769 | 3034 "Center point in window and redisplay frame. With ARG, put point on line ARG.\n\ |
| 265 | 3035 The desired position of point is always relative to the current window.\n\ |
| 769 | 3036 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
|
3037 If ARG is omitted or nil, erases the entire frame and then\n\ |
| 769 | 3038 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
|
3039 (arg) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3040 register Lisp_Object arg; |
| 265 | 3041 { |
| 3042 register struct window *w = XWINDOW (selected_window); | |
| 3043 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
|
3044 struct position pos; |
| 265 | 3045 |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3046 if (NILP (arg)) |
| 265 | 3047 { |
| 769 | 3048 extern int frame_garbaged; |
| 265 | 3049 |
| 769 | 3050 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
|
3051 XSETFASTINT (arg, ht / 2); |
| 265 | 3052 } |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3053 else if (CONSP (arg)) /* Just C-u. */ |
| 265 | 3054 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3055 XSETFASTINT (arg, ht / 2); |
| 265 | 3056 } |
| 3057 else | |
| 3058 { | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3059 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
|
3060 CHECK_NUMBER (arg, 0); |
| 265 | 3061 } |
| 3062 | |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3063 if (XINT (arg) < 0) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3064 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
|
3065 |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
15905
diff
changeset
|
3066 pos = *vmotion (PT, - XINT (arg), w); |
|
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
3067 |
|
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
3068 Fset_marker (w->start, make_number (pos.bufpos), w->buffer); |
|
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
3069 w->start_at_line_beg = ((pos.bufpos == BEGV |
|
17019
481772010c86
(Fpos_visible_in_window_p): Bug fix. Specify big
Karl Heuer <kwzh@gnu.org>
parents:
16982
diff
changeset
|
3070 || FETCH_BYTE (pos.bufpos - 1) == '\n') |
|
9243
c35d0ed03819
(Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents:
9114
diff
changeset
|
3071 ? Qt : Qnil); |
| 265 | 3072 w->force_start = Qt; |
| 3073 | |
| 3074 return Qnil; | |
| 3075 } | |
| 3076 | |
| 3077 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, | |
| 3078 1, 1, "P", | |
| 3079 "Position point relative to window.\n\ | |
|
8411
9a68cba600fc
(Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8366
diff
changeset
|
3080 With no argument, position point at center of window.\n\ |
| 769 | 3081 An argument specifies frame line; zero means top of window,\n\ |
| 265 | 3082 negative means relative to bottom of window.") |
| 3083 (arg) | |
| 3084 register Lisp_Object arg; | |
| 3085 { | |
| 3086 register struct window *w = XWINDOW (selected_window); | |
| 3087 register int height = window_internal_height (w); | |
| 3088 register int start; | |
|
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
3089 Lisp_Object window; |
| 265 | 3090 |
| 485 | 3091 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
|
3092 XSETFASTINT (arg, height / 2); |
| 265 | 3093 else |
| 3094 { | |
| 3095 arg = Fprefix_numeric_value (arg); | |
| 3096 if (XINT (arg) < 0) | |
| 3097 XSETINT (arg, XINT (arg) + height); | |
| 3098 } | |
| 3099 | |
| 3100 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
|
3101 XSETWINDOW (window, w); |
| 265 | 3102 if (start < BEGV || start > ZV) |
| 3103 { | |
|
6341
dfc758dd2b08
(window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents:
6326
diff
changeset
|
3104 Fvertical_motion (make_number (- (height / 2)), window); |
| 7347 | 3105 Fset_marker (w->start, make_number (PT), w->buffer); |
| 265 | 3106 w->start_at_line_beg = Fbolp (); |
| 3107 w->force_start = Qt; | |
| 3108 } | |
| 3109 else | |
| 3110 SET_PT (start); | |
| 3111 | |
|
6326
5e662ad3f594
(Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents:
6269
diff
changeset
|
3112 return Fvertical_motion (arg, window); |
| 265 | 3113 } |
| 3114 | |
| 3115 struct save_window_data | |
| 3116 { | |
|
15712
a272ccf6c225
(struct save_window_data, struct saved_window): First
Karl Heuer <kwzh@gnu.org>
parents:
15385
diff
changeset
|
3117 EMACS_INT size_from_Lisp_Vector_struct; |
| 265 | 3118 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
|
3119 Lisp_Object frame_width, frame_height, frame_menu_bar_lines; |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3120 Lisp_Object selected_frame; |
| 265 | 3121 Lisp_Object current_window; |
| 3122 Lisp_Object current_buffer; | |
| 3123 Lisp_Object minibuf_scroll_window; | |
| 3124 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
|
3125 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
|
3126 /* 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
|
3127 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
|
3128 Lisp_Object min_width, min_height; |
| 265 | 3129 /* A vector, interpreted as a struct saved_window */ |
| 3130 Lisp_Object saved_windows; | |
| 3131 }; | |
|
1326
709532b86646
* window.c (SAVE_WINDOW_DATA_SIZE): Define this using sizeof,
Jim Blandy <jimb@redhat.com>
parents:
1325
diff
changeset
|
3132 |
| 265 | 3133 /* This is saved as a Lisp_Vector */ |
| 3134 struct saved_window | |
| 3135 { | |
| 3136 /* 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
|
3137 EMACS_INT size_from_Lisp_Vector_struct; |
| 265 | 3138 struct Lisp_Vector *next_from_Lisp_Vector_struct; |
| 3139 | |
| 3140 Lisp_Object window; | |
| 3141 Lisp_Object buffer, start, pointm, mark; | |
| 3142 Lisp_Object left, top, width, height, hscroll; | |
| 3143 Lisp_Object parent, prev; | |
| 3144 Lisp_Object start_at_line_beg; | |
| 3145 Lisp_Object display_table; | |
| 3146 }; | |
| 3147 #define SAVED_WINDOW_VECTOR_SIZE 14 /* Arg to Fmake_vector */ | |
| 3148 | |
| 3149 #define SAVED_WINDOW_N(swv,n) \ | |
| 3150 ((struct saved_window *) (XVECTOR ((swv)->contents[(n)]))) | |
| 3151 | |
| 3152 DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0, | |
|
13946
b7670a09033c
(Fprevious_window, Fwindow_configuration_p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13918
diff
changeset
|
3153 "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
|
3154 (object) |
|
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3155 Lisp_Object object; |
| 265 | 3156 { |
|
14089
415aa106fa17
(Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents:
14027
diff
changeset
|
3157 if (WINDOW_CONFIGURATIONP (object)) |
| 265 | 3158 return Qt; |
| 3159 return Qnil; | |
| 3160 } | |
| 3161 | |
| 3162 | |
|
2297
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
3163 DEFUN ("set-window-configuration", Fset_window_configuration, |
|
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
3164 Sset_window_configuration, 1, 1, 0, |
| 265 | 3165 "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\ |
| 3166 CONFIGURATION must be a value previously returned\n\ | |
| 3167 by `current-window-configuration' (which see).") | |
|
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
3168 (configuration) |
|
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
3169 Lisp_Object configuration; |
| 265 | 3170 { |
| 3171 register struct save_window_data *data; | |
| 3172 struct Lisp_Vector *saved_windows; | |
| 3173 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
|
3174 Lisp_Object frame; |
| 769 | 3175 FRAME_PTR f; |
| 265 | 3176 |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
3177 while (!WINDOW_CONFIGURATIONP (configuration)) |
| 265 | 3178 { |
|
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
3179 configuration = wrong_type_argument (intern ("window-configuration-p"), |
|
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
3180 configuration); |
| 265 | 3181 } |
| 3182 | |
|
1016
817b0ce337d7
* window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents:
983
diff
changeset
|
3183 data = (struct save_window_data *) XVECTOR (configuration); |
| 265 | 3184 saved_windows = XVECTOR (data->saved_windows); |
| 3185 | |
| 3186 new_current_buffer = data->current_buffer; | |
| 485 | 3187 if (NILP (XBUFFER (new_current_buffer)->name)) |
| 265 | 3188 new_current_buffer = Qnil; |
| 3189 | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3190 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
|
3191 f = XFRAME (frame); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3192 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3193 /* 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
|
3194 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
|
3195 if (FRAME_LIVE_P (f)) |
| 265 | 3196 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3197 register struct window *w; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3198 register struct saved_window *p; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3199 int k; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3200 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3201 /* 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
|
3202 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
|
3203 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
|
3204 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
|
3205 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
|
3206 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
|
3207 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3208 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3209 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
|
3210 || XFASTINT (data->frame_width) != previous_frame_width) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3211 change_frame_size (f, data->frame_height, data->frame_width, 0, 0); |
|
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
3212 #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
|
3213 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
|
3214 != previous_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
|
3215 x_set_menu_bar_lines (f, data->frame_menu_bar_lines, 0); |
|
6852
5cc78dd8efc3
(Fset_window_configuration): Only call X fns if HAVE_X_WINDOWS.
Karl Heuer <kwzh@gnu.org>
parents:
6851
diff
changeset
|
3216 #endif |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3217 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3218 windows_or_buffers_changed++; |
|
10666
e1dfb47b664e
(Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents:
10461
diff
changeset
|
3219 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
|
3220 |
|
8931
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
3221 /* 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
|
3222 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
|
3223 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
|
3224 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
|
3225 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3226 /* Kludge Alert! |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3227 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
|
3228 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
|
3229 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3230 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
|
3231 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
|
3232 dead. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3233 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
|
3234 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3235 for (k = 0; k < saved_windows->size; k++) |
| 265 | 3236 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3237 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
|
3238 w = XWINDOW (p->window); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3239 w->next = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3240 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3241 if (!NILP (p->parent)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3242 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
|
3243 XFASTINT (p->parent))->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3244 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3245 w->parent = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3246 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3247 if (!NILP (p->prev)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3248 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3249 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
|
3250 XFASTINT (p->prev))->window; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3251 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
|
3252 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3253 else |
| 265 | 3254 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3255 w->prev = Qnil; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3256 if (!NILP (w->parent)) |
| 265 | 3257 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3258 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
|
3259 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3260 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
|
3261 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
|
3262 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3263 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3264 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3265 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
|
3266 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
|
3267 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3268 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3269 } |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3270 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3271 /* 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
|
3272 restore it now. */ |
|
9105
984a4b1be1d1
(Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents:
9028
diff
changeset
|
3273 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
|
3274 w->buffer = w->height; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3275 w->left = p->left; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3276 w->top = p->top; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3277 w->width = p->width; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3278 w->height = p->height; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3279 w->hscroll = p->hscroll; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3280 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
|
3281 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
|
3282 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
|
3283 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3284 /* 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
|
3285 if (NILP (p->buffer)) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3286 w->buffer = p->buffer; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3287 else |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3288 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3289 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
|
3290 /* 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
|
3291 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3292 w->buffer = p->buffer; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3293 w->start_at_line_beg = p->start_at_line_beg; |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3294 set_marker_restricted (w->start, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3295 Fmarker_position (p->start), |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3296 w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3297 set_marker_restricted (w->pointm, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3298 Fmarker_position (p->pointm), |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3299 w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3300 Fset_marker (XBUFFER (w->buffer)->mark, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3301 Fmarker_position (p->mark), w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3302 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3303 /* 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
|
3304 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
|
3305 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
|
3306 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
|
3307 && 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
|
3308 Fgoto_char (w->pointm); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3309 } |
|
3535
581c09f72dbd
(Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents:
3354
diff
changeset
|
3310 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
|
3311 /* 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
|
3312 { |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3313 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
|
3314 /* 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
|
3315 range. */ |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3316 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
|
3317 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
|
3318 w->start_at_line_beg = Qt; |
| 265 | 3319 } |
| 3320 else | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3321 /* 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
|
3322 are real. */ |
| 265 | 3323 { |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3324 /* 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
|
3325 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
|
3326 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
|
3327 w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3328 if (XMARKER (w->pointm)->buffer == 0) |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3329 set_marker_restricted (w->pointm, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3330 (make_number |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3331 (BUF_PT (XBUFFER (w->buffer)))), |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3332 w->buffer); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3333 w->start_at_line_beg = Qt; |
| 265 | 3334 } |
| 3335 } | |
| 3336 } | |
|
1237
3929b2135e58
* window.c (delete_all_subwindows): Save the window's buffer in
Jim Blandy <jimb@redhat.com>
parents:
1123
diff
changeset
|
3337 |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3338 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
|
3339 Fselect_window (data->current_window); |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3340 |
|
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
3341 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
|
3342 || (FRAMEP (data->focus_frame) |
|
1716
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
3343 && FRAME_LIVE_P (XFRAME (data->focus_frame)))) |
|
95db936d47c0
* keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents:
1685
diff
changeset
|
3344 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
|
3345 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3346 #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
|
3347 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
|
3348 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
|
3349 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
|
3350 Qnil, 0); |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3351 #endif |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3352 |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3353 /* 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
|
3354 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
|
3355 || 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
|
3356 change_frame_size (f, previous_frame_height, previous_frame_width, |
|
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3357 0, 0); |
|
16051
ccf489f8596e
Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents:
16039
diff
changeset
|
3358 #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
|
3359 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f)) |
|
19eaf70457d4
(Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents:
5990
diff
changeset
|
3360 x_set_menu_bar_lines (f, previous_frame_menu_bar_lines, 0); |
|
6852
5cc78dd8efc3
(Fset_window_configuration): Only call X fns if HAVE_X_WINDOWS.
Karl Heuer <kwzh@gnu.org>
parents:
6851
diff
changeset
|
3361 #endif |
| 265 | 3362 } |
| 3363 | |
|
8931
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
3364 /* Restore the minimum heights recorded in the configuration. */ |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
3365 window_min_height = XINT (data->min_height); |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
3366 window_min_width = XINT (data->min_width); |
|
c64388cd7346
(struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents:
8536
diff
changeset
|
3367 |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3368 /* Fselect_window will have made f the selected frame, so we |
|
2297
bb88d48c290f
(Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents:
2210
diff
changeset
|
3369 reselect the proper frame here. Fhandle_switch_frame will change the |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3370 selected window too, but that doesn't make the call to |
|
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3371 Fselect_window above totally superfluous; it still sets f's |
|
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3372 selected window. */ |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3373 if (FRAME_LIVE_P (XFRAME (data->selected_frame))) |
|
12288
36d3bd1212de
(Fset_window_configuration): Use do_switch_frame directly.
Richard M. Stallman <rms@gnu.org>
parents:
11852
diff
changeset
|
3374 do_switch_frame (data->selected_frame, Qnil, 0); |
|
1325
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3375 |
|
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3376 if (!NILP (new_current_buffer)) |
|
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3377 Fset_buffer (new_current_buffer); |
|
f03e559aac3e
* window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents:
1280
diff
changeset
|
3378 |
| 265 | 3379 Vminibuf_scroll_window = data->minibuf_scroll_window; |
| 3380 return (Qnil); | |
| 3381 } | |
| 3382 | |
| 769 | 3383 /* Mark all windows now on frame as deleted |
| 265 | 3384 by setting their buffers to nil. */ |
| 3385 | |
|
1685
8d7fc70d3103
* window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents:
1572
diff
changeset
|
3386 void |
| 265 | 3387 delete_all_subwindows (w) |
| 3388 register struct window *w; | |
| 3389 { | |
| 485 | 3390 if (!NILP (w->next)) |
| 265 | 3391 delete_all_subwindows (XWINDOW (w->next)); |
| 485 | 3392 if (!NILP (w->vchild)) |
| 265 | 3393 delete_all_subwindows (XWINDOW (w->vchild)); |
| 485 | 3394 if (!NILP (w->hchild)) |
| 265 | 3395 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
|
3396 |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3397 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
|
3398 |
|
16068
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
3399 if (!NILP (w->buffer)) |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
3400 unshow_buffer (w); |
|
b19129a8c644
(unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
3401 |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3402 /* 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
|
3403 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
|
3404 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
|
3405 vchild or hchild set. */ |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3406 w->buffer = Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3407 w->vchild = Qnil; |
|
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3408 w->hchild = Qnil; |
| 265 | 3409 } |
| 3410 | |
| 3411 static int | |
| 3412 count_windows (window) | |
| 3413 register struct window *window; | |
| 3414 { | |
| 3415 register int count = 1; | |
| 485 | 3416 if (!NILP (window->next)) |
| 265 | 3417 count += count_windows (XWINDOW (window->next)); |
| 485 | 3418 if (!NILP (window->vchild)) |
| 265 | 3419 count += count_windows (XWINDOW (window->vchild)); |
| 485 | 3420 if (!NILP (window->hchild)) |
| 265 | 3421 count += count_windows (XWINDOW (window->hchild)); |
| 3422 return count; | |
| 3423 } | |
| 3424 | |
| 3425 static int | |
| 3426 save_window_save (window, vector, i) | |
| 3427 Lisp_Object window; | |
| 3428 struct Lisp_Vector *vector; | |
| 3429 int i; | |
| 3430 { | |
| 3431 register struct saved_window *p; | |
| 3432 register struct window *w; | |
| 3433 register Lisp_Object tem; | |
| 3434 | |
| 485 | 3435 for (;!NILP (window); window = w->next) |
| 265 | 3436 { |
| 3437 p = SAVED_WINDOW_N (vector, i); | |
| 3438 w = XWINDOW (window); | |
| 3439 | |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3440 XSETFASTINT (w->temslot, i++); |
| 265 | 3441 p->window = window; |
| 3442 p->buffer = w->buffer; | |
| 3443 p->left = w->left; | |
| 3444 p->top = w->top; | |
| 3445 p->width = w->width; | |
| 3446 p->height = w->height; | |
| 3447 p->hscroll = w->hscroll; | |
| 3448 p->display_table = w->display_table; | |
| 485 | 3449 if (!NILP (w->buffer)) |
| 265 | 3450 { |
| 3451 /* Save w's value of point in the window configuration. | |
| 3452 If w is the selected window, then get the value of point | |
| 3453 from the buffer; pointm is garbage in the selected window. */ | |
| 3454 if (EQ (window, selected_window)) | |
| 3455 { | |
| 3456 p->pointm = Fmake_marker (); | |
| 3457 Fset_marker (p->pointm, BUF_PT (XBUFFER (w->buffer)), | |
| 3458 w->buffer); | |
| 3459 } | |
| 3460 else | |
|
12981
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
3461 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
|
3462 |
|
7a540e9cb21a
(save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents:
12643
diff
changeset
|
3463 p->start = Fcopy_marker (w->start, Qnil); |
| 265 | 3464 p->start_at_line_beg = w->start_at_line_beg; |
| 3465 | |
| 3466 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
|
3467 p->mark = Fcopy_marker (tem, Qnil); |
| 265 | 3468 } |
| 3469 else | |
| 3470 { | |
| 3471 p->pointm = Qnil; | |
| 3472 p->start = Qnil; | |
| 3473 p->mark = Qnil; | |
| 3474 p->start_at_line_beg = Qnil; | |
| 3475 } | |
| 3476 | |
| 485 | 3477 if (NILP (w->parent)) |
| 265 | 3478 p->parent = Qnil; |
| 3479 else | |
| 3480 p->parent = XWINDOW (w->parent)->temslot; | |
| 3481 | |
| 485 | 3482 if (NILP (w->prev)) |
| 265 | 3483 p->prev = Qnil; |
| 3484 else | |
| 3485 p->prev = XWINDOW (w->prev)->temslot; | |
| 3486 | |
| 485 | 3487 if (!NILP (w->vchild)) |
| 265 | 3488 i = save_window_save (w->vchild, vector, i); |
| 485 | 3489 if (!NILP (w->hchild)) |
| 265 | 3490 i = save_window_save (w->hchild, vector, i); |
| 3491 } | |
| 3492 | |
| 3493 return i; | |
| 3494 } | |
| 3495 | |
|
16485
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
3496 DEFUN ("current-window-configuration", Fcurrent_window_configuration, |
|
9b919c5464a4
Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents:
16392
diff
changeset
|
3497 Scurrent_window_configuration, 0, 1, 0, |
| 769 | 3498 "Return an object representing the current window configuration of FRAME.\n\ |
| 3499 If FRAME is nil or omitted, use the selected frame.\n\ | |
| 265 | 3500 This describes the number of windows, their sizes and current buffers,\n\ |
| 3501 and for each displayed buffer, where display starts, and the positions of\n\ | |
| 3502 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
|
3503 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
|
3504 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
|
3505 redirection (see `redirect-frame-focus').") |
| 769 | 3506 (frame) |
| 3507 Lisp_Object frame; | |
| 265 | 3508 { |
| 3509 register Lisp_Object tem; | |
| 3510 register int n_windows; | |
| 3511 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
|
3512 register struct Lisp_Vector *vec; |
| 265 | 3513 register int i; |
| 769 | 3514 FRAME_PTR f; |
| 265 | 3515 |
| 769 | 3516 if (NILP (frame)) |
| 3517 f = selected_frame; | |
| 358 | 3518 else |
| 3519 { | |
| 769 | 3520 CHECK_LIVE_FRAME (frame, 0); |
| 3521 f = XFRAME (frame); | |
| 358 | 3522 } |
| 3523 | |
| 769 | 3524 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
|
3525 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
|
3526 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
|
3527 vec->contents[i] = Qnil; |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
3528 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
|
3529 data = (struct save_window_data *)vec; |
|
5cda62e4222a
(Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents:
9970
diff
changeset
|
3530 |
|
9324
ac6a5691607f
(make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents:
9282
diff
changeset
|
3531 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
|
3532 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
|
3533 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f)); |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
3534 XSETFRAME (data->selected_frame, selected_frame); |
| 769 | 3535 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
|
3536 XSETBUFFER (data->current_buffer, current_buffer); |
| 265 | 3537 data->minibuf_scroll_window = Vminibuf_scroll_window; |
| 769 | 3538 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
|
3539 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
|
3540 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
|
3541 XSETINT (data->min_width, window_min_width); |
| 265 | 3542 tem = Fmake_vector (make_number (n_windows), Qnil); |
| 3543 data->saved_windows = tem; | |
| 3544 for (i = 0; i < n_windows; i++) | |
| 3545 XVECTOR (tem)->contents[i] | |
| 3546 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil); | |
| 769 | 3547 save_window_save (FRAME_ROOT_WINDOW (f), |
| 265 | 3548 XVECTOR (tem), 0); |
|
9282
f4fa46f6a032
(Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents:
9243
diff
changeset
|
3549 XSETWINDOW_CONFIGURATION (tem, data); |
| 265 | 3550 return (tem); |
| 3551 } | |
| 3552 | |
| 3553 DEFUN ("save-window-excursion", Fsave_window_excursion, Ssave_window_excursion, | |
| 3554 0, UNEVALLED, 0, | |
| 3555 "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
|
3556 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
|
3557 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
|
3558 Also restore which buffer is current.\n\ |
|
59baddaf62a0
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8053
diff
changeset
|
3559 But do not preserve point in the current buffer.\n\ |
| 265 | 3560 Does not restore the value of point in current buffer.") |
| 3561 (args) | |
| 3562 Lisp_Object args; | |
| 3563 { | |
| 3564 register Lisp_Object val; | |
| 3565 register int count = specpdl_ptr - specpdl; | |
| 3566 | |
| 3567 record_unwind_protect (Fset_window_configuration, | |
| 358 | 3568 Fcurrent_window_configuration (Qnil)); |
| 265 | 3569 val = Fprogn (args); |
| 3570 return unbind_to (count, val); | |
| 3571 } | |
| 3572 | |
| 3573 init_window_once () | |
| 3574 { | |
| 769 | 3575 selected_frame = make_terminal_frame (); |
|
11771
dca858ca7bc8
[MULTI_FRAME] (init_window_once): Set Vterminal_frame
Karl Heuer <kwzh@gnu.org>
parents:
11750
diff
changeset
|
3576 XSETFRAME (Vterminal_frame, selected_frame); |
| 769 | 3577 minibuf_window = selected_frame->minibuffer_window; |
| 3578 selected_window = selected_frame->selected_window; | |
| 3579 last_nonminibuf_frame = selected_frame; | |
|
14445
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
3580 |
|
e73b37519cdc
(Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents:
14204
diff
changeset
|
3581 window_initialized = 1; |
| 265 | 3582 } |
| 3583 | |
| 3584 syms_of_window () | |
| 3585 { | |
| 3586 Qwindowp = intern ("windowp"); | |
| 3587 staticpro (&Qwindowp); | |
| 3588 | |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
3589 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
|
3590 staticpro (&Qwindow_live_p); |
|
1444
559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents:
1345
diff
changeset
|
3591 |
|
11405
645e3883da72
(temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents:
11307
diff
changeset
|
3592 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
|
3593 staticpro (&Qtemp_buffer_show_hook); |
|
d3dee0c530d6
(Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents:
10373
diff
changeset
|
3594 |
| 265 | 3595 DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, |
| 3596 "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
|
3597 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
|
3598 Used by `with-output-to-temp-buffer'.\n\ |
|
b8d3aea195cd
(syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11427
diff
changeset
|
3599 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
|
3600 the buffer; `temp-buffer-show-hook' is not run unless this function runs it."); |
| 265 | 3601 Vtemp_buffer_show_function = Qnil; |
| 3602 | |
| 3603 DEFVAR_LISP ("display-buffer-function", &Vdisplay_buffer_function, | |
| 3604 "If non-nil, function to call to handle `display-buffer'.\n\ | |
| 3605 It will receive two args, the buffer and a flag which if non-nil means\n\ | |
| 3606 that the currently selected window is not acceptable.\n\ | |
| 3607 Commands such as `switch-to-buffer-other-window' and `find-file-other-window'\n\ | |
| 3608 work using this function."); | |
| 3609 Vdisplay_buffer_function = Qnil; | |
| 3610 | |
| 3611 DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window, | |
| 3612 "Non-nil means it is the window that C-M-v in minibuffer should scroll."); | |
| 3613 Vminibuf_scroll_window = Qnil; | |
| 3614 | |
| 3615 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer, | |
| 3616 "If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window."); | |
| 3617 Vother_window_scroll_buffer = Qnil; | |
| 3618 | |
| 769 | 3619 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames, |
| 780 | 3620 "*Non-nil means `display-buffer' should make a separate frame."); |
| 769 | 3621 pop_up_frames = 0; |
| 265 | 3622 |
| 769 | 3623 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
|
3624 "Function to call to handle automatic new frame creation.\n\ |
| 769 | 3625 It is called with no arguments and should return a newly created frame.\n\ |
| 265 | 3626 \n\ |
| 769 | 3627 A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ |
| 3628 where `pop-up-frame-alist' would hold the default frame parameters."); | |
| 3629 Vpop_up_frame_function = Qnil; | |
| 265 | 3630 |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3631 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
|
3632 "*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
|
3633 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
|
3634 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
|
3635 \n\ |
|
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
3636 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
|
3637 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
|
3638 (BUFFER FRAME-PARAMETERS...) (BUFFER FUNCTION OTHER-ARGS...)\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
3639 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
|
3640 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
|
3641 followed by OTHER-ARGS--it can display BUFFER in any way it likes.\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
3642 All this is done by the function found in `special-display-function'."); |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3643 Vspecial_display_buffer_names = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3644 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3645 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
|
3646 "*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
|
3647 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
|
3648 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
|
3649 using `special-display-function'.\n\ |
|
10808
64fcde7a1438
(window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents:
10666
diff
changeset
|
3650 \n\ |
|
16338
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
3651 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
|
3652 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
|
3653 (REGEXP FRAME-PARAMETERS...) (REGEXP FUNCTION OTHER-ARGS...)\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
3654 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
|
3655 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
|
3656 followed by OTHER-ARGS--it can display the buffer in any way it likes.\n\ |
|
c39e44468b7a
(syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
16297
diff
changeset
|
3657 All this is done by the function found in `special-display-function'."); |
|
7056
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3658 Vspecial_display_regexps = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3659 |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3660 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
|
3661 "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
|
3662 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
|
3663 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
|
3664 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
|
3665 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
|
3666 \n\ |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3667 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
|
3668 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
|
3669 Vspecial_display_function = Qnil; |
|
0a18af7eb587
Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents:
6982
diff
changeset
|
3670 |
|
10958
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
3671 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
|
3672 "*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
|
3673 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
|
3674 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
|
3675 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
|
3676 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
3677 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
|
3678 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
|
3679 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
|
3680 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
|
3681 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
3682 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
|
3683 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
|
3684 |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
3685 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
|
3686 "*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
|
3687 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
|
3688 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
|
3689 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
|
3690 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
3691 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
|
3692 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
|
3693 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
|
3694 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
|
3695 \n\ |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
3696 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
|
3697 Vsame_window_regexps = Qnil; |
|
c0d821d95739
(Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents:
10808
diff
changeset
|
3698 |
| 265 | 3699 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, |
| 3700 "*Non-nil means display-buffer should make new windows."); | |
| 3701 pop_up_windows = 1; | |
| 3702 | |
| 3703 DEFVAR_INT ("next-screen-context-lines", &next_screen_context_lines, | |
| 3704 "*Number of lines of continuity when scrolling by screenfuls."); | |
| 3705 next_screen_context_lines = 2; | |
| 3706 | |
| 3707 DEFVAR_INT ("split-height-threshold", &split_height_threshold, | |
| 3708 "*display-buffer would prefer to split the largest window if this large.\n\ | |
| 3709 If there is only one window, it is split regardless of this value."); | |
| 3710 split_height_threshold = 500; | |
| 3711 | |
| 3712 DEFVAR_INT ("window-min-height", &window_min_height, | |
| 3713 "*Delete any window less than this tall (including its mode line)."); | |
| 3714 window_min_height = 4; | |
| 3715 | |
| 3716 DEFVAR_INT ("window-min-width", &window_min_width, | |
| 3717 "*Delete any window less than this wide."); | |
| 3718 window_min_width = 10; | |
| 3719 | |
|
16980
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3720 DEFVAR_BOOL ("scroll-preserve-screen-position", |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3721 &scroll_preserve_screen_position, |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3722 "*Nonzero means scroll commands move point to keep its screen line unchanged."); |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3723 scroll_preserve_screen_position = 0; |
|
3da3a2934be5
(scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16751
diff
changeset
|
3724 |
| 265 | 3725 defsubr (&Sselected_window); |
| 3726 defsubr (&Sminibuffer_window); | |
| 3727 defsubr (&Swindow_minibuffer_p); | |
| 3728 defsubr (&Swindowp); | |
|
2210
22d78dbb3cc7
Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents:
2190
diff
changeset
|
3729 defsubr (&Swindow_live_p); |
| 265 | 3730 defsubr (&Spos_visible_in_window_p); |
| 3731 defsubr (&Swindow_buffer); | |
| 3732 defsubr (&Swindow_height); | |
| 3733 defsubr (&Swindow_width); | |
| 3734 defsubr (&Swindow_hscroll); | |
| 3735 defsubr (&Sset_window_hscroll); | |
|
13457
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
3736 defsubr (&Swindow_redisplay_end_trigger); |
|
8a1986b2cc76
(Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents:
13418
diff
changeset
|
3737 defsubr (&Sset_window_redisplay_end_trigger); |
| 265 | 3738 defsubr (&Swindow_edges); |
| 432 | 3739 defsubr (&Scoordinates_in_window_p); |
| 3740 defsubr (&Swindow_at); | |
| 265 | 3741 defsubr (&Swindow_point); |
| 3742 defsubr (&Swindow_start); | |
| 3743 defsubr (&Swindow_end); | |
| 3744 defsubr (&Sset_window_point); | |
| 3745 defsubr (&Sset_window_start); | |
| 3746 defsubr (&Swindow_dedicated_p); | |
|
722
0a2391511b46
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
708
diff
changeset
|
3747 defsubr (&Sset_window_dedicated_p); |
| 265 | 3748 defsubr (&Swindow_display_table); |
| 3749 defsubr (&Sset_window_display_table); | |
| 3750 defsubr (&Snext_window); | |
| 3751 defsubr (&Sprevious_window); | |
| 3752 defsubr (&Sother_window); | |
| 3753 defsubr (&Sget_lru_window); | |
| 3754 defsubr (&Sget_largest_window); | |
| 3755 defsubr (&Sget_buffer_window); | |
| 3756 defsubr (&Sdelete_other_windows); | |
| 3757 defsubr (&Sdelete_windows_on); | |
| 3758 defsubr (&Sreplace_buffer_in_windows); | |
| 3759 defsubr (&Sdelete_window); | |
| 3760 defsubr (&Sset_window_buffer); | |
| 3761 defsubr (&Sselect_window); | |
|
16390
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
3762 defsubr (&Sspecial_display_p); |
|
77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents:
16338
diff
changeset
|
3763 defsubr (&Ssame_window_p); |
| 265 | 3764 defsubr (&Sdisplay_buffer); |
| 3765 defsubr (&Ssplit_window); | |
| 3766 defsubr (&Senlarge_window); | |
| 3767 defsubr (&Sshrink_window); | |
| 3768 defsubr (&Sscroll_up); | |
| 3769 defsubr (&Sscroll_down); | |
| 3770 defsubr (&Sscroll_left); | |
| 3771 defsubr (&Sscroll_right); | |
|
8053
60792df5f81f
(Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7663
diff
changeset
|
3772 defsubr (&Sother_window_for_scrolling); |
| 265 | 3773 defsubr (&Sscroll_other_window); |
| 3774 defsubr (&Srecenter); | |
| 3775 defsubr (&Smove_to_window_line); | |
| 3776 defsubr (&Swindow_configuration_p); | |
| 3777 defsubr (&Sset_window_configuration); | |
| 3778 defsubr (&Scurrent_window_configuration); | |
| 3779 defsubr (&Ssave_window_excursion); | |
| 3780 } | |
| 3781 | |
| 3782 keys_of_window () | |
| 3783 { | |
| 3784 initial_define_key (control_x_map, '1', "delete-other-windows"); | |
| 3785 initial_define_key (control_x_map, '2', "split-window"); | |
| 3786 initial_define_key (control_x_map, '0', "delete-window"); | |
| 3787 initial_define_key (control_x_map, 'o', "other-window"); | |
| 3788 initial_define_key (control_x_map, '^', "enlarge-window"); | |
| 3789 initial_define_key (control_x_map, '<', "scroll-left"); | |
| 3790 initial_define_key (control_x_map, '>', "scroll-right"); | |
| 3791 | |
| 3792 initial_define_key (global_map, Ctl ('V'), "scroll-up"); | |
| 3793 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); | |
| 3794 initial_define_key (meta_map, 'v', "scroll-down"); | |
| 3795 | |
| 3796 initial_define_key (global_map, Ctl('L'), "recenter"); | |
| 3797 initial_define_key (meta_map, 'r', "move-to-window-line"); | |
| 3798 } |
