annotate src/window.c @ 34487:5cdf7acaeb2d

Add obsolete.
author Dave Love <fx@gnu.org>
date Tue, 12 Dec 2000 15:11:04 +0000
parents fef41c786c7a
children f9d400d4653a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Window creation, deletion and examination for GNU Emacs.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 Does not include redisplay.
34261
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
3 Copyright (C) 1985,86,87,93,94,95,96,97,1998,2000
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
4 Free Software Foundation, Inc.
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 This file is part of GNU Emacs.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 GNU Emacs is free software; you can redistribute it and/or modify
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
708
030fb4635335 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 681
diff changeset
10 the Free Software Foundation; either version 2, or (at your option)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 any later version.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 GNU Emacs is distributed in the hope that it will be useful,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 GNU General Public License for more details.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14175
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14175
diff changeset
21 Boston, MA 02111-1307, USA. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 4570
diff changeset
23 #include <config.h>
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 #include "lisp.h"
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 #include "buffer.h"
31117
f390b90e3495 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 30777
diff changeset
26 #include "keyboard.h"
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
27 #include "frame.h"
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 #include "window.h"
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 #include "commands.h"
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 #include "indent.h"
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 #include "termchar.h"
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 #include "disptab.h"
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
33 #include "dispextern.h"
18657
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
34 #include "blockinput.h"
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
35 #include "intervals.h"
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
36
21825
697991d2a2c4 Conditionally include xterm.h using HAVE_X_WINDOWS.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21533
diff changeset
37 #ifdef HAVE_X_WINDOWS
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
38 #include "xterm.h"
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
39 #endif /* HAVE_X_WINDOWS */
27633
ab6c81c6edf8 [WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents: 27553
diff changeset
40 #ifdef WINDOWSNT
ab6c81c6edf8 [WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents: 27553
diff changeset
41 #include "w32term.h"
ab6c81c6edf8 [WINDOWSNT]: Include w32term.h.
Andrew Innes <andrewi@gnu.org>
parents: 27553
diff changeset
42 #endif
27956
8d38dbe58989 [MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents: 27869
diff changeset
43 #ifdef MSDOS
8d38dbe58989 [MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents: 27869
diff changeset
44 #include "msdos.h"
8d38dbe58989 [MSDOS]: Include msdos.h (for the definition of FRAME_INTERNAL_BORDER_WIDTH).
Eli Zaretskii <eliz@gnu.org>
parents: 27869
diff changeset
45 #endif
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 32710
diff changeset
46 #ifdef macintosh
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 32710
diff changeset
47 #include "macterm.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 32710
diff changeset
48 #endif
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
49
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
50 #ifndef max
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
51 #define max(a, b) ((a) < (b) ? (b) : (a))
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
52 #endif
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
54
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
55 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
25540
2b4bdd114899 (Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents: 25517
diff changeset
56 Lisp_Object Qwindow_size_fixed, Qleft_bitmap_area, Qright_bitmap_area;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
57 extern Lisp_Object Qheight, Qwidth;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58
20351
f69eb2ab4f0f Add prototypes.
Andreas Schwab <schwab@suse.de>
parents: 20090
diff changeset
59 static struct window *decode_window P_ ((Lisp_Object));
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
60 static Lisp_Object select_window_1 P_ ((Lisp_Object, int));
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
61 static int count_windows P_ ((struct window *));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
62 static int get_leaf_windows P_ ((struct window *, struct window **, int));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
63 static void window_scroll P_ ((Lisp_Object, int, int, int));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
64 static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
65 static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
66 static int window_min_size_1 P_ ((struct window *, int));
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
67 static int window_min_size P_ ((struct window *, int, int, int *));
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
68 static void size_window P_ ((Lisp_Object, int, int, int));
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
69 static int freeze_window_start P_ ((struct window *, void *));
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
70 static int window_fixed_size_p P_ ((struct window *, int, int));
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
71 static void enlarge_window P_ ((Lisp_Object, int, int));
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
72 static Lisp_Object window_list P_ ((void));
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
73 static int add_window_to_list P_ ((struct window *, void *));
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
74 static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
75 Lisp_Object));
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
76 static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object,
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
77 Lisp_Object, int));
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
78 static void decode_next_window_args P_ ((Lisp_Object *, Lisp_Object *,
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
79 Lisp_Object *));
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
80 static int foreach_window_1 P_ ((struct window *,
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
81 int (* fn) (struct window *, void *),
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
82 void *));
33619
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
83 static Lisp_Object window_list_1 P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
84
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 /* This is the window in which the terminal's cursor should
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 be left when nothing is being done with it. This must
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 always be a leaf window, and its buffer is selected by
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 the top level editing loop at the end of each command.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 This value is always the same as
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
91 FRAME_SELECTED_WINDOW (selected_frame). */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 Lisp_Object selected_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
95 /* A list of all windows for use by next_window and Fwindow_list.
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
96 Functions creating or deleting windows should invalidate this cache
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
97 by setting it to nil. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
98
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
99 Lisp_Object Vwindow_list;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
100
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
101 /* The mini-buffer window of the selected frame.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
102 Note that you cannot test for mini-bufferness of an arbitrary window
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
103 by comparing against this; but you can test for mini-bufferness of
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 the selected window. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
105
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 Lisp_Object minibuf_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 /* Non-nil means it is the window for C-M-v to scroll
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
109 when the mini-buffer is selected. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
110
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 Lisp_Object Vminibuf_scroll_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 /* Non-nil means this is the buffer whose window C-M-v should scroll. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
114
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 Lisp_Object Vother_window_scroll_buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 /* Non-nil means it's function to call to display temp buffers. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
118
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 Lisp_Object Vtemp_buffer_show_function;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 /* If a window gets smaller than either of these, it is removed. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
122
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 int window_min_height;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 int window_min_width;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 /* Nonzero implies Fdisplay_buffer should create windows. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
127
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 int pop_up_windows;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
130 /* Nonzero implies make new frames for Fdisplay_buffer. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
131
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
132 int pop_up_frames;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
134 /* Nonzero means reuse existing frames for displaying buffers. */
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
135
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
136 int display_buffer_reuse_frames;
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
137
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 /* Non-nil means use this function instead of default */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
139
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
140 Lisp_Object Vpop_up_frame_function;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 /* Function to call to handle Fdisplay_buffer. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
143
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 Lisp_Object Vdisplay_buffer_function;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145
34261
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
146 /* Non-nil means that Fdisplay_buffer should even the heights of windows. */
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
147
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
148 Lisp_Object Veven_window_heights;
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
149
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
150 /* List of buffer *names* for buffers that should have their own frames. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
151
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
152 Lisp_Object Vspecial_display_buffer_names;
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
153
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
154 /* List of regexps for buffer names that should have their own frames. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
155
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
156 Lisp_Object Vspecial_display_regexps;
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
157
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
158 /* Function to pop up a special frame. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
159
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
160 Lisp_Object Vspecial_display_function;
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
161
10958
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
162 /* List of buffer *names* for buffers to appear in selected window. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
163
10958
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
164 Lisp_Object Vsame_window_buffer_names;
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
165
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
166 /* List of regexps for buffer names to appear in selected window. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
167
10958
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
168 Lisp_Object Vsame_window_regexps;
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
169
10461
d3dee0c530d6 (Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 10373
diff changeset
170 /* Hook run at end of temp_output_buffer_show. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
171
10461
d3dee0c530d6 (Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 10373
diff changeset
172 Lisp_Object Qtemp_buffer_show_hook;
d3dee0c530d6 (Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 10373
diff changeset
173
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
174 /* Fdisplay_buffer always splits the largest window
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 if that window is more than this high. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
176
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 int split_height_threshold;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 /* Number of lines of continuity in scrolling by screenfuls. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
180
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 int next_screen_context_lines;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 /* Incremented for each window created. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
184
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 static int sequence_number;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186
14445
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
187 /* Nonzero after init_window_once has finished. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
188
14445
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
189 static int window_initialized;
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
190
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
191 /* Hook to run when window config changes. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
192
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
193 Lisp_Object Qwindow_configuration_change_hook;
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
194 Lisp_Object Vwindow_configuration_change_hook;
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
195
16980
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
196 /* Nonzero means scroll commands try to put point
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
197 at the same screen height as previously. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
198
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
199 Lisp_Object Vscroll_preserve_screen_position;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
200
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
201 #if 0 /* This isn't used anywhere. */
17962
8621a73a8890 (syms_of_window): Initialize inhibit_frame_unsplittable.
Richard M. Stallman <rms@gnu.org>
parents: 17955
diff changeset
202 /* Nonzero means we can split a frame even if it is "unsplittable". */
17955
3140e48262f9 frame-override-unsplittable/inhibit-frame-unsplittable name change.
Simon Marshall <simon@gnu.org>
parents: 17952
diff changeset
203 static int inhibit_frame_unsplittable;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
204 #endif /* 0 */
17540
eb82c4de9dea (frame_allow_splitting): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17365
diff changeset
205
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 #define min(a, b) ((a) < (b) ? (a) : (b))
14149
0d67df27dc2a (Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents: 14089
diff changeset
207
16980
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
208 extern int scroll_margin;
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
209
14149
0d67df27dc2a (Fset_window_buffer): Call the window-scroll-functions.
Richard M. Stallman <rms@gnu.org>
parents: 14089
diff changeset
210 extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
213 "Returns t if OBJECT is a window.")
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
214 (object)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
215 Lisp_Object object;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
217 return WINDOWP (object) ? Qt : Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219
2210
22d78dbb3cc7 Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents: 2190
diff changeset
220 DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
221 "Returns t if OBJECT is a window which is currently visible.")
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
222 (object)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
223 Lisp_Object object;
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
224 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
225 return (WINDOWP (object) && ! NILP (XWINDOW (object)->buffer) ? Qt : Qnil);
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
226 }
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
227
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 Lisp_Object
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 make_window ()
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 {
9970
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
231 Lisp_Object val;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 register struct window *p;
9970
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
233 register struct Lisp_Vector *vec;
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
234 int i;
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
235
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
236 vec = allocate_vectorlike ((EMACS_INT) VECSIZE (struct window));
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
237 for (i = 0; i < VECSIZE (struct window); i++)
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
238 vec->contents[i] = Qnil;
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
239 vec->size = VECSIZE (struct window);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
240 p = (struct window *) vec;
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
241 XSETFASTINT (p->sequence_number, ++sequence_number);
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
242 XSETFASTINT (p->left, 0);
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
243 XSETFASTINT (p->top, 0);
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
244 XSETFASTINT (p->height, 0);
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
245 XSETFASTINT (p->width, 0);
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
246 XSETFASTINT (p->hscroll, 0);
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
247 p->orig_top = p->orig_height = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 p->start = Fmake_marker ();
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 p->pointm = Fmake_marker ();
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
250 XSETFASTINT (p->use_time, 0);
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
251 p->frame = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 p->display_table = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 p->dedicated = Qnil;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
254 p->pseudo_window_p = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
255 bzero (&p->cursor, sizeof (p->cursor));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
256 bzero (&p->last_cursor, sizeof (p->last_cursor));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
257 bzero (&p->phys_cursor, sizeof (p->phys_cursor));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
258 p->desired_matrix = p->current_matrix = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
259 p->phys_cursor_type = -1;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
260 p->must_be_updated_p = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
261 XSETFASTINT (p->window_end_vpos, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
262 XSETFASTINT (p->window_end_pos, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
263 p->window_end_valid = Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
264 p->vscroll = 0;
9970
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
265 XSETWINDOW (val, p);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
266 XSETFASTINT (p->last_point, 0);
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
267 p->frozen_window_start_p = 0;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
268
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
269 Vwindow_list = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 return val;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 "Return the window that the cursor now appears in and commands apply to.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 ()
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 return selected_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279
1123
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
280 DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
281 "Return the window used now for minibuffers.\n\
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
282 If the optional argument FRAME is specified, return the minibuffer window\n\
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
283 used by that frame.")
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
284 (frame)
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
285 Lisp_Object frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 {
1123
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
287 if (NILP (frame))
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
288 frame = selected_frame;
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
289 CHECK_LIVE_FRAME (frame, 0);
1123
55e605674fb1 * window.c (minibuffer_window): Accept an optional FRAME argument;
Jim Blandy <jimb@redhat.com>
parents: 1049
diff changeset
290 return FRAME_MINIBUF_WINDOW (XFRAME (frame));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
293 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0,
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 "Returns non-nil if WINDOW is a minibuffer window.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 struct window *w = decode_window (window);
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
299 return MINI_WINDOW_P (w) ? Qt : Qnil;
32710
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
300 }
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
301
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
302
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p,
32710
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
304 Spos_visible_in_window_p, 0, 3, 0,
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
305 "Return t if position POS is currently on the frame in WINDOW.\n\
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
306 Return nil if that position is scrolled vertically out of view.\n\
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
307 If a character is only partially visible, nil is returned, unless the\n\
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
308 optional argument PARTIALLY is non-nil.\n\
32937
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
309 POS defaults to point in WINDOW; WINDOW defaults to the selected window.")
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
310 (pos, window, partially)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
311 Lisp_Object pos, window, partially;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 register struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 register int posint;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 register struct buffer *buf;
25300
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
316 struct text_pos top;
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
317 Lisp_Object in_window;
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
318 int fully_p;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319
32937
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
320 w = decode_window (window);
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
321 buf = XBUFFER (w->buffer);
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
322 SET_TEXT_POS_FROM_MARKER (top, w->start);
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
323
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
324 if (!NILP (pos))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 CHECK_NUMBER_COERCE_MARKER (pos, 0);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 posint = XINT (pos);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 }
32937
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
329 else if (w == XWINDOW (selected_window))
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
330 posint = PT;
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
331 else
dc58e218a878 (Fpos_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32928
diff changeset
332 posint = XMARKER (w->pointm)->charpos;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
333
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
334 /* If position is above window start, it's not visible. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
335 if (posint < CHARPOS (top))
25300
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
336 in_window = Qnil;
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
337 else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf)
32710
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
338 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf)
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
339 && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos))
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
340 {
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
341 /* If frame is up-to-date, and POSINT is < window end pos, use
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
342 that info. This doesn't work for POSINT == end pos, because
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
343 the window end pos is actually the position _after_ the last
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
344 char in the window. */
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
345 if (NILP (partially))
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
346 {
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
347 pos_visible_p (w, posint, &fully_p, NILP (partially));
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
348 in_window = fully_p ? Qt : Qnil;
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
349 }
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
350 else
32710
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
351 in_window = Qt;
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
352 }
25300
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
353 else if (posint > BUF_ZV (buf))
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
354 in_window = Qnil;
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
355 else if (CHARPOS (top) < BUF_BEGV (buf) || CHARPOS (top) > BUF_ZV (buf))
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
356 /* If window start is out of range, do something reasonable. */
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
357 in_window = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 {
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
360 if (pos_visible_p (w, posint, &fully_p, NILP (partially)))
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
361 in_window = !NILP (partially) || fully_p ? Qt : Qnil;
32710
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
362 else
cd7dca826a03 (pos_fully_visible_in_window_p):
Miles Bader <miles@gnu.org>
parents: 32426
diff changeset
363 in_window = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 }
25300
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
365
096b78b6cc2e (Fpos_visible_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 25268
diff changeset
366 return in_window;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 }
32871
361743be1fa8 (pos_fully_visible_p): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 32824
diff changeset
368
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 static struct window *
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 decode_window (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 register Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
374 if (NILP (window))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 return XWINDOW (selected_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
377 CHECK_LIVE_WINDOW (window, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 return XWINDOW (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 "Return the buffer that WINDOW is displaying.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 return decode_window (window)->buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 "Return the number of lines in WINDOW (including its mode line).")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 return decode_window (window)->height;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0,
6242
ed4b06e1975b (Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 6232
diff changeset
398 "Return the number of display columns in WINDOW.\n\
ed4b06e1975b (Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 6232
diff changeset
399 This is the width that is usable columns available for text in WINDOW.\n\
ed4b06e1975b (Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 6232
diff changeset
400 If you want to find out how many columns WINDOW takes up,\n\
ed4b06e1975b (Fwindow_width): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 6232
diff changeset
401 use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))).")
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404 {
6576
851ee89bae86 (Fwindow_width): Delete unnecessary variable declarations.
Karl Heuer <kwzh@gnu.org>
parents: 6517
diff changeset
405 return make_number (window_internal_width (decode_window (window)));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 "Return the number of columns by which WINDOW is scrolled from left margin.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 return decode_window (window)->hscroll;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 "Set number of columns WINDOW is scrolled from left margin to NCOL.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 NCOL should be zero or positive.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 (window, ncol)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 register Lisp_Object window, ncol;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 register struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 CHECK_NUMBER (ncol, 1);
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
425 if (XINT (ncol) < 0) XSETFASTINT (ncol, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 w = decode_window (window);
1525
f79a22ad87d0 * window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents: 1444
diff changeset
427 if (XINT (w->hscroll) != XINT (ncol))
25375
919b568e4108 (Fset_window_hscroll): Set
Gerd Moellmann <gerd@gnu.org>
parents: 25356
diff changeset
428 /* Prevent redisplay shortcuts */
919b568e4108 (Fset_window_hscroll): Set
Gerd Moellmann <gerd@gnu.org>
parents: 25356
diff changeset
429 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 w->hscroll = ncol;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 return ncol;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433
13457
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
434 DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
435 Swindow_redisplay_end_trigger, 0, 1, 0,
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
436 "Return WINDOW's redisplay end trigger value.\n\
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
437 See `set-window-redisplay-end-trigger' for more information.")
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
438 (window)
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
439 Lisp_Object window;
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
440 {
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
441 return decode_window (window)->redisplay_end_trigger;
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
442 }
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
443
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
444 DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger,
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
445 Sset_window_redisplay_end_trigger, 2, 2, 0,
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
446 "Set WINDOW's redisplay end trigger value to VALUE.\n\
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
447 VALUE should be a buffer position (typically a marker) or nil.\n\
13583
8ee401a7aeec (Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 13457
diff changeset
448 If it is a buffer position, then if redisplay in WINDOW reaches a position\n\
8ee401a7aeec (Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 13457
diff changeset
449 beyond VALUE, the functions in `redisplay-end-trigger-functions' are called\n\
8ee401a7aeec (Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 13457
diff changeset
450 with two arguments: WINDOW, and the end trigger value.\n\
8ee401a7aeec (Fset_window_redisplay_end_trigger): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 13457
diff changeset
451 Afterwards the end-trigger value is reset to nil.")
13457
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
452 (window, value)
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
453 register Lisp_Object window, value;
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
454 {
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
455 register struct window *w;
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
456
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
457 w = decode_window (window);
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
458 w->redisplay_end_trigger = value;
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
459 return value;
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
460 }
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
461
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463 "Return a list of the edge coordinates of WINDOW.\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
464 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame.\n\
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 RIGHT is one more than the rightmost column used by WINDOW,\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 and BOTTOM is one more than the bottommost row used by WINDOW\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467 and its mode-line.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 register struct window *w = decode_window (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 return Fcons (w->left, Fcons (w->top,
16297
701db778b7a4 (Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents: 16208
diff changeset
474 Fcons (make_number (WINDOW_RIGHT_EDGE (w)),
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 Fcons (make_number (XFASTINT (w->top)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 + XFASTINT (w->height)),
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 Qnil))));
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
480 /* Test if the character at column *X, row *Y is within window W.
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
481 If it is not, return 0;
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
482 if it is in the window's text area,
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
483 set *x and *y to its location relative to the upper left corner
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
484 of the window, and
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
485 return 1;
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
486 if it is on the window's modeline, return 2;
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
487 if it is on the border between the window and its right sibling,
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
488 return 3.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
489 if it is on the window's top line, return 4;
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
490 if it is in the bitmap area to the left/right of the window,
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
491 return 5 or 6, and convert *X and *Y to window-relative corrdinates.
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
492
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
493 X and Y are frame relative pixel coordinates. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
494
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
495 static int
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
496 coordinates_in_window (w, x, y)
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
497 register struct window *w;
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
498 register int *x, *y;
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
499 {
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
500 struct frame *f = XFRAME (WINDOW_FRAME (w));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
501 int left_x, right_x, top_y, bottom_y;
25462
19b101d6ee2a (coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents: 25402
diff changeset
502 int flags_area_width = FRAME_LEFT_FLAGS_AREA_WIDTH (f);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
503
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
504 /* Let's make this a global enum later, instead of using numbers
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
505 everywhere. */
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
506 enum {ON_NOTHING, ON_TEXT, ON_MODE_LINE, ON_VERTICAL_BORDER,
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
507 ON_HEADER_LINE, ON_LEFT_FRINGE, ON_RIGHT_FRINGE};
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
508
28918
e42cd428f056 (coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents: 28726
diff changeset
509 /* In what's below, we subtract 1 when computing right_x because we
e42cd428f056 (coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents: 28726
diff changeset
510 want the rightmost pixel, which is given by left_pixel+width-1. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
511 if (w->pseudo_window_p)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
512 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
513 left_x = 0;
28918
e42cd428f056 (coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents: 28726
diff changeset
514 right_x = XFASTINT (w->width) * CANON_Y_UNIT (f) - 1;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
515 top_y = WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
516 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
517 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
518 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
519 {
27850
3c13fcdeb63a (coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents: 27848
diff changeset
520 left_x = (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w)
28004
7e296e4ec801 (coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents: 27956
diff changeset
521 - FRAME_INTERNAL_BORDER_WIDTH_SAFE (f));
28918
e42cd428f056 (coordinates_in_window): Subtract 1 when computing right_x.
Eli Zaretskii <eliz@gnu.org>
parents: 28726
diff changeset
522 right_x = WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X (w) - 1;
27850
3c13fcdeb63a (coordinates_in_window): Take frame's internal border width
Gerd Moellmann <gerd@gnu.org>
parents: 27848
diff changeset
523 top_y = (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w)
28004
7e296e4ec801 (coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents: 27956
diff changeset
524 - FRAME_INTERNAL_BORDER_WIDTH_SAFE (f));
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
525 bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
526 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
527
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
528 /* On the mode line or header line? If it's near the start of
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
529 the mode or header line of window that's has a horizontal
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
530 sibling, say it's on the vertical line. That's to be able
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
531 to resize windows horizontally in case we're using toolkit
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
532 scroll bars. */
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
533
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
534 if (WINDOW_WANTS_MODELINE_P (w)
34277
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
535 && *y < bottom_y
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
536 && *y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w))
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
537 {
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
538 if (!WINDOW_RIGHTMOST_P (w)
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
539 && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width))
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
540 * CANON_X_UNIT (f)))
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
541 < CANON_X_UNIT (f) / 2))
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
542 return ON_VERTICAL_BORDER;
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
543 return ON_MODE_LINE;
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
544 }
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
545
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
546 if (WINDOW_WANTS_HEADER_LINE_P (w)
34277
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
547 && *y >= top_y
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
548 && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w))
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
549 {
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
550 if (!WINDOW_RIGHTMOST_P (w)
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
551 && (abs (*x - ((XFASTINT (w->left) + XFASTINT (w->width))
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
552 * CANON_X_UNIT (f)))
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
553 < CANON_X_UNIT (f) / 2))
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
554 return ON_VERTICAL_BORDER;
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
555 return ON_HEADER_LINE;
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
556 }
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
557
34277
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
558 /* Completely outside anything interesting? */
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
559 if (*y < top_y
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
560 || *y >= bottom_y
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
561 || *x < (left_x
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
562 - flags_area_width
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
563 - (FRAME_LEFT_SCROLL_BAR_WIDTH (f)
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
564 * CANON_X_UNIT (f)))
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
565 || *x > right_x + flags_area_width)
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
566 return ON_NOTHING;
a97360f46398 (coordinates_in_window): Check mouse on mode-line or
Gerd Moellmann <gerd@gnu.org>
parents: 34265
diff changeset
567
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
568 if (FRAME_WINDOW_P (f))
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
569 {
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
570 if (!w->pseudo_window_p
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
571 && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
572 && !WINDOW_RIGHTMOST_P (w)
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
573 && (abs (*x - right_x - flags_area_width) < CANON_X_UNIT (f) / 2))
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
574 return ON_VERTICAL_BORDER;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
575
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
576 if (*x < left_x || *x > right_x)
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
577 {
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
578 /* Other lines than the mode line don't include flags areas and
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
579 scroll bars on the left. */
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
580
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
581 /* Convert X and Y to window-relative pixel coordinates. */
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
582 *x -= left_x;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
583 *y -= top_y;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
584 return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
585 }
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
586 }
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
587 else
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
588 {
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
589 /* Need to say "*x > right_x" rather than >=, since on character
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
590 terminals, the vertical line's x coordinate is right_x. */
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
591 if (*x < left_x || *x > right_x)
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
592 {
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
593 /* Other lines than the mode line don't include flags areas and
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
594 scroll bars on the left. */
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
595
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
596 /* Convert X and Y to window-relative pixel coordinates. */
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
597 *x -= left_x;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
598 *y -= top_y;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
599 return *x < left_x ? ON_LEFT_FRINGE : ON_RIGHT_FRINGE;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
600 }
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
601
34097
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
602 /* Here, too, "*x > right_x" is because of character terminals. */
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
603 if (!w->pseudo_window_p
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
604 && !WINDOW_RIGHTMOST_P (w)
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
605 && *x > right_x - CANON_X_UNIT (f))
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
606 /* On the border on the right side of the window? Assume that
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
607 this area begins at RIGHT_X minus a canonical char width. */
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
608 return ON_VERTICAL_BORDER;
0225d8e15f2c (coordinates_in_window): Handle computations for
Gerd Moellmann <gerd@gnu.org>
parents: 34090
diff changeset
609 }
33957
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
610
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
611 /* Convert X and Y to window-relative pixel coordinates. */
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
612 *x -= left_x;
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
613 *y -= top_y;
1436ae066de4 (coordinates_in_window): If on a mode or header line,
Gerd Moellmann <gerd@gnu.org>
parents: 33619
diff changeset
614 return ON_TEXT;
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
615 }
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
616
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
617 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
618 Scoordinates_in_window_p, 2, 2, 0,
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
619 "Return non-nil if COORDINATES are in WINDOW.\n\
708
030fb4635335 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 681
diff changeset
620 COORDINATES is a cons of the form (X . Y), X and Y being distances\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
621 measured in characters from the upper-left corner of the frame.\n\
708
030fb4635335 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 681
diff changeset
622 (0 . 0) denotes the character in the upper left corner of the\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
623 frame.\n\
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
624 If COORDINATES are in the text portion of WINDOW,\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
625 the coordinates relative to the window are returned.\n\
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 722
diff changeset
626 If they are in the mode line of WINDOW, `mode-line' is returned.\n\
25546
Gerd Moellmann <gerd@gnu.org>
parents: 25544
diff changeset
627 If they are in the top mode line of WINDOW, `header-line' is returned.\n\
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
628 If they are in the bitmap-area to the left of the window,\n\
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
629 `left-bitmap-area' is returned, if they are in the area on the right of\n\
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
630 the window, `right-bitmap-area' is returned.\n\
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
631 If they are on the border between WINDOW and its right sibling,\n\
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 722
diff changeset
632 `vertical-line' is returned.")
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
633 (coordinates, window)
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
634 register Lisp_Object coordinates, window;
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
635 {
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
636 struct window *w;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
637 struct frame *f;
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
638 int x, y;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
639 Lisp_Object lx, ly;
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
640
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
641 CHECK_LIVE_WINDOW (window, 0);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
642 w = XWINDOW (window);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
643 f = XFRAME (w->frame);
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
644 CHECK_CONS (coordinates, 1);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
645 lx = Fcar (coordinates);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
646 ly = Fcdr (coordinates);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
647 CHECK_NUMBER_OR_FLOAT (lx, 1);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
648 CHECK_NUMBER_OR_FLOAT (ly, 1);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
649 x = PIXEL_X_FROM_CANON_X (f, lx);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
650 y = PIXEL_Y_FROM_CANON_Y (f, ly);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
651
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
652 switch (coordinates_in_window (w, &x, &y))
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
653 {
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
654 case 0: /* NOT in window at all. */
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
655 return Qnil;
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
656
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
657 case 1: /* In text part of window. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
658 /* X and Y are now window relative pixel coordinates.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
659 Convert them to canonical char units before returning
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
660 them. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
661 return Fcons (CANON_X_FROM_PIXEL_X (f, x),
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
662 CANON_Y_FROM_PIXEL_Y (f, y));
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
663
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
664 case 2: /* In mode line of window. */
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
665 return Qmode_line;
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
666
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
667 case 3: /* On right border of window. */
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 722
diff changeset
668 return Qvertical_line;
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
669
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
670 case 4:
25546
Gerd Moellmann <gerd@gnu.org>
parents: 25544
diff changeset
671 return Qheader_line;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
672
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
673 case 5:
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
674 return Qleft_bitmap_area;
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
675
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
676 case 6:
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
677 return Qright_bitmap_area;
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
678
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
679 default:
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
680 abort ();
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
681 }
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
682 }
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
683
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
684
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
685 /* Callback for foreach_window, used in window_from_coordinates.
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
686 Check if window W contains coordinates specified by USER_DATA which
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
687 is actually a pointer to a struct check_window_data CW.
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
688
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
689 Check if window W contains coordinates *CW->x and *CW->y. If it
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
690 does, return W in *CW->window, as Lisp_Object, and return in
30777
3e4912d77e89 Fix embedded comment.
Dave Love <fx@gnu.org>
parents: 30743
diff changeset
691 *CW->part the part of the window under coordinates *X,*Y. Return
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
692 zero from this function to stop iterating over windows. */
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
693
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
694 struct check_window_data
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
695 {
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
696 Lisp_Object *window;
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
697 int *x, *y, *part;
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
698 };
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
699
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
700 static int
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
701 check_window_containing (w, user_data)
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
702 struct window *w;
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
703 void *user_data;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
704 {
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
705 struct check_window_data *cw = (struct check_window_data *) user_data;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
706 int found;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
707
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
708 found = coordinates_in_window (w, cw->x, cw->y);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
709 if (found)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
710 {
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
711 *cw->part = found - 1;
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
712 XSETWINDOW (*cw->window, w);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
713 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
714
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
715 return !found;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
716 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
717
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
718
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
719 /* Find the window containing frame-relative pixel position X/Y and
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
720 return it as a Lisp_Object. If X, Y is on the window's modeline,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
721 set *PART to 1; if it is on the separating line between the window
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
722 and its right sibling, set it to 2; otherwise set it to 0. If
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
723 there is no window under X, Y return nil and leave *PART
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
724 unmodified. TOOL_BAR_P non-zero means detect tool-bar windows.
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
725
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
726 This function was previously implemented with a loop cycling over
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
727 windows with Fnext_window, and starting with the frame's selected
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
728 window. It turned out that this doesn't work with an
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
729 implementation of next_window using Vwindow_list, because
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
730 FRAME_SELECTED_WINDOW (F) is not always contained in the window
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
731 tree of F when this function is called asynchronously from
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
732 note_mouse_highlight. The original loop didn't terminate in this
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
733 case. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
734
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
735 Lisp_Object
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
736 window_from_coordinates (f, x, y, part, tool_bar_p)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
737 struct frame *f;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
738 int x, y;
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
739 int *part;
25544
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
740 int tool_bar_p;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
741 {
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
742 Lisp_Object window;
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
743 struct check_window_data cw;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
744
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
745 window = Qnil;
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
746 cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part;
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
747 foreach_window (f, check_window_containing, &cw);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
748
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
749 /* If not found above, see if it's in the tool bar window, if a tool
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
750 bar exists. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
751 if (NILP (window)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
752 && tool_bar_p
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
753 && WINDOWP (f->tool_bar_window)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
754 && XINT (XWINDOW (f->tool_bar_window)->height) > 0
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
755 && coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y))
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
756 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
757 *part = 0;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
758 window = f->tool_bar_window;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
759 }
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
760
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
761 return window;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
762 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
763
681
026f978690be *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 555
diff changeset
764 DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0,
1798
3062204c456d (Fwindow_at): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 1783
diff changeset
765 "Return window containing coordinates X and Y on FRAME.\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
766 If omitted, FRAME defaults to the currently selected frame.\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
767 The top left corner of the frame is considered to be row 0,\n\
548
a7b7b759f694 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 522
diff changeset
768 column 0.")
1798
3062204c456d (Fwindow_at): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 1783
diff changeset
769 (x, y, frame)
3062204c456d (Fwindow_at): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 1783
diff changeset
770 Lisp_Object x, y, frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
771 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
772 int part;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
773 struct frame *f;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
774
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
775 if (NILP (frame))
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
776 frame = selected_frame;
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
777 CHECK_LIVE_FRAME (frame, 2);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
778 f = XFRAME (frame);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
779
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
780 /* Check that arguments are integers or floats. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
781 CHECK_NUMBER_OR_FLOAT (x, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
782 CHECK_NUMBER_OR_FLOAT (y, 1);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
783
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
784 return window_from_coordinates (f,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
785 PIXEL_X_FROM_CANON_X (f, x),
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
786 PIXEL_Y_FROM_CANON_Y (f, y),
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
787 &part, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
788 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
789
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
790 DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
791 "Return current value of point in WINDOW.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
792 For a nonselected window, this is the value point would have\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
793 if that window were selected.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
794 \n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
795 Note that, when WINDOW is the selected window and its buffer\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
796 is also currently selected, the value returned is the same as (point).\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
797 It would be more strictly correct to return the `top-level' value\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
798 of point, outside of any save-excursion forms.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
799 But that is hard to define.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
800 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
801 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
802 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
803 register struct window *w = decode_window (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
804
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
805 if (w == XWINDOW (selected_window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
806 && current_buffer == XBUFFER (w->buffer))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
807 return Fpoint ();
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
808 return Fmarker_position (w->pointm);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
809 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
810
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
811 DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
12597
c2f4101915eb (Fwindow_start): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 12492
diff changeset
812 "Return position at which display currently starts in WINDOW.\n\
c2f4101915eb (Fwindow_start): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 12492
diff changeset
813 This is updated by redisplay or by calling `set-window-start'.")
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
814 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
815 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
816 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
817 return Fmarker_position (decode_window (window)->start);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
818 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
819
8508
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
820 /* This is text temporarily removed from the doc string below.
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
821
8492
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
822 This function returns nil if the position is not currently known.\n\
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
823 That happens when redisplay is preempted and doesn't finish.\n\
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
824 If in that case you want to compute where the end of the window would\n\
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
825 have been if redisplay had finished, do this:\n\
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
826 (save-excursion\n\
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
827 (goto-char (window-start window))\n\
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
828 (vertical-motion (1- (window-height window)) window)\n\
8508
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
829 (point))") */
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
830
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
831 DEFUN ("window-end", Fwindow_end, Swindow_end, 0, 2, 0,
8508
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
832 "Return position at which display currently ends in WINDOW.\n\
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
833 This is updated by redisplay, when it runs to completion.\n\
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
834 Simply changing the buffer text or setting `window-start'\n\
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
835 does not update this value.\n\
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
836 If UP-TO-DATE is non-nil, compute the up-to-date position\n\
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
837 if it isn't already recorded.")
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
838 (window, update)
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
839 Lisp_Object window, update;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
840 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
841 Lisp_Object value;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
842 struct window *w = decode_window (window);
4292
990f6ee7f527 (Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents: 4145
diff changeset
843 Lisp_Object buf;
990f6ee7f527 (Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents: 4145
diff changeset
844
990f6ee7f527 (Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents: 4145
diff changeset
845 buf = w->buffer;
990f6ee7f527 (Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents: 4145
diff changeset
846 CHECK_BUFFER (buf, 0);
990f6ee7f527 (Fset_window_buffer): Clear window_end_{pos,valid}.
Richard M. Stallman <rms@gnu.org>
parents: 4145
diff changeset
847
8508
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
848 #if 0 /* This change broke some things. We should make it later. */
8492
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
849 /* If we don't know the end position, return nil.
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
850 The user can compute it with vertical-motion if he wants to.
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
851 It would be nicer to do it automatically,
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
852 but that's so slow that it would probably bother people. */
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
853 if (NILP (w->window_end_valid))
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
854 return Qnil;
8508
6d2f0901efe9 (Fwindow_end): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents: 8492
diff changeset
855 #endif
8492
865daa7a9faf (Fwindow_end): If window_end_valid is nil, return nil.
Richard M. Stallman <rms@gnu.org>
parents: 8486
diff changeset
856
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
857 if (! NILP (update)
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
858 && ! (! NILP (w->window_end_valid)
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
859 && XFASTINT (w->last_modified) >= MODIFF))
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
860 {
30743
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
861 struct text_pos startp;
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
862 struct it it;
26635
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
863
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
864 /* In case W->start is out of the range, use something
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
865 reasonable. This situation occured when loading a file with
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
866 `-l' containing a call to `rmail' with subsequent other
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
867 commands. At the end, W->start happened to be BEG, while
30743
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
868 rmail had already narrowed the buffer. */
26635
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
869 if (XMARKER (w->start)->charpos < BEGV)
30743
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
870 SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
26635
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
871 else if (XMARKER (w->start)->charpos > ZV)
30743
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
872 SET_TEXT_POS (startp, ZV, ZV_BYTE);
26635
af8d605cbcf1 (Fwindow_end): Don't call temp_set_pt_both with
Gerd Moellmann <gerd@gnu.org>
parents: 26164
diff changeset
873 else
30743
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
874 SET_TEXT_POS_FROM_MARKER (startp, w->start);
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
875
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
876 /* Cannot use Fvertical_motion because that function doesn't
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
877 cope with variable-height lines. */
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
878 start_display (&it, w, startp);
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
879 move_it_vertically (&it, window_box_height (w));
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
880 value = make_number (IT_CHARPOS (it));
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
881 }
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
882 else
30743
51d0f4273e89 (Fwindow_end): Rewritten to not use Fvertical_motion,
Gerd Moellmann <gerd@gnu.org>
parents: 30560
diff changeset
883 XSETINT (value, BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
884
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
885 return value;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
887
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
888 DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 "Make point value in WINDOW be at position POS in WINDOW's buffer.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
890 (window, pos)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
891 Lisp_Object window, pos;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
892 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893 register struct window *w = decode_window (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895 CHECK_NUMBER_COERCE_MARKER (pos, 1);
24230
ee835eec7607 (Fset_window_point): If WINDOW is selected but the
Richard M. Stallman <rms@gnu.org>
parents: 23728
diff changeset
896 if (w == XWINDOW (selected_window)
ee835eec7607 (Fset_window_point): If WINDOW is selected but the
Richard M. Stallman <rms@gnu.org>
parents: 23728
diff changeset
897 && XBUFFER (w->buffer) == current_buffer)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898 Fgoto_char (pos);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
899 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 set_marker_restricted (w->pointm, pos, w->buffer);
25387
df0083768b79 (Fset_window_point): Reset Vresize_mini_config.
Gerd Moellmann <gerd@gnu.org>
parents: 25375
diff changeset
901
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902 return pos;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
904
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 "Make display in WINDOW start at position POS in WINDOW's buffer.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
907 Optional third arg NOFORCE non-nil inhibits next redisplay\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908 from overriding motion of point in order to display at this exact start.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909 (window, pos, noforce)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 Lisp_Object window, pos, noforce;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 register struct window *w = decode_window (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 CHECK_NUMBER_COERCE_MARKER (pos, 1);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
915 set_marker_restricted (w->start, pos, w->buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 /* this is not right, but much easier than doing what is right. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 w->start_at_line_beg = Qnil;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
918 if (NILP (noforce))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919 w->force_start = Qt;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
920 w->update_mode_line = Qt;
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
921 XSETFASTINT (w->last_modified, 0);
16208
e3a834653117 (Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents: 16068
diff changeset
922 XSETFASTINT (w->last_overlay_modified, 0);
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 265
diff changeset
923 if (!EQ (window, selected_window))
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 265
diff changeset
924 windows_or_buffers_changed++;
25387
df0083768b79 (Fset_window_point): Reset Vresize_mini_config.
Gerd Moellmann <gerd@gnu.org>
parents: 25375
diff changeset
925
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
926 return pos;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
928
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930 1, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931 "Return WINDOW's dedicated object, usually t or nil.\n\
2865
427eadecebd6 * window.c (window-dedicated-p): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 2693
diff changeset
932 See also `set-window-dedicated-p'.")
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 return decode_window (window)->dedicated;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938
722
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
939 DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p,
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
940 Sset_window_dedicated_p, 2, 2, 0,
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
941 "Control whether WINDOW is dedicated to the buffer it displays.\n\
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
942 If it is dedicated, Emacs will not automatically change\n\
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
943 which buffer appears in it.\n\
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
944 The second argument is the new value for the dedication flag;\n\
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
945 non-nil means yes.")
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946 (window, arg)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 Lisp_Object window, arg;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 register struct window *w = decode_window (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
951 if (NILP (arg))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 w->dedicated = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
953 else
722
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
954 w->dedicated = Qt;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956 return w->dedicated;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
957 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
959 DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 "Return the display-table that WINDOW is using.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
962 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
964 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
965 return decode_window (window)->display_table;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
966 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
968 /* Get the display table for use on window W. This is either W's
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
969 display table or W's buffer's display table. Ignore the specified
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
970 tables if they are not valid; if no valid table is specified,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
971 return 0. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
972
13187
1a4cee562d33 (window_display_table): Use DISP_TABLE_P. Return type
Richard M. Stallman <rms@gnu.org>
parents: 13126
diff changeset
973 struct Lisp_Char_Table *
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 window_display_table (w)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975 struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 {
30446
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
977 struct Lisp_Char_Table *dp = NULL;
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
978
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
979 if (DISP_TABLE_P (w->display_table))
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
980 dp = XCHAR_TABLE (w->display_table);
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
981 else if (BUFFERP (w->buffer))
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
982 {
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
983 struct buffer *b = XBUFFER (w->buffer);
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
984
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
985 if (DISP_TABLE_P (b->display_table))
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
986 dp = XCHAR_TABLE (b->display_table);
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
987 else if (DISP_TABLE_P (Vstandard_display_table))
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
988 dp = XCHAR_TABLE (Vstandard_display_table);
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
989 }
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
990
e3fe041c4e25 (window_display_table): Cleaned up.
Gerd Moellmann <gerd@gnu.org>
parents: 30366
diff changeset
991 return dp;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993
555
e09a318cf838 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 548
diff changeset
994 DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0,
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995 "Set WINDOW's display-table to TABLE.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996 (window, table)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997 register Lisp_Object window, table;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999 register struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1001 w = decode_window (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 w->display_table = table;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 return table;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 /* Record info on buffer window w is displaying
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007 when it is about to cease to display that buffer. */
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
1008 static void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 unshow_buffer (w)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010 register struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011 {
6517
8f5f79c3091a (unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents: 6487
diff changeset
1012 Lisp_Object buf;
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1013 struct buffer *b;
6517
8f5f79c3091a (unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents: 6487
diff changeset
1014
8f5f79c3091a (unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents: 6487
diff changeset
1015 buf = w->buffer;
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1016 b = XBUFFER (buf);
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1017 if (b != XMARKER (w->pointm)->buffer)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1018 abort ();
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1019
5990
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1020 #if 0
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1021 if (w == XWINDOW (selected_window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1022 || ! EQ (buf, XWINDOW (selected_window)->buffer))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1023 /* Do this except when the selected window's buffer
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1024 is being removed from some other window. */
5990
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1025 #endif
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1026 /* last_window_start records the start position that this buffer
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1027 had in the last window to be disconnected from it.
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1028 Now that this statement is unconditional,
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1029 it is possible for the buffer to be displayed in the
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1030 selected window, while last_window_start reflects another
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1031 window which was recently showing the same buffer.
936d4a988148 (unshow_buffer): Unconditionally set last_window_start.
Richard M. Stallman <rms@gnu.org>
parents: 5988
diff changeset
1032 Some people might say that might be a good thing. Let's see. */
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1033 b->last_window_start = marker_position (w->start);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035 /* Point in the selected window's buffer
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1036 is actually stored in that buffer, and the window's pointm isn't used.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1037 So don't clobber point in that buffer. */
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
1038 if (! EQ (buf, XWINDOW (selected_window)->buffer)
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
1039 /* This line helps to fix Horsley's testbug.el bug. */
28417
4b675266db04 * lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents: 28104
diff changeset
1040 && !(WINDOWP (b->last_selected_window)
4b675266db04 * lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents: 28104
diff changeset
1041 && w != XWINDOW (b->last_selected_window)
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
1042 && EQ (buf, XWINDOW (b->last_selected_window)->buffer)))
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1043 temp_set_point_both (b,
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1044 clip_to_bounds (BUF_BEGV (b),
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1045 XMARKER (w->pointm)->charpos,
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1046 BUF_ZV (b)),
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1047 clip_to_bounds (BUF_BEGV_BYTE (b),
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1048 marker_byte_position (w->pointm),
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1049 BUF_ZV_BYTE (b)));
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
1050
28417
4b675266db04 * lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents: 28104
diff changeset
1051 if (WINDOWP (b->last_selected_window)
4b675266db04 * lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Ken Raeburn <raeburn@raeburn.org>
parents: 28104
diff changeset
1052 && w == XWINDOW (b->last_selected_window))
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
1053 b->last_selected_window = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1054 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1055
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1056 /* Put replacement into the window structure in place of old. */
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
1057 static void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1058 replace_window (old, replacement)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1059 Lisp_Object old, replacement;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1060 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1061 register Lisp_Object tem;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1062 register struct window *o = XWINDOW (old), *p = XWINDOW (replacement);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1063
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1064 /* If OLD is its frame's root_window, then replacement is the new
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1065 root_window for that frame. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1066
1525
f79a22ad87d0 * window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents: 1444
diff changeset
1067 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame))))
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1068 FRAME_ROOT_WINDOW (XFRAME (o->frame)) = replacement;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1069
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1070 p->left = o->left;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1071 p->top = o->top;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1072 p->width = o->width;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1073 p->height = o->height;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1074 p->desired_matrix = p->current_matrix = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1075 p->vscroll = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1076 bzero (&p->cursor, sizeof (p->cursor));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1077 bzero (&p->last_cursor, sizeof (p->last_cursor));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1078 bzero (&p->phys_cursor, sizeof (p->phys_cursor));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1079 p->phys_cursor_type = -1;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1080 p->must_be_updated_p = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1081 p->pseudo_window_p = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1082 XSETFASTINT (p->window_end_vpos, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1083 XSETFASTINT (p->window_end_pos, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1084 p->window_end_valid = Qnil;
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
1085 p->frozen_window_start_p = 0;
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
1086 p->orig_top = p->orig_height = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1087
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1088 p->next = tem = o->next;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1089 if (!NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 XWINDOW (tem)->prev = replacement;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1091
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1092 p->prev = tem = o->prev;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1093 if (!NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1094 XWINDOW (tem)->next = replacement;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1095
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1096 p->parent = tem = o->parent;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1097 if (!NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1098 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1099 if (EQ (XWINDOW (tem)->vchild, old))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1100 XWINDOW (tem)->vchild = replacement;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101 if (EQ (XWINDOW (tem)->hchild, old))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1102 XWINDOW (tem)->hchild = replacement;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1103 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1104
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1105 /*** Here, if replacement is a vertical combination
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1106 and so is its new parent, we should make replacement's
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1107 children be children of that parent instead. ***/
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1108 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1109
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1110 DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "",
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1111 "Remove WINDOW from the display. Default is selected window.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1112 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1113 register Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1114 {
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1115 delete_window (window);
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1116
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1117 if (! NILP (Vwindow_configuration_change_hook)
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1118 && ! NILP (Vrun_hooks))
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1119 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1120
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1121 return Qnil;
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1122 }
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1123
20351
f69eb2ab4f0f Add prototypes.
Andreas Schwab <schwab@suse.de>
parents: 20090
diff changeset
1124 void
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1125 delete_window (window)
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1126 register Lisp_Object window;
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
1127 {
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1128 register Lisp_Object tem, parent, sib;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1129 register struct window *p;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1130 register struct window *par;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1131 FRAME_PTR frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1132
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1133 /* Because this function is called by other C code on non-leaf
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1134 windows, the CHECK_LIVE_WINDOW macro would choke inappropriately,
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1135 so we can't decode_window here. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1136 if (NILP (window))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 window = selected_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1138 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1139 CHECK_WINDOW (window, 0);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1140 p = XWINDOW (window);
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1141
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1142 /* It's okay to delete an already-deleted window. */
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1143 if (NILP (p->buffer)
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1144 && NILP (p->hchild)
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1145 && NILP (p->vchild))
17365
fc2ec9ced22f (delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents: 17281
diff changeset
1146 return;
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1147
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1148 parent = p->parent;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1149 if (NILP (parent))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1150 error ("Attempt to delete minibuffer or sole ordinary window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1151 par = XWINDOW (parent);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1152
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1153 windows_or_buffers_changed++;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1154 Vwindow_list = Qnil;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1155 frame = XFRAME (WINDOW_FRAME (p));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1156 FRAME_WINDOW_SIZES_CHANGED (frame) = 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1157
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1158 /* Are we trying to delete any frame's selected window? */
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1159 {
3723
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1160 Lisp_Object frame, pwindow;
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1161
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1162 /* See if the frame's selected window is either WINDOW
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1163 or any subwindow of it, by finding all that window's parents
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1164 and comparing each one with WINDOW. */
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1165 frame = WINDOW_FRAME (XWINDOW (window));
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1166 pwindow = FRAME_SELECTED_WINDOW (XFRAME (frame));
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1167
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1168 while (!NILP (pwindow))
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1169 {
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1170 if (EQ (window, pwindow))
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1171 break;
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1172 pwindow = XWINDOW (pwindow)->parent;
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1173 }
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1174
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1175 if (EQ (window, pwindow))
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1176 {
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1177 Lisp_Object alternative;
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1178 alternative = Fnext_window (window, Qlambda, Qnil);
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1179
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1180 /* If we're about to delete the selected window on the
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1181 selected frame, then we should use Fselect_window to select
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1182 the new window. On the other hand, if we're about to
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1183 delete the selected window on any other frame, we shouldn't do
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1184 anything but set the frame's selected_window slot. */
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1185 if (EQ (window, selected_window))
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1186 Fselect_window (alternative);
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1187 else
3723
ccb9c93aac80 (Fdelete_window): Handle deleting a parent of the selected window.
Richard M. Stallman <rms@gnu.org>
parents: 3688
diff changeset
1188 FRAME_SELECTED_WINDOW (XFRAME (frame)) = alternative;
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1189 }
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1190 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1191
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1192 tem = p->buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1193 /* tem is null for dummy parent windows
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1194 (which have inferiors but not any contents themselves) */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1195 if (!NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1196 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1197 unshow_buffer (p);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1198 unchain_marker (p->pointm);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1199 unchain_marker (p->start);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1200 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1201
26761
c15c2756ec0f (delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents: 26635
diff changeset
1202 /* Free window glyph matrices. It is sure that they are allocated
c15c2756ec0f (delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents: 26635
diff changeset
1203 again when ADJUST_GLYPHS is called. Block input so that expose
c15c2756ec0f (delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents: 26635
diff changeset
1204 events and other events that access glyph matrices are not
c15c2756ec0f (delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents: 26635
diff changeset
1205 processed while we are changing them. */
c15c2756ec0f (delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents: 26635
diff changeset
1206 BLOCK_INPUT;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1207 free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (frame)));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1208
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1209 tem = p->next;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1210 if (!NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1211 XWINDOW (tem)->prev = p->prev;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1212
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1213 tem = p->prev;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1214 if (!NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1215 XWINDOW (tem)->next = p->next;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1216
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1217 if (EQ (window, par->hchild))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1218 par->hchild = p->next;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1219 if (EQ (window, par->vchild))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1220 par->vchild = p->next;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1221
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1222 /* Find one of our siblings to give our space to. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1223 sib = p->prev;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1224 if (NILP (sib))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1225 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1226 /* If p gives its space to its next sibling, that sibling needs
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1227 to have its top/left side pulled back to where p's is.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1228 set_window_{height,width} will re-position the sibling's
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1229 children. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1230 sib = p->next;
1525
f79a22ad87d0 * window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents: 1444
diff changeset
1231 XWINDOW (sib)->top = p->top;
f79a22ad87d0 * window.c (Fwindow_width, Fset_window_hscroll): Use accessors on
Jim Blandy <jimb@redhat.com>
parents: 1444
diff changeset
1232 XWINDOW (sib)->left = p->left;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1233 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1234
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1235 /* Stretch that sibling. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1236 if (!NILP (par->vchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1237 set_window_height (sib,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1238 XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height),
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1239 1);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1240 if (!NILP (par->hchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1241 set_window_width (sib,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1242 XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width),
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1243 1);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1244
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1245 /* If parent now has only one child,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1246 put the child into the parent's place. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1247 tem = par->hchild;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1248 if (NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1249 tem = par->vchild;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1250 if (NILP (XWINDOW (tem)->next))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1251 replace_window (parent, tem);
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1252
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1253 /* Since we may be deleting combination windows, we must make sure that
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1254 not only p but all its children have been marked as deleted. */
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1255 if (! NILP (p->hchild))
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1256 delete_all_subwindows (XWINDOW (p->hchild));
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1257 else if (! NILP (p->vchild))
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1258 delete_all_subwindows (XWINDOW (p->vchild));
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1259
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1260 /* Mark this window as deleted. */
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1261 p->buffer = p->hchild = p->vchild = Qnil;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1262
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1263 /* Adjust glyph matrices. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1264 adjust_glyphs (frame);
26761
c15c2756ec0f (delete_window): Block input for the time window
Gerd Moellmann <gerd@gnu.org>
parents: 26635
diff changeset
1265 UNBLOCK_INPUT;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1266 }
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1267
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1268
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1269
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1270 /***********************************************************************
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1271 Window List
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1272 ***********************************************************************/
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1273
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
1274 /* Add window W to *USER_DATA. USER_DATA is actually a Lisp_Object
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
1275 pointer. This is a callback function for foreach_window, used in
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
1276 function window_list. */
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1277
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1278 static int
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
1279 add_window_to_list (w, user_data)
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1280 struct window *w;
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
1281 void *user_data;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1282 {
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
1283 Lisp_Object *list = (Lisp_Object *) user_data;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1284 Lisp_Object window;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1285 XSETWINDOW (window, w);
30039
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1286 *list = Fcons (window, *list);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1287 return 1;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1288 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1289
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1290
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1291 /* Return a list of all windows, for use by next_window. If
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1292 Vwindow_list is a list, return that list. Otherwise, build a new
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1293 list, cache it in Vwindow_list, and return that. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1294
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1295 static Lisp_Object
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1296 window_list ()
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1297 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1298 if (!CONSP (Vwindow_list))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1299 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1300 Lisp_Object tail;
30039
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1301
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1302 Vwindow_list = Qnil;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1303 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
30039
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1304 {
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1305 Lisp_Object args[2];
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1306
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1307 /* We are visiting windows in canonical order, and add
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1308 new windows at the front of args[1], which means we
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1309 have to reverse this list at the end. */
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1310 args[1] = Qnil;
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1311 foreach_window (XFRAME (XCAR (tail)), add_window_to_list, &args[1]);
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1312 args[0] = Vwindow_list;
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1313 args[1] = Fnreverse (args[1]);
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1314 Vwindow_list = Fnconc (2, args);
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1315 }
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1316 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1317
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1318 return Vwindow_list;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1319 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1320
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1321
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1322 /* Value is non-zero if WINDOW satisfies the constraints given by
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1323 OWINDOW, MINIBUF and ALL_FRAMES.
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1324
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1325 MINIBUF t means WINDOW may be minibuffer windows.
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1326 `lambda' means WINDOW may not be a minibuffer window.
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1327 a window means a specific minibuffer window
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1328
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1329 ALL_FRAMES t means search all frames,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1330 nil means search just current frame,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1331 `visible' means search just visible frames,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1332 0 means search visible and iconified frames,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1333 a window means search the frame that window belongs to,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1334 a frame means consider windows on that frame, only. */
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1335
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1336 static int
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1337 candidate_window_p (window, owindow, minibuf, all_frames)
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1338 Lisp_Object window, owindow, minibuf, all_frames;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1339 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1340 struct window *w = XWINDOW (window);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1341 struct frame *f = XFRAME (w->frame);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1342 int candidate_p = 1;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1343
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1344 if (!BUFFERP (w->buffer))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1345 candidate_p = 0;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1346 else if (MINI_WINDOW_P (w)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1347 && (EQ (minibuf, Qlambda)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1348 || (WINDOWP (minibuf) && !EQ (minibuf, window))))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1349 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1350 /* If MINIBUF is `lambda' don't consider any mini-windows.
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1351 If it is a window, consider only that one. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1352 candidate_p = 0;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1353 }
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1354 else if (EQ (all_frames, Qt))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1355 candidate_p = 1;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1356 else if (NILP (all_frames))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1357 {
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1358 xassert (WINDOWP (owindow));
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1359 candidate_p = EQ (w->frame, XWINDOW (owindow)->frame);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1360 }
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1361 else if (EQ (all_frames, Qvisible))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1362 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1363 FRAME_SAMPLE_VISIBILITY (f);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1364 candidate_p = FRAME_VISIBLE_P (f);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1365 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1366 else if (INTEGERP (all_frames) && XINT (all_frames) == 0)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1367 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1368 FRAME_SAMPLE_VISIBILITY (f);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1369 candidate_p = FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1370 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1371 else if (WINDOWP (all_frames))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1372 candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1373 || EQ (XWINDOW (all_frames)->frame, w->frame)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1374 || EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f)));
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1375 else if (FRAMEP (all_frames))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1376 candidate_p = EQ (all_frames, w->frame);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1377
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1378 return candidate_p;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1379 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1380
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1381
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1382 /* Decode arguments as allowed by Fnext_window, Fprevious_window, and
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1383 Fwindow_list. See there for the meaning of WINDOW, MINIBUF, and
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1384 ALL_FRAMES. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1385
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1386 static void
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1387 decode_next_window_args (window, minibuf, all_frames)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1388 Lisp_Object *window, *minibuf, *all_frames;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1389 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1390 if (NILP (*window))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1391 *window = selected_window;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1392 else
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1393 CHECK_LIVE_WINDOW (*window, 0);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1394
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1395 /* MINIBUF nil may or may not include minibuffers. Decide if it
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1396 does. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1397 if (NILP (*minibuf))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1398 *minibuf = minibuf_level ? minibuf_window : Qlambda;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1399 else if (!EQ (*minibuf, Qt))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1400 *minibuf = Qlambda;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1401
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1402 /* Now *MINIBUF can be t => count all minibuffer windows, `lambda'
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1403 => count none of them, or a specific minibuffer window (the
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1404 active one) to count. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1405
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1406 /* ALL_FRAMES nil doesn't specify which frames to include. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1407 if (NILP (*all_frames))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1408 *all_frames = (!EQ (*minibuf, Qlambda)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1409 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1410 : Qnil);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1411 else if (EQ (*all_frames, Qvisible))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1412 ;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1413 else if (XFASTINT (*all_frames) == 0)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1414 ;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1415 else if (FRAMEP (*all_frames))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1416 ;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1417 else if (!EQ (*all_frames, Qt))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1418 *all_frames = Qnil;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1419
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1420 /* Now *ALL_FRAMES is t meaning search all frames, nil meaning
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1421 search just current frame, `visible' meaning search just visible
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1422 frames, 0 meaning search visible and iconified frames, or a
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1423 window, meaning search the frame that window belongs to, or a
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1424 frame, meaning consider windows on that frame, only. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1425 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1426
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1427
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1428 /* Return the next or previous window of WINDOW in canonical ordering
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1429 of windows. NEXT_P non-zero means return the next window. See the
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1430 documentation string of next-window for the meaning of MINIBUF and
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1431 ALL_FRAMES. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1432
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1433 static Lisp_Object
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1434 next_window (window, minibuf, all_frames, next_p)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1435 Lisp_Object window, minibuf, all_frames;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1436 int next_p;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1437 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1438 decode_next_window_args (&window, &minibuf, &all_frames);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1439
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1440 /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1441 return the first window on the frame. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1442 if (FRAMEP (all_frames)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1443 && !EQ (all_frames, XWINDOW (window)->frame))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1444 return Fframe_first_window (all_frames);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1445
30039
07f23448b6e5 (add_window_to_list): Add parameter LIST.
Gerd Moellmann <gerd@gnu.org>
parents: 30037
diff changeset
1446 if (next_p)
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1447 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1448 Lisp_Object list;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1449
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1450 /* Find WINDOW in the list of all windows. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1451 list = Fmemq (window, window_list ());
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1452
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1453 /* Scan forward from WINDOW to the end of the window list. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1454 if (CONSP (list))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1455 for (list = XCDR (list); CONSP (list); list = XCDR (list))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1456 if (candidate_window_p (XCAR (list), window, minibuf, all_frames))
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1457 break;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1458
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1459 /* Scan from the start of the window list up to WINDOW. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1460 if (!CONSP (list))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1461 for (list = Vwindow_list;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1462 CONSP (list) && !EQ (XCAR (list), window);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1463 list = XCDR (list))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1464 if (candidate_window_p (XCAR (list), window, minibuf, all_frames))
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1465 break;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1466
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1467 if (CONSP (list))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1468 window = XCAR (list);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1469 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1470 else
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1471 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1472 Lisp_Object candidate, list;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1473
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1474 /* Scan through the list of windows for candidates. If there are
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1475 candidate windows in front of WINDOW, the last one of these
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1476 is the one we want. If there are candidates following WINDOW
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1477 in the list, again the last one of these is the one we want. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1478 candidate = Qnil;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1479 for (list = window_list (); CONSP (list); list = XCDR (list))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1480 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1481 if (EQ (XCAR (list), window))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1482 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1483 if (WINDOWP (candidate))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1484 break;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1485 }
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1486 else if (candidate_window_p (XCAR (list), window, minibuf,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1487 all_frames))
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1488 candidate = XCAR (list);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1489 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1490
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1491 if (WINDOWP (candidate))
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1492 window = candidate;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1493 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1494
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1495 return window;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1496 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1497
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1498
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1499 /* This comment supplies the doc string for `next-window',
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1500 for make-docfile to see. We cannot put this in the real DEFUN
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1501 due to limits in the Unix cpp.
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1502
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1503 DEFUN ("next-window", Ffoo, Sfoo, 0, 3, 0,
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1504 "Return next window after WINDOW in canonical ordering of windows.\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1505 If omitted, WINDOW defaults to the selected window.\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1506 \n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1507 Optional second arg MINIBUF t means count the minibuffer window even\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1508 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1509 it is active. MINIBUF neither t nor nil means not to count the\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1510 minibuffer even if it is active.\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1511 \n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1512 Several frames may share a single minibuffer; if the minibuffer\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1513 counts, all windows on all frames that share that minibuffer count\n\
8139
4985198f65a1 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8059
diff changeset
1514 too. Therefore, `next-window' can be used to iterate through the\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1515 set of windows even when the minibuffer is on another frame. If the\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1516 minibuffer does not count, only windows from WINDOW's frame count.\n\
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1517 \n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1518 Optional third arg ALL-FRAMES t means include windows on all frames.\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1519 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1520 above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\
8167
ae9b49cc645f (Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents: 8139
diff changeset
1521 ALL-FRAMES = 0 means include windows on all visible and iconified frames.\n\
11307
f6b6a67ff758 (Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents: 11235
diff changeset
1522 If ALL-FRAMES is a frame, restrict search to windows on that frame.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1523 Anything else means restrict to WINDOW's frame.\n\
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1524 \n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1525 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1526 `next-window' to iterate through the entire cycle of acceptable\n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1527 windows, eventually ending up back at the window you started with.\n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1528 `previous-window' traverses the same cycle, in the reverse order.")
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1529 (window, minibuf, all_frames) */
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1530
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1531 DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1532 0)
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1533 (window, minibuf, all_frames)
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1534 Lisp_Object window, minibuf, all_frames;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1535 {
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1536 return next_window (window, minibuf, all_frames, 1);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1537 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1538
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1539
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1540 /* This comment supplies the doc string for `previous-window',
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1541 for make-docfile to see. We cannot put this in the real DEFUN
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1542 due to limits in the Unix cpp.
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1543
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1544 DEFUN ("previous-window", Ffoo, Sfoo, 0, 3, 0,
13946
b7670a09033c (Fprevious_window, Fwindow_configuration_p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 13918
diff changeset
1545 "Return the window preceding WINDOW in canonical ordering of windows.\n\
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1546 If omitted, WINDOW defaults to the selected window.\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1547 \n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1548 Optional second arg MINIBUF t means count the minibuffer window even\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1549 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1550 it is active. MINIBUF neither t nor nil means not to count the\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1551 minibuffer even if it is active.\n\
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1552 \n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1553 Several frames may share a single minibuffer; if the minibuffer\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1554 counts, all windows on all frames that share that minibuffer count\n\
8139
4985198f65a1 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8059
diff changeset
1555 too. Therefore, `previous-window' can be used to iterate through\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1556 the set of windows even when the minibuffer is on another frame. If\n\
8139
4985198f65a1 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8059
diff changeset
1557 the minibuffer does not count, only windows from WINDOW's frame count\n\
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
1558 \n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1559 Optional third arg ALL-FRAMES t means include windows on all frames.\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1560 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1561 above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\
8167
ae9b49cc645f (Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents: 8139
diff changeset
1562 ALL-FRAMES = 0 means include windows on all visible and iconified frames.\n\
11307
f6b6a67ff758 (Fnext_window, Fprevious_window): If all_frames is a frame and window
Richard M. Stallman <rms@gnu.org>
parents: 11235
diff changeset
1563 If ALL-FRAMES is a frame, restrict search to windows on that frame.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1564 Anything else means restrict to WINDOW's frame.\n\
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1565 \n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1566 If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1567 `previous-window' to iterate through the entire cycle of acceptable\n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1568 windows, eventually ending up back at the window you started with.\n\
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
1569 `next-window' traverses the same cycle, in the reverse order.")
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1570 (window, minibuf, all_frames) */
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1571
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1572
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1573 DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0,
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
1574 0)
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1575 (window, minibuf, all_frames)
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1576 Lisp_Object window, minibuf, all_frames;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1577 {
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1578 return next_window (window, minibuf, all_frames, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1579 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1580
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1581
338
4840aae6a876 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 265
diff changeset
1582 DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p",
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1583 "Select the ARG'th different window on this frame.\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1584 All windows on current frame are arranged in a cyclic order.\n\
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1585 This command selects the window ARG steps away in that order.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1586 A negative ARG moves in the opposite order. If the optional second\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1587 argument ALL_FRAMES is non-nil, cycle through all frames.")
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
1588 (arg, all_frames)
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1589 Lisp_Object arg, all_frames;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1590 {
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1591 Lisp_Object window;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1592 int i;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1593
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
1594 CHECK_NUMBER (arg, 0);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1595 window = selected_window;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1596
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1597 for (i = XINT (arg); i > 0; --i)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1598 window = Fnext_window (window, Qnil, all_frames);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1599 for (; i < 0; ++i)
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1600 window = Fprevious_window (window, Qnil, all_frames);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1601
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1602 Fselect_window (window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1603 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1604 }
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1605
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1606
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1607 DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
33619
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1608 "Return a list of windows on FRAME, starting with WINDOW.\n\
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1609 FRAME nil or omitted means use the selected frame.\n\
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1610 WINDOW nil or omitted means use the selected window.\n\
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1611 MINIBUF t means include the minibuffer window, even if it isn't active.\n\
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1612 MINIBUF nil or omitted means include the minibuffer window only\n\
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1613 if it's active.\n\
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1614 MINIBUF neither nil nor t means never include the minibuffer window.")
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1615 (frame, minibuf, window)
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1616 Lisp_Object frame, minibuf, window;
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1617 {
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1618 Lisp_Object list;
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1619
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1620 if (NILP (window))
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1621 window = selected_window;
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1622 if (NILP (frame))
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1623 frame = selected_frame;
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1624
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1625 if (!EQ (frame, XWINDOW (window)->frame))
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1626 error ("Window is on a different frame");
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1627
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1628 return window_list_1 (window, minibuf, frame);
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1629 }
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1630
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1631
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1632 /* Return a list of windows in canonical ordering. Arguments are like
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1633 for `next-window'. */
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1634
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1635 static Lisp_Object
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1636 window_list_1 (window, minibuf, all_frames)
30265
9b1c8eafe4dc (Fwindow_list): Declare arg `window'.
Dave Love <fx@gnu.org>
parents: 30102
diff changeset
1637 Lisp_Object window, minibuf, all_frames;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1638 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1639 Lisp_Object tail, list;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1640
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1641 decode_next_window_args (&window, &minibuf, &all_frames);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1642 list = Qnil;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1643
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1644 for (tail = window_list (); CONSP (tail); tail = XCDR (tail))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1645 if (candidate_window_p (XCAR (tail), window, minibuf, all_frames))
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1646 list = Fcons (XCAR (tail), list);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1647
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1648 return Fnreverse (list);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1649 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1650
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
1651
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1652
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1653 /* Look at all windows, performing an operation specified by TYPE
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1654 with argument OBJ.
3785
3455cbb3339d Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents: 3765
diff changeset
1655 If FRAMES is Qt, look at all frames;
3455cbb3339d Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents: 3765
diff changeset
1656 Qnil, look at just the selected frame;
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1657 Qvisible, look at visible frames;
3785
3455cbb3339d Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents: 3765
diff changeset
1658 a frame, just look at windows on that frame.
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1659 If MINI is non-zero, perform the operation on minibuffer windows too.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1660 */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1661
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1662 enum window_loop
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1663 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1664 WINDOW_LOOP_UNUSED,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1665 GET_BUFFER_WINDOW, /* Arg is buffer */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1666 GET_LRU_WINDOW, /* Arg is t for full-width windows only */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1667 DELETE_OTHER_WINDOWS, /* Arg is window not to delete */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1668 DELETE_BUFFER_WINDOWS, /* Arg is buffer */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1669 GET_LARGEST_WINDOW,
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1670 UNSHOW_BUFFER, /* Arg is buffer */
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1671 CHECK_ALL_WINDOWS
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1672 };
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1673
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1674 static Lisp_Object
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1675 window_loop (type, obj, mini, frames)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1676 enum window_loop type;
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1677 Lisp_Object obj, frames;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1678 int mini;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1679 {
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1680 Lisp_Object window, windows, best_window, frame_arg;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1681 struct frame *f;
30102
9406cb07bac7 (window_loop): Add missing gcpro1 local variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30093
diff changeset
1682 struct gcpro gcpro1;
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1683
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1684 /* If we're only looping through windows on a particular frame,
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1685 frame points to that frame. If we're looping through windows
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1686 on all frames, frame is 0. */
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1687 if (FRAMEP (frames))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1688 f = XFRAME (frames);
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1689 else if (NILP (frames))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1690 f = SELECTED_FRAME ();
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1691 else
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1692 f = NULL;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1693
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1694 if (f)
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1695 frame_arg = Qlambda;
8167
ae9b49cc645f (Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents: 8139
diff changeset
1696 else if (XFASTINT (frames) == 0)
ae9b49cc645f (Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents: 8139
diff changeset
1697 frame_arg = frames;
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1698 else if (EQ (frames, Qvisible))
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1699 frame_arg = frames;
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1700 else
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1701 frame_arg = Qt;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1702
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1703 /* frame_arg is Qlambda to stick to one frame,
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1704 Qvisible to consider all visible frames,
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1705 or Qt otherwise. */
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1706
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1707 /* Pick a window to start with. */
9105
984a4b1be1d1 (Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents: 9028
diff changeset
1708 if (WINDOWP (obj))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1709 window = obj;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1710 else if (f)
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1711 window = FRAME_SELECTED_WINDOW (f);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1712 else
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1713 window = FRAME_SELECTED_WINDOW (SELECTED_FRAME ());
983
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1714
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1715 /* Figure out the last window we're going to mess with. Since
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1716 Fnext_window, given the same options, is guaranteed to go in a
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1717 ring, we can just use Fprevious_window to find the last one.
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1718
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1719 We can't just wait until we hit the first window again, because
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1720 it might be deleted. */
eb19dfaec9c4 * window.c (window_loop): This used to keep track of the first
Jim Blandy <jimb@redhat.com>
parents: 972
diff changeset
1721
33619
d0482eab29e1 (Fwindow_list): Change parameter list to be XEmacs
Gerd Moellmann <gerd@gnu.org>
parents: 33463
diff changeset
1722 windows = window_list_1 (window, mini ? Qt : Qnil, frame_arg);
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1723 GCPRO1 (windows);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1724 best_window = Qnil;
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1725
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1726 for (; CONSP (windows); windows = CDR (windows))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1727 {
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1728 struct window *w;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1729
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1730 window = XCAR (windows);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1731 w = XWINDOW (window);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1732
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1733 /* Note that we do not pay attention here to whether the frame
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1734 is visible, since Fwindow_list skips non-visible frames if
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1735 that is desired, under the control of frame_arg. */
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1736 if (!MINI_WINDOW_P (w)
23728
0d1a0ded9aa1 (temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents: 23410
diff changeset
1737 /* For UNSHOW_BUFFER, we must always consider all windows. */
0d1a0ded9aa1 (temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents: 23410
diff changeset
1738 || type == UNSHOW_BUFFER
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1739 || (mini && minibuf_level > 0))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1740 switch (type)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1741 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1742 case GET_BUFFER_WINDOW:
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1743 if (EQ (w->buffer, obj)
16522
63ca7c6ceeff (window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents: 16485
diff changeset
1744 /* Don't find any minibuffer window
63ca7c6ceeff (window_loop, case GET_BUFFER_WINDOW):
Richard M. Stallman <rms@gnu.org>
parents: 16485
diff changeset
1745 except the one that is currently in use. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1746 && (MINI_WINDOW_P (w)
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1747 ? EQ (window, minibuf_window)
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1748 : 1))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1749 {
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1750 UNGCPRO;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1751 return window;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1752 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1753 break;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1754
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1755 case GET_LRU_WINDOW:
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1756 /* t as arg means consider only full-width windows */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1757 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1758 break;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1759 /* Ignore dedicated windows and minibuffers. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1760 if (MINI_WINDOW_P (w) || !NILP (w->dedicated))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1761 break;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1762 if (NILP (best_window)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1763 || (XFASTINT (XWINDOW (best_window)->use_time)
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1764 > XFASTINT (w->use_time)))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1765 best_window = window;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1766 break;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1767
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1768 case DELETE_OTHER_WINDOWS:
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1769 if (!EQ (window, obj))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1770 Fdelete_window (window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1771 break;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1772
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1773 case DELETE_BUFFER_WINDOWS:
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1774 if (EQ (w->buffer, obj))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1775 {
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1776 struct frame *f = XFRAME (WINDOW_FRAME (w));
10808
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
1777
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
1778 /* If this window is dedicated, and in a frame of its own,
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
1779 kill the frame. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1780 if (EQ (window, FRAME_ROOT_WINDOW (f))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1781 && !NILP (w->dedicated)
10808
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
1782 && other_visible_frames (f))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1783 {
10808
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
1784 /* Skip the other windows on this frame.
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
1785 There might be one, the minibuffer! */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1786 while (CONSP (XCDR (windows))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1787 && EQ (XWINDOW (XCAR (windows))->frame,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1788 XWINDOW (XCAR (XCDR (windows)))->frame))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1789 windows = XCDR (windows);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1790
10808
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
1791 /* Now we can safely delete the frame. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1792 Fdelete_frame (w->frame, Qnil);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1793 }
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1794 else if (NILP (w->parent))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1795 {
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1796 /* If we're deleting the buffer displayed in the
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1797 only window on the frame, find a new buffer to
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1798 display there. */
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1799 Lisp_Object buffer;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1800 buffer = Fother_buffer (obj, Qnil, w->frame);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1801 if (NILP (buffer))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1802 buffer = Fget_buffer_create (build_string ("*scratch*"));
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1803 Fset_window_buffer (window, buffer);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1804 if (EQ (window, selected_window))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1805 Fset_buffer (w->buffer);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1806 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1807 else
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1808 Fdelete_window (window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1809 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1810 break;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1811
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1812 case GET_LARGEST_WINDOW:
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1813 {
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1814 /* Ignore dedicated windows and minibuffers. */
31393
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1815 if (MINI_WINDOW_P (w) || !NILP (w->dedicated))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1816 break;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1817
31393
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1818 if (NILP (best_window))
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1819 best_window = window;
31393
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1820 else
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1821 {
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1822 struct window *b = XWINDOW (best_window);
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1823 if (XFASTINT (w->height) * XFASTINT (w->width)
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1824 > XFASTINT (b->height) * XFASTINT (b->width))
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1825 best_window = window;
9cb95a7ee33e (window_loop) <GET_LARGEST_WINDOW>: Fix bug making
Gerd Moellmann <gerd@gnu.org>
parents: 31117
diff changeset
1826 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1827 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1828 break;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1829
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1830 case UNSHOW_BUFFER:
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1831 if (EQ (w->buffer, obj))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1832 {
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1833 Lisp_Object buffer;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1834 struct frame *f = XFRAME (w->frame);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1835
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1836 /* Find another buffer to show in this window. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1837 buffer = Fother_buffer (obj, Qnil, w->frame);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1838 if (NILP (buffer))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1839 buffer = Fget_buffer_create (build_string ("*scratch*"));
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1840
7647
d93dff6fbc73 (window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents: 7618
diff changeset
1841 /* If this window is dedicated, and in a frame of its own,
d93dff6fbc73 (window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents: 7618
diff changeset
1842 kill the frame. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1843 if (EQ (window, FRAME_ROOT_WINDOW (f))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1844 && !NILP (w->dedicated)
7647
d93dff6fbc73 (window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents: 7618
diff changeset
1845 && other_visible_frames (f))
8536
b97057eb17d3 (window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents: 8508
diff changeset
1846 {
b97057eb17d3 (window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents: 8508
diff changeset
1847 /* Skip the other windows on this frame.
b97057eb17d3 (window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents: 8508
diff changeset
1848 There might be one, the minibuffer! */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1849 while (CONSP (XCDR (windows))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1850 && EQ (XWINDOW (XCAR (windows))->frame,
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1851 XWINDOW (XCAR (XCDR (windows)))->frame))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1852 windows = XCDR (windows);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1853
8536
b97057eb17d3 (window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents: 8508
diff changeset
1854 /* Now we can safely delete the frame. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1855 Fdelete_frame (w->frame, Qnil);
8536
b97057eb17d3 (window_loop, case UNSHOW_BUFFER):
Richard M. Stallman <rms@gnu.org>
parents: 8508
diff changeset
1856 }
7647
d93dff6fbc73 (window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents: 7618
diff changeset
1857 else
d93dff6fbc73 (window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents: 7618
diff changeset
1858 {
d93dff6fbc73 (window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents: 7618
diff changeset
1859 /* Otherwise show a different buffer in the window. */
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1860 w->dedicated = Qnil;
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1861 Fset_window_buffer (window, buffer);
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1862 if (EQ (window, selected_window))
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1863 Fset_buffer (w->buffer);
7647
d93dff6fbc73 (window_loop, UNSHOW_BUFFER case):
Richard M. Stallman <rms@gnu.org>
parents: 7618
diff changeset
1864 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1865 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1866 break;
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1867
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1868 /* Check for a window that has a killed buffer. */
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1869 case CHECK_ALL_WINDOWS:
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1870 if (! NILP (w->buffer)
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1871 && NILP (XBUFFER (w->buffer)->name))
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1872 abort ();
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1873 break;
31829
43566b0aec59 Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents: 31393
diff changeset
1874
43566b0aec59 Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents: 31393
diff changeset
1875 case WINDOW_LOOP_UNUSED:
43566b0aec59 Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents: 31393
diff changeset
1876 break;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1877 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1878 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1879
30093
22f8fc642575 (Fwindow_list): Reverse list at the end.
Gerd Moellmann <gerd@gnu.org>
parents: 30045
diff changeset
1880 UNGCPRO;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1881 return best_window;
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
1882 }
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1883
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1884 /* Used for debugging. Abort if any window has a dead buffer. */
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1885
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
1886 void
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1887 check_all_windows ()
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1888 {
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1889 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt);
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1890 }
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
1891
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1892 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1893 "Return the window least recently selected or used for display.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1894 If optional argument FRAME is `visible', search all visible frames.\n\
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
1895 If FRAME is 0, search all visible and iconified frames.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1896 If FRAME is t, search all frames.\n\
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1897 If FRAME is nil, search only the selected frame.\n\
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1898 If FRAME is a frame, search only that frame.")
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1899 (frame)
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1900 Lisp_Object frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1901 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1902 register Lisp_Object w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1903 /* First try for a window that is full-width */
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1904 w = window_loop (GET_LRU_WINDOW, Qt, 0, frame);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1905 if (!NILP (w) && !EQ (w, selected_window))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1906 return w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1907 /* If none of them, try the rest */
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1908 return window_loop (GET_LRU_WINDOW, Qnil, 0, frame);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1909 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1910
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1911 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1912 "Return the largest window in area.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1913 If optional argument FRAME is `visible', search all visible frames.\n\
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
1914 If FRAME is 0, search all visible and iconified frames.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1915 If FRAME is t, search all frames.\n\
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1916 If FRAME is nil, search only the selected frame.\n\
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1917 If FRAME is a frame, search only that frame.")
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1918 (frame)
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1919 Lisp_Object frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1920 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1921 return window_loop (GET_LARGEST_WINDOW, Qnil, 0,
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1922 frame);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1923 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1924
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1925 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1926 "Return a window currently displaying BUFFER, or nil if none.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1927 If optional argument FRAME is `visible', search all visible frames.\n\
8167
ae9b49cc645f (Fnext_window, Fprevious_window): ALL_FRAMES = 0 means
Richard M. Stallman <rms@gnu.org>
parents: 8139
diff changeset
1928 If optional argument FRAME is 0, search all visible and iconified frames.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1929 If FRAME is t, search all frames.\n\
3803
c267c2431d92 Don't let the 'B' interactive spec default to buffers viewed in
Jim Blandy <jimb@redhat.com>
parents: 3785
diff changeset
1930 If FRAME is nil, search only the selected frame.\n\
6247
22d4037cbce2 (Fprevious_window, Fnext_window): ALL_FRAMES = visible
Richard M. Stallman <rms@gnu.org>
parents: 6242
diff changeset
1931 If FRAME is a frame, search only that frame.")
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1932 (buffer, frame)
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1933 Lisp_Object buffer, frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1934 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1935 buffer = Fget_buffer (buffer);
9105
984a4b1be1d1 (Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents: 9028
diff changeset
1936 if (BUFFERP (buffer))
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1937 return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1938 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1939 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1940 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1941
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1942 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1943 0, 1, "",
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
1944 "Make WINDOW (or the selected window) fill its frame.\n\
4564
9fc21d8d9441 (Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents: 4347
diff changeset
1945 Only the frame WINDOW is on is affected.\n\
9fc21d8d9441 (Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents: 4347
diff changeset
1946 This function tries to reduce display jumps\n\
9fc21d8d9441 (Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents: 4347
diff changeset
1947 by keeping the text previously visible in WINDOW\n\
9fc21d8d9441 (Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents: 4347
diff changeset
1948 in the same place on the frame. Doing this depends on\n\
9fc21d8d9441 (Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents: 4347
diff changeset
1949 the value of (window-start WINDOW), so if calling this function\n\
9fc21d8d9441 (Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents: 4347
diff changeset
1950 in a program gives strange scrolling, make sure the window-start\n\
9fc21d8d9441 (Frecenter): Preserve point in the buffer we change it in.
Richard M. Stallman <rms@gnu.org>
parents: 4347
diff changeset
1951 value is reasonable when this function is called.")
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1952 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1953 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1954 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1955 struct window *w;
7348
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1956 int startpos;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1957 int top;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1958
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
1959 if (NILP (window))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1960 window = selected_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1961 else
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
1962 CHECK_LIVE_WINDOW (window, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1963
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1964 w = XWINDOW (window);
9028
74119e5602eb (Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents: 8991
diff changeset
1965
7348
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1966 startpos = marker_position (w->start);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
1967 top = XFASTINT (w->top) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w)));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1968
9028
74119e5602eb (Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents: 8991
diff changeset
1969 if (MINI_WINDOW_P (w) && top > 0)
74119e5602eb (Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents: 8991
diff changeset
1970 error ("Can't expand minibuffer to full frame");
74119e5602eb (Fdelete_other_windows): Nice error if WINDOW is minibuf.
Richard M. Stallman <rms@gnu.org>
parents: 8991
diff changeset
1971
2190
482c7827b968 (Fdelete_other_windows): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents: 1994
diff changeset
1972 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1973
7348
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1974 /* Try to minimize scrolling, by setting the window start to the point
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1975 will cause the text at the old window start to be at the same place
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1976 on the frame. But don't try to do this if the window start is
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1977 outside the visible portion (as might happen when the display is
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1978 not current, due to typeahead). */
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1979 if (startpos >= BUF_BEGV (XBUFFER (w->buffer))
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1980 && startpos <= BUF_ZV (XBUFFER (w->buffer)))
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1981 {
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1982 struct position pos;
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1983 struct buffer *obuf = current_buffer;
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1984
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1985 Fset_buffer (w->buffer);
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1986 /* This computation used to temporarily move point, but that can
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1987 have unwanted side effects due to text properties. */
11809
56ffc162094b (Fdelete_other_windows): Fix args to vmotion.
Karl Heuer <kwzh@gnu.org>
parents: 11771
diff changeset
1988 pos = *vmotion (startpos, -top, w);
16555
6aea522a93c7 (Fdelete_other_windows): Set optional_new_start instead of force_start.
Richard M. Stallman <rms@gnu.org>
parents: 16522
diff changeset
1989
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1990 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos);
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1991 w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
1992 || FETCH_BYTE (pos.bytepos - 1) == '\n') ? Qt
7348
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1993 : Qnil);
13198
43d90596da34 (Fdelete_other_windows): Set w->force_start.
Richard M. Stallman <rms@gnu.org>
parents: 13187
diff changeset
1994 /* We need to do this, so that the window-scroll-functions
43d90596da34 (Fdelete_other_windows): Set w->force_start.
Richard M. Stallman <rms@gnu.org>
parents: 13187
diff changeset
1995 get called. */
16555
6aea522a93c7 (Fdelete_other_windows): Set optional_new_start instead of force_start.
Richard M. Stallman <rms@gnu.org>
parents: 16522
diff changeset
1996 w->optional_new_start = Qt;
7348
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1997
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1998 set_buffer_internal (obuf);
99b9c9068761 (Fdelete_other_windows): Do nothing if w->start is outside region.
Karl Heuer <kwzh@gnu.org>
parents: 7347
diff changeset
1999 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2000
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2001 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2002 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2003
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2004 DEFUN ("delete-windows-on", Fdelete_windows_on, Sdelete_windows_on,
4776
fdca0d445357 (Fdelete_windows_on): Fix DEFUN to allow optional second arg to appear.
Brian Fox <bfox@gnu.org>
parents: 4696
diff changeset
2005 1, 2, "bDelete windows on (buffer): ",
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2006 "Delete all windows showing BUFFER.\n\
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2007 Optional second argument FRAME controls which frames are affected.\n\
22223
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2008 If optional argument FRAME is `visible', search all visible frames.\n\
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2009 If FRAME is 0, search all visible and iconified frames.\n\
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2010 If FRAME is nil, search all frames.\n\
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2011 If FRAME is t, search only the selected frame.\n\
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2012 If FRAME is a frame, search only that frame.")
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2013 (buffer, frame)
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2014 Lisp_Object buffer, frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2015 {
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2016 /* FRAME uses t and nil to mean the opposite of what window_loop
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2017 expects. */
22223
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2018 if (NILP (frame))
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2019 frame = Qt;
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2020 else if (EQ (frame, Qt))
5d15aed3a37c (Fdelete_windows_on): For FRAME, change t to nil
Richard M. Stallman <rms@gnu.org>
parents: 22187
diff changeset
2021 frame = Qnil;
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2022
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2023 if (!NILP (buffer))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2024 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2025 buffer = Fget_buffer (buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2026 CHECK_BUFFER (buffer, 0);
4145
a0b726903a1f * window.c [not MULTI_FRAME] (Fdelete_windows_on): Set FRAME
Jim Blandy <jimb@redhat.com>
parents: 3803
diff changeset
2027 window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2028 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2029
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2030 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2031 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2032
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2033 DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2034 Sreplace_buffer_in_windows,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2035 1, 1, "bReplace buffer in windows: ",
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2036 "Replace BUFFER with some other buffer in all windows showing it.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2037 (buffer)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2038 Lisp_Object buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2039 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2040 if (!NILP (buffer))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2041 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2042 buffer = Fget_buffer (buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2043 CHECK_BUFFER (buffer, 0);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2044 window_loop (UNSHOW_BUFFER, buffer, 0, Qt);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2045 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2046 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2047 }
13918
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2048
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2049 /* Replace BUFFER with some other buffer in all windows
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2050 of all frames, even those on other keyboards. */
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2051
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2052 void
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2053 replace_buffer_in_all_windows (buffer)
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2054 Lisp_Object buffer;
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2055 {
14204
c0b44d3a8312 (replace_buffer_in_all_windows): Don't change selected
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
2056 #ifdef MULTI_KBOARD
13918
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2057 Lisp_Object tail, frame;
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2058
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2059 /* A single call to window_loop won't do the job
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2060 because it only considers frames on the current keyboard.
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2061 So loop manually over frames, and handle each one. */
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2062 FOR_EACH_FRAME (tail, frame)
20066
affc9c857428 (replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents: 20046
diff changeset
2063 window_loop (UNSHOW_BUFFER, buffer, 1, frame);
13918
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2064 #else
20066
affc9c857428 (replace_buffer_in_all_windows):
Karl Heuer <kwzh@gnu.org>
parents: 20046
diff changeset
2065 window_loop (UNSHOW_BUFFER, buffer, 1, Qt);
13918
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2066 #endif
2f6eaea659da (replace_buffer_in_all_windows): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13780
diff changeset
2067 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2068
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2069 /* Set the height of WINDOW and all its inferiors. */
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2070
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2071 /* The smallest acceptable dimensions for a window. Anything smaller
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2072 might crash Emacs. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2073
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2074 #define MIN_SAFE_WINDOW_WIDTH (2)
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2075 #define MIN_SAFE_WINDOW_HEIGHT (2)
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2076
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2077 /* Make sure that window_min_height and window_min_width are
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2078 not too small; if they are, set them to safe minima. */
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2079
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2080 static void
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2081 check_min_window_sizes ()
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2082 {
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2083 /* Smaller values might permit a crash. */
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2084 if (window_min_width < MIN_SAFE_WINDOW_WIDTH)
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2085 window_min_width = MIN_SAFE_WINDOW_WIDTH;
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2086 if (window_min_height < MIN_SAFE_WINDOW_HEIGHT)
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2087 window_min_height = MIN_SAFE_WINDOW_HEIGHT;
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2088 }
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2089
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2090 /* If *ROWS or *COLS are too small a size for FRAME, set them to the
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2091 minimum allowable size. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2092
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
2093 void
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2094 check_frame_size (frame, rows, cols)
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
2095 FRAME_PTR frame;
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
2096 int *rows, *cols;
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2097 {
4347
d6b289b1a6dc * window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents: 4292
diff changeset
2098 /* For height, we have to see:
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
2099 whether the frame has a minibuffer,
4347
d6b289b1a6dc * window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents: 4292
diff changeset
2100 whether it wants a mode line, and
d6b289b1a6dc * window.c (check_frame_size): Include the menu bar height in the
Jim Blandy <jimb@redhat.com>
parents: 4292
diff changeset
2101 whether it has a menu bar. */
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2102 int min_height =
3765
bde2da377085 * window.c (check_frame_size): Allow minibuffer-only frames to be
Jim Blandy <jimb@redhat.com>
parents: 3723
diff changeset
2103 (FRAME_MINIBUF_ONLY_P (frame) ? MIN_SAFE_WINDOW_HEIGHT - 1
bde2da377085 * window.c (check_frame_size): Allow minibuffer-only frames to be
Jim Blandy <jimb@redhat.com>
parents: 3723
diff changeset
2104 : (! FRAME_HAS_MINIBUF_P (frame)) ? MIN_SAFE_WINDOW_HEIGHT
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2105 : 2 * MIN_SAFE_WINDOW_HEIGHT - 1);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2106
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2107 if (FRAME_TOP_MARGIN (frame) > 0)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2108 min_height += FRAME_TOP_MARGIN (frame);
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2109
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2110 if (*rows < min_height)
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2111 *rows = min_height;
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2112 if (*cols < MIN_SAFE_WINDOW_WIDTH)
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2113 *cols = MIN_SAFE_WINDOW_WIDTH;
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2114 }
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
2115
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2116
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2117 /* Value is non-zero if window W is fixed-size. WIDTH_P non-zero means
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2118 check if W's width can be changed, otherwise check W's height.
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2119 CHECK_SIBLINGS_P non-zero means check resizablity of WINDOW's
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2120 siblings, too. If none of the siblings is resizable, WINDOW isn't
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2121 either. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2122
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2123 static int
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2124 window_fixed_size_p (w, width_p, check_siblings_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2125 struct window *w;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2126 int width_p, check_siblings_p;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2127 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2128 int fixed_p;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2129 struct window *c;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2130
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2131 if (!NILP (w->hchild))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2132 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2133 c = XWINDOW (w->hchild);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2134
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2135 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2136 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2137 /* A horiz. combination is fixed-width if all of if its
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2138 children are. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2139 while (c && window_fixed_size_p (c, width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2140 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2141 fixed_p = c == NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2142 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2143 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2144 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2145 /* A horiz. combination is fixed-height if one of if its
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2146 children is. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2147 while (c && !window_fixed_size_p (c, width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2148 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2149 fixed_p = c != NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2150 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2151 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2152 else if (!NILP (w->vchild))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2153 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2154 c = XWINDOW (w->vchild);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2155
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2156 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2157 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2158 /* A vert. combination is fixed-width if one of if its
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2159 children is. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2160 while (c && !window_fixed_size_p (c, width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2161 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2162 fixed_p = c != NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2163 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2164 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2165 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2166 /* A vert. combination is fixed-height if all of if its
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2167 children are. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2168 while (c && window_fixed_size_p (c, width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2169 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2170 fixed_p = c == NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2171 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2172 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2173 else if (BUFFERP (w->buffer))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2174 {
25739
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2175 if (w->height_fixed_p && !width_p)
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2176 fixed_p = 1;
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2177 else
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2178 {
25739
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2179 struct buffer *old = current_buffer;
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2180 Lisp_Object val;
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2181
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2182 current_buffer = XBUFFER (w->buffer);
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2183 val = find_symbol_value (Qwindow_size_fixed);
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2184 current_buffer = old;
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2185
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2186 fixed_p = 0;
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2187 if (!EQ (val, Qunbound))
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2188 {
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2189 fixed_p = !NILP (val);
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2190
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2191 if (fixed_p
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2192 && ((EQ (val, Qheight) && width_p)
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2193 || (EQ (val, Qwidth) && !width_p)))
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2194 fixed_p = 0;
a4321ad412ba (Fset_window_buffer): Remove unused variables.
Gerd Moellmann <gerd@gnu.org>
parents: 25676
diff changeset
2195 }
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2196 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2197
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2198 /* Can't tell if this one is resizable without looking at
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2199 siblings. If all siblings are fixed-size this one is too. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2200 if (!fixed_p && check_siblings_p && WINDOWP (w->parent))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2201 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2202 Lisp_Object child;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2203
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2204 for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2205 if (!window_fixed_size_p (XWINDOW (child), width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2206 break;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2207
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2208 if (NILP (child))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2209 for (child = w->next; !NILP (child); child = XWINDOW (child)->next)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2210 if (!window_fixed_size_p (XWINDOW (child), width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2211 break;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2212
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2213 if (NILP (child))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2214 fixed_p = 1;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2215 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2216 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2217 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2218 fixed_p = 1;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2219
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2220 return fixed_p;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2221 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2222
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2223
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2224 /* Return the minimum size of window W, not taking fixed-width windows
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2225 into account. WIDTH_P non-zero means return the minimum width,
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2226 otherwise return the minimum height. If W is a combination window,
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2227 compute the minimum size from the minimum sizes of W's children. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2228
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2229 static int
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2230 window_min_size_1 (w, width_p)
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2231 struct window *w;
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2232 int width_p;
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2233 {
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2234 struct window *c;
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2235 int size;
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2236
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2237 if (!NILP (w->hchild))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2238 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2239 c = XWINDOW (w->hchild);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2240 size = 0;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2241
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2242 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2243 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2244 /* The min width of a horizontal combination is
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2245 the sum of the min widths of its children. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2246 while (c)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2247 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2248 size += window_min_size_1 (c, width_p);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2249 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2250 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2251 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2252 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2253 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2254 /* The min height a horizontal combination equals
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2255 the maximum of all min height of its children. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2256 while (c)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2257 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2258 int min_size = window_min_size_1 (c, width_p);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2259 size = max (min_size, size);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2260 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2261 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2262 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2263 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2264 else if (!NILP (w->vchild))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2265 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2266 c = XWINDOW (w->vchild);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2267 size = 0;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2269 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2270 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2271 /* The min width of a vertical combination is
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2272 the maximum of the min widths of its children. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2273 while (c)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2274 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2275 int min_size = window_min_size_1 (c, width_p);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2276 size = max (min_size, size);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2277 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2278 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2279 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2280 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2281 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2282 /* The min height of a vertical combination equals
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2283 the sum of the min height of its children. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2284 while (c)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2285 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2286 size += window_min_size_1 (c, width_p);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2287 c = WINDOWP (c->next) ? XWINDOW (c->next) : NULL;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2288 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2289 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2290 }
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2291 else
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2292 {
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2293 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2294 size = window_min_width;
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2295 else
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2296 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2297 if (MINI_WINDOW_P (w)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2298 || (!WINDOW_WANTS_MODELINE_P (w)
25546
Gerd Moellmann <gerd@gnu.org>
parents: 25544
diff changeset
2299 && !WINDOW_WANTS_HEADER_LINE_P (w)))
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2300 size = 1;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2301 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2302 size = window_min_height;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2303 }
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2304 }
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2305
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2306 return size;
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2307 }
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2308
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
2309
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2310 /* Return the minimum size of window W, taking fixed-size windows into
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2311 account. WIDTH_P non-zero means return the minimum width,
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2312 otherwise return the minimum height. IGNORE_FIXED_P non-zero means
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2313 ignore if W is fixed-size. Set *FIXED to 1 if W is fixed-size
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2314 unless FIXED is null. */
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2315
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2316 static int
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2317 window_min_size (w, width_p, ignore_fixed_p, fixed)
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2318 struct window *w;
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2319 int width_p, ignore_fixed_p, *fixed;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2320 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2321 int size, fixed_p;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2322
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2323 if (ignore_fixed_p)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2324 fixed_p = 0;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2325 else
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2326 fixed_p = window_fixed_size_p (w, width_p, 1);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2327
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2328 if (fixed)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2329 *fixed = fixed_p;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2330
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2331 if (fixed_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2332 size = width_p ? XFASTINT (w->width) : XFASTINT (w->height);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2333 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2334 size = window_min_size_1 (w, width_p);
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
2335
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2336 return size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2337 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2338
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2339
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2340 /* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2341 WINDOW's width. Resize WINDOW's children, if any, so that they
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2342 keep their proportionate size relative to WINDOW. Propagate
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2343 WINDOW's top or left edge position to children. Delete windows
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2344 that become too small unless NODELETE_P is non-zero. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2345
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2346 static void
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2347 size_window (window, size, width_p, nodelete_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2348 Lisp_Object window;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2349 int size, width_p, nodelete_p;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2350 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2351 struct window *w = XWINDOW (window);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2352 struct window *c;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2353 Lisp_Object child, *forward, *sideward;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2354 int old_size, min_size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2355
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2356 check_min_window_sizes ();
32824
6521cc146e8e (size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents: 32800
diff changeset
2357 size = max (0, size);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2358
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2359 /* If the window has been "too small" at one point,
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2360 don't delete it for being "too small" in the future.
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2361 Preserve it as long as that is at all possible. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2362 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2363 {
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2364 old_size = XINT (w->width);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2365 min_size = window_min_width;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2366 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2367 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2368 {
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2369 old_size = XINT (w->height);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2370 min_size = window_min_height;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2371 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2372
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2373 if (old_size < window_min_width)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2374 w->too_small_ok = Qt;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2375
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2376 /* Maybe delete WINDOW if it's too small. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2377 if (!nodelete_p && !NILP (w->parent))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2378 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2379 int min_size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2380
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2381 if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2382 min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2383 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2384 min_size = width_p ? window_min_width : window_min_height;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2385
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2386 if (size < min_size)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2387 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2388 delete_window (window);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2389 return;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2390 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2391 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2392
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2393 /* Set redisplay hints. */
32824
6521cc146e8e (size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents: 32800
diff changeset
2394 w->last_modified = make_number (0);
6521cc146e8e (size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents: 32800
diff changeset
2395 w->last_overlay_modified = make_number (0);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2396 windows_or_buffers_changed++;
32824
6521cc146e8e (size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents: 32800
diff changeset
2397 FRAME_WINDOW_SIZES_CHANGED (XFRAME (w->frame)) = 1;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2398
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2399 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2400 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2401 sideward = &w->vchild;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2402 forward = &w->hchild;
32824
6521cc146e8e (size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents: 32800
diff changeset
2403 w->width = make_number (size);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2404 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2405 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2406 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2407 sideward = &w->hchild;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2408 forward = &w->vchild;
32824
6521cc146e8e (size_window): Prevent setting window's width or
Gerd Moellmann <gerd@gnu.org>
parents: 32800
diff changeset
2409 w->height = make_number (size);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2410 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2411
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2412 if (!NILP (*sideward))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2413 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2414 for (child = *sideward; !NILP (child); child = c->next)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2415 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2416 c = XWINDOW (child);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2417 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2418 c->left = w->left;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2419 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2420 c->top = w->top;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2421 size_window (child, size, width_p, nodelete_p);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2422 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2423 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2424 else if (!NILP (*forward))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2425 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2426 int fixed_size, each, extra, n;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2427 int resize_fixed_p, nfixed;
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2428 int last_pos, first_pos, nchildren, total;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2429
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2430 /* Determine the fixed-size portion of the this window, and the
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2431 number of child windows. */
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2432 fixed_size = nchildren = nfixed = total = 0;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2433 for (child = *forward; !NILP (child); child = c->next, ++nchildren)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2434 {
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2435 int child_size;
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2436
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2437 c = XWINDOW (child);
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2438 child_size = width_p ? XINT (c->width) : XINT (c->height);
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2439 total += child_size;
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2440
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2441 if (window_fixed_size_p (c, width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2442 {
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2443 fixed_size += child_size;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2444 ++nfixed;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2445 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2446 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2447
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2448 /* If the new size is smaller than fixed_size, or if there
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2449 aren't any resizable windows, allow resizing fixed-size
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2450 windows. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2451 resize_fixed_p = nfixed == nchildren || size < fixed_size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2452
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2453 /* Compute how many lines/columns to add to each child. The
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2454 value of extra takes care of rounding errors. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2455 n = resize_fixed_p ? nchildren : nchildren - nfixed;
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2456 each = (size - total) / n;
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2457 extra = (size - total) - n * each;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2458
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2459 /* Compute new children heights and edge positions. */
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2460 first_pos = width_p ? XINT (w->left) : XINT (w->top);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2461 last_pos = first_pos;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2462 for (child = *forward; !NILP (child); child = c->next)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2463 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2464 int new_size, old_size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2465
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2466 c = XWINDOW (child);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2467 old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2468 new_size = old_size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2469
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2470 /* The top or left edge position of this child equals the
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2471 bottom or right edge of its predecessor. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2472 if (width_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2473 c->left = make_number (last_pos);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2474 else
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2475 c->top = make_number (last_pos);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2476
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2477 /* If this child can be resized, do it. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2478 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2479 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2480 new_size = old_size + each + extra;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2481 extra = 0;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2482 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2483
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2484 /* Set new height. Note that size_window also propagates
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2485 edge positions to children, so it's not a no-op if we
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2486 didn't change the child's size. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2487 size_window (child, new_size, width_p, 1);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2488
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2489 /* Remember the bottom/right edge position of this child; it
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2490 will be used to set the top/left edge of the next child. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2491 last_pos += new_size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2492 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2493
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2494 /* We should have covered the parent exactly with child windows. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2495 xassert (size == last_pos - first_pos);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2496
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2497 /* Now delete any children that became too small. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2498 if (!nodelete_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2499 for (child = *forward; !NILP (child); child = c->next)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2500 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2501 int child_size;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2502 c = XWINDOW (child);
32928
859adc7ac97d (size_window): Compute size difference from sum of old
Gerd Moellmann <gerd@gnu.org>
parents: 32871
diff changeset
2503 child_size = width_p ? XINT (c->width) : XINT (c->height);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2504 size_window (child, child_size, width_p, 0);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2505 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2506 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2507 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2508
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2509 /* Set WINDOW's height to HEIGHT, and recursively change the height of
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2510 WINDOW's children. NODELETE non-zero means don't delete windows
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2511 that become too small in the process. (The caller should check
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2512 later and do so if appropriate.) */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2513
20351
f69eb2ab4f0f Add prototypes.
Andreas Schwab <schwab@suse.de>
parents: 20090
diff changeset
2514 void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2515 set_window_height (window, height, nodelete)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2516 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2517 int height;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2518 int nodelete;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2519 {
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2520 size_window (window, height, 0, nodelete);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2521 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2522
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2523
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2524 /* Set WINDOW's width to WIDTH, and recursively change the width of
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2525 WINDOW's children. NODELETE non-zero means don't delete windows
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2526 that become too small in the process. (The caller should check
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2527 later and do so if appropriate.) */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2528
20351
f69eb2ab4f0f Add prototypes.
Andreas Schwab <schwab@suse.de>
parents: 20090
diff changeset
2529 void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2530 set_window_width (window, width, nodelete)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2531 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2532 int width;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2533 int nodelete;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2534 {
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2535 size_window (window, width, 1, nodelete);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2536 }
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
2537
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2538
362
d1e5cf833d37 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 358
diff changeset
2539 int window_select_count;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2540
14445
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2541 Lisp_Object
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2542 Fset_window_buffer_unwind (obuf)
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2543 Lisp_Object obuf;
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2544 {
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2545 Fset_buffer (obuf);
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2546 return Qnil;
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2547 }
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
2548
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2549
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2550 /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2551 means it's allowed to run hooks. See make_frame for a case where
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2552 it's not allowed. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2553
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2554 void
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2555 set_window_buffer (window, buffer, run_hooks_p)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2556 Lisp_Object window, buffer;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2557 int run_hooks_p;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2558 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2559 struct window *w = XWINDOW (window);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2560 struct buffer *b = XBUFFER (buffer);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2561 int count = specpdl_ptr - specpdl;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2562
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2563 w->buffer = buffer;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2564
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2565 if (EQ (window, selected_window))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2566 b->last_selected_window = window;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2567
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2568 /* Update time stamps of buffer display. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2569 if (INTEGERP (b->display_count))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2570 XSETINT (b->display_count, XINT (b->display_count) + 1);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2571 b->display_time = Fcurrent_time ();
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2572
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2573 XSETFASTINT (w->window_end_pos, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2574 XSETFASTINT (w->window_end_vpos, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2575 bzero (&w->last_cursor, sizeof w->last_cursor);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2576 w->window_end_valid = Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2577 XSETFASTINT (w->hscroll, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2578 set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2579 set_marker_restricted (w->start,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2580 make_number (b->last_window_start),
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2581 buffer);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2582 w->start_at_line_beg = Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2583 w->force_start = Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2584 XSETFASTINT (w->last_modified, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2585 XSETFASTINT (w->last_overlay_modified, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2586 windows_or_buffers_changed++;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2587
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2588 /* We must select BUFFER for running the window-scroll-functions.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2589 If WINDOW is selected, switch permanently.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2590 Otherwise, switch but go back to the ambient buffer afterward. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2591 if (EQ (window, selected_window))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2592 Fset_buffer (buffer);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2593 /* We can't check ! NILP (Vwindow_scroll_functions) here
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2594 because that might itself be a local variable. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2595 else if (window_initialized)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2596 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2597 record_unwind_protect (Fset_window_buffer_unwind, Fcurrent_buffer ());
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2598 Fset_buffer (buffer);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2599 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2600
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2601 /* Set left and right marginal area width from buffer. */
25591
d58d733a75d6 (Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25549
diff changeset
2602 Fset_window_margins (window, b->left_margin_width, b->right_margin_width);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2603
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2604 if (run_hooks_p)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2605 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2606 if (! NILP (Vwindow_scroll_functions))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2607 run_hook_with_args_2 (Qwindow_scroll_functions, window,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2608 Fmarker_position (w->start));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2609
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2610 if (! NILP (Vwindow_configuration_change_hook)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2611 && ! NILP (Vrun_hooks))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2612 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2613 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2614
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2615 unbind_to (count, Qnil);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2616 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2617
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2618
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2619 DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 2, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2620 "Make WINDOW display BUFFER as its contents.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2621 BUFFER can be a buffer or buffer name.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2622 (window, buffer)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2623 register Lisp_Object window, buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2624 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2625 register Lisp_Object tem;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2626 register struct window *w = decode_window (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2627
27848
27b993d2ea05 (Fset_window_buffer): Set WINDOW to the window
Gerd Moellmann <gerd@gnu.org>
parents: 27699
diff changeset
2628 XSETWINDOW (window, w);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2629 buffer = Fget_buffer (buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2630 CHECK_BUFFER (buffer, 1);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2631
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2632 if (NILP (XBUFFER (buffer)->name))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2633 error ("Attempt to display deleted buffer");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2634
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2635 tem = w->buffer;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2636 if (NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2637 error ("Window is deleted");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2638 else if (! EQ (tem, Qt)) /* w->buffer is t when the window
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2639 is first being set up. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2640 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2641 if (!NILP (w->dedicated) && !EQ (tem, buffer))
7545
0e1f3b9598bb (Fset_window_buffer): Fix dedicated window error call.
Richard M. Stallman <rms@gnu.org>
parents: 7348
diff changeset
2642 error ("Window is dedicated to `%s'",
0e1f3b9598bb (Fset_window_buffer): Fix dedicated window error call.
Richard M. Stallman <rms@gnu.org>
parents: 7348
diff changeset
2643 XSTRING (XBUFFER (tem)->name)->data);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2644
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2645 unshow_buffer (w);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2646 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2647
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
2648 set_window_buffer (window, buffer, 1);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2649 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2650 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2651
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2652 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2653 "Select WINDOW. Most editing will apply to WINDOW's buffer.\n\
22149
ad3ee5ec90d1 (Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21844
diff changeset
2654 If WINDOW is not already selected, also make WINDOW's buffer current.\n\
ad3ee5ec90d1 (Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21844
diff changeset
2655 Note that the main editor command loop\n\
ad3ee5ec90d1 (Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21844
diff changeset
2656 selects the buffer of the selected window before each command.")
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2657 (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2658 register Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2659 {
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2660 return select_window_1 (window, 1);
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2661 }
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2662
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2663 /* Note that selected_window can be nil
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2664 when this is called from Fset_window_configuration. */
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2665
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2666 static Lisp_Object
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2667 select_window_1 (window, recordflag)
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2668 register Lisp_Object window;
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2669 int recordflag;
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2670 {
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2671 register struct window *w;
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2672 register struct window *ow;
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2673 struct frame *sf;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2674
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
2675 CHECK_LIVE_WINDOW (window, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2676
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2677 w = XWINDOW (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2678
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2679 if (NILP (w->buffer))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2680 error ("Trying to select deleted window or non-leaf window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2681
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
2682 XSETFASTINT (w->use_time, ++window_select_count);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2683 if (EQ (window, selected_window))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2684 return window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2685
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2686 if (!NILP (selected_window))
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2687 {
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2688 ow = XWINDOW (selected_window);
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2689 if (! NILP (ow->buffer))
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2690 set_marker_both (ow->pointm, ow->buffer,
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2691 BUF_PT (XBUFFER (ow->buffer)),
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2692 BUF_PT_BYTE (XBUFFER (ow->buffer)));
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
2693 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2694
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2695 selected_window = window;
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2696 sf = SELECTED_FRAME ();
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2697 if (XFRAME (WINDOW_FRAME (w)) != sf)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2698 {
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
2699 XFRAME (WINDOW_FRAME (w))->selected_window = window;
7080
4751ee5f263e (Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents: 7056
diff changeset
2700 /* Use this rather than Fhandle_switch_frame
4751ee5f263e (Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents: 7056
diff changeset
2701 so that FRAME_FOCUS_FRAME is moved appropriately as we
4751ee5f263e (Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents: 7056
diff changeset
2702 move around in the state where a minibuffer in a separate
4751ee5f263e (Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents: 7056
diff changeset
2703 frame is active. */
4751ee5f263e (Fselect_window): Use Fselect_frame.
Richard M. Stallman <rms@gnu.org>
parents: 7056
diff changeset
2704 Fselect_frame (WINDOW_FRAME (w), Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2705 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2706 else
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2707 sf->selected_window = window;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2708
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2709 if (recordflag)
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2710 record_buffer (w->buffer);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2711 Fset_buffer (w->buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2712
16068
b19129a8c644 (unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents: 16051
diff changeset
2713 XBUFFER (w->buffer)->last_selected_window = window;
b19129a8c644 (unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents: 16051
diff changeset
2714
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2715 /* Go to the point recorded in the window.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2716 This is important when the buffer is in more
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2717 than one window. It also matters when
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2718 redisplay_window has altered point after scrolling,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2719 because it makes the change only in the window. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2720 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2721 register int new_point = marker_position (w->pointm);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2722 if (new_point < BEGV)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2723 SET_PT (BEGV);
8245
b743577d12c2 (Fselect_window): Fix bug checking new_point is in range.
Richard M. Stallman <rms@gnu.org>
parents: 8191
diff changeset
2724 else if (new_point > ZV)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2725 SET_PT (ZV);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2726 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2727 SET_PT (new_point);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2728 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2729
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2730 windows_or_buffers_changed++;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2731 return window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2732 }
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
2733
14175
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2734 /* Deiconify the frame containing the window WINDOW,
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2735 unless it is the selected frame;
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2736 then return WINDOW.
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2737
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2738 The reason for the exception for the selected frame
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2739 is that it seems better not to change the selected frames visibility
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2740 merely because of displaying a different buffer in it.
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2741 The deiconification is useful when a buffer gets shown in
ace33b55f549 (display_buffer_1): Don't deiconify the selected frame.
Richard M. Stallman <rms@gnu.org>
parents: 14166
diff changeset
2742 another frame that you were not using lately. */
13619
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2743
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2744 static Lisp_Object
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2745 display_buffer_1 (window)
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2746 Lisp_Object window;
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2747 {
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2748 Lisp_Object frame = XWINDOW (window)->frame;
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2749 FRAME_PTR f = XFRAME (frame);
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2750
13619
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2751 FRAME_SAMPLE_VISIBILITY (f);
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2752
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2753 if (!EQ (frame, selected_frame))
14535
8ca7e641c144 (display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents: 14445
diff changeset
2754 {
8ca7e641c144 (display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents: 14445
diff changeset
2755 if (FRAME_ICONIFIED_P (f))
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2756 Fmake_frame_visible (frame);
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
2757 else if (FRAME_VISIBLE_P (f))
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2758 Fraise_frame (frame);
14535
8ca7e641c144 (display_buffer_1): Raise the frame if already visible.
Richard M. Stallman <rms@gnu.org>
parents: 14445
diff changeset
2759 }
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2760
13619
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2761 return window;
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2762 }
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2763
16390
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2764 DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0,
16587
13cda507257c (special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents: 16559
diff changeset
2765 "Returns non-nil if a buffer named BUFFER-NAME would be created specially.\n\
13cda507257c (special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents: 16559
diff changeset
2766 The value is actually t if the frame should be called with default frame\n\
13cda507257c (special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents: 16559
diff changeset
2767 parameters, and a list of frame parameters if they were specified.\n\
16390
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2768 See `special-display-buffer-names', and `special-display-regexps'.")
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2769 (buffer_name)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2770 Lisp_Object buffer_name;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2771 {
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2772 Lisp_Object tem;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2773
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2774 CHECK_STRING (buffer_name, 1);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2775
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2776 tem = Fmember (buffer_name, Vspecial_display_buffer_names);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2777 if (!NILP (tem))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2778 return Qt;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2779
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2780 tem = Fassoc (buffer_name, Vspecial_display_buffer_names);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2781 if (!NILP (tem))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2782 return XCDR (tem);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2783
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2784 for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCDR (tem))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2785 {
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2786 Lisp_Object car = XCAR (tem);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2787 if (STRINGP (car)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2788 && fast_string_match (car, buffer_name) >= 0)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2789 return Qt;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2790 else if (CONSP (car)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2791 && STRINGP (XCAR (car))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2792 && fast_string_match (XCAR (car), buffer_name) >= 0)
20653
19ba67f153d5 (Fspecial_display_p): Return the right value
Richard M. Stallman <rms@gnu.org>
parents: 20627
diff changeset
2793 return XCDR (car);
16390
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2794 }
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2795 return Qnil;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2796 }
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2797
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2798 DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0,
16587
13cda507257c (special-display-p, same-window-p): Add missing
Geoff Voelker <voelker@cs.washington.edu>
parents: 16559
diff changeset
2799 "Returns non-nil if a new buffer named BUFFER-NAME would use the same window.\n\
16390
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2800 See `same-window-buffer-names' and `same-window-regexps'.")
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2801 (buffer_name)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2802 Lisp_Object buffer_name;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2803 {
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2804 Lisp_Object tem;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2805
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2806 CHECK_STRING (buffer_name, 1);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2807
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2808 tem = Fmember (buffer_name, Vsame_window_buffer_names);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2809 if (!NILP (tem))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2810 return Qt;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2811
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2812 tem = Fassoc (buffer_name, Vsame_window_buffer_names);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2813 if (!NILP (tem))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2814 return Qt;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2815
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2816 for (tem = Vsame_window_regexps; CONSP (tem); tem = XCDR (tem))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2817 {
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2818 Lisp_Object car = XCAR (tem);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2819 if (STRINGP (car)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2820 && fast_string_match (car, buffer_name) >= 0)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2821 return Qt;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2822 else if (CONSP (car)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2823 && STRINGP (XCAR (car))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2824 && fast_string_match (XCAR (car), buffer_name) >= 0)
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2825 return Qt;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2826 }
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2827 return Qnil;
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2828 }
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2829
20867
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2830 /* Use B so the default is (other-buffer). */
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2831 DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 3,
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2832 "BDisplay buffer: \nP",
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2833 "Make BUFFER appear in some window but don't select it.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2834 BUFFER can be a buffer or a buffer name.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2835 If BUFFER is shown already in some window, just use that one,\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2836 unless the window is the selected window and the optional second\n\
1805
7ba5cfe280eb (Fdisplay_buffer): Doc fix.
Roland McGrath <roland@gnu.org>
parents: 1798
diff changeset
2837 argument NOT-THIS-WINDOW is non-nil (interactively, with prefix arg).\n\
5232
823c0cf7bbc8 (Fdisplay_buffer): If pop_up_frames, pass t to Fget_buffer_window.
Richard M. Stallman <rms@gnu.org>
parents: 5096
diff changeset
2838 If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.\n\
15306
00619dd2f972 (Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 14536
diff changeset
2839 Returns the window displaying BUFFER.\n\
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2840 If `display-reuse-frames' is non-nil, and another frame is currently\n\
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2841 displaying BUFFER, then simply raise that frame.\n\
15306
00619dd2f972 (Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 14536
diff changeset
2842 \n\
00619dd2f972 (Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 14536
diff changeset
2843 The variables `special-display-buffer-names', `special-display-regexps',\n\
00619dd2f972 (Fdisplay_buffer): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 14536
diff changeset
2844 `same-window-buffer-names', and `same-window-regexps' customize how certain\n\
20867
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2845 buffer names are handled.\n\
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2846 \n\
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2847 If optional argument FRAME is `visible', search all visible frames.\n\
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2848 If FRAME is 0, search all visible and iconified frames.\n\
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2849 If FRAME is t, search all frames.\n\
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2850 If FRAME is a frame, search only that frame.\n\
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2851 If FRAME is nil, search only the selected frame\n\
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2852 (actually the last nonminibuffer frame),\n\
32800
09e092438107 (Fdisplay_buffer): Fix doc.
Kenichi Handa <handa@m17n.org>
parents: 32773
diff changeset
2853 unless `pop-up-frames' or `display-buffer-reuse-frames' is non-nil,\n\
34261
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
2854 which means search visible and iconified frames.\n\
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
2855 \n\
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
2856 If `even-window-heights' is non-nil, window heights will be evened out\n\
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
2857 if displaying the buffer causes two vertically\ adjacent windows to be\n\
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
2858 displayed.")
20867
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2859 (buffer, not_this_window, frame)
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2860 register Lisp_Object buffer, not_this_window, frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2861 {
25182
ef79ee0ceedd (display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents: 25115
diff changeset
2862 register Lisp_Object window, tem, swp;
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2863 struct frame *f;
25182
ef79ee0ceedd (display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents: 25115
diff changeset
2864
ef79ee0ceedd (display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents: 25115
diff changeset
2865 swp = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2866 buffer = Fget_buffer (buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2867 CHECK_BUFFER (buffer, 0);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2868
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2869 if (!NILP (Vdisplay_buffer_function))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2870 return call2 (Vdisplay_buffer_function, buffer, not_this_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2871
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2872 if (NILP (not_this_window)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2873 && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer))
13619
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2874 return display_buffer_1 (selected_window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2875
10958
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
2876 /* See if the user has specified this buffer should appear
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
2877 in the selected window. */
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
2878 if (NILP (not_this_window))
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
2879 {
25182
ef79ee0ceedd (display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents: 25115
diff changeset
2880 swp = Fsame_window_p (XBUFFER (buffer)->name);
ef79ee0ceedd (display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents: 25115
diff changeset
2881 if (!NILP (swp) && !no_switch_window (selected_window))
11003
71304a70d0f6 (Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents: 10958
diff changeset
2882 {
71304a70d0f6 (Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents: 10958
diff changeset
2883 Fswitch_to_buffer (buffer, Qnil);
13619
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2884 return display_buffer_1 (selected_window);
11003
71304a70d0f6 (Fdisplay_buffer): Fix prev change--return selected window.
Richard M. Stallman <rms@gnu.org>
parents: 10958
diff changeset
2885 }
10958
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
2886 }
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
2887
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2888 /* If the user wants pop-up-frames or display-reuse-frames, then
11427
c4ee56df7173 (Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents: 11405
diff changeset
2889 look for a window showing BUFFER on any visible or iconified frame.
c4ee56df7173 (Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents: 11405
diff changeset
2890 Otherwise search only the current frame. */
20867
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2891 if (! NILP (frame))
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
2892 tem = frame;
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2893 else if (pop_up_frames
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2894 || display_buffer_reuse_frames
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2895 || last_nonminibuf_frame == 0)
11427
c4ee56df7173 (Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents: 11405
diff changeset
2896 XSETFASTINT (tem, 0);
c4ee56df7173 (Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents: 11405
diff changeset
2897 else
c4ee56df7173 (Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents: 11405
diff changeset
2898 XSETFRAME (tem, last_nonminibuf_frame);
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2899
11427
c4ee56df7173 (Fdisplay_buffer): Search the proper frame when the
Karl Heuer <kwzh@gnu.org>
parents: 11405
diff changeset
2900 window = Fget_buffer_window (buffer, tem);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2901 if (!NILP (window)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2902 && (NILP (not_this_window) || !EQ (window, selected_window)))
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
2903 return display_buffer_1 (window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2904
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
2905 /* Certain buffer names get special handling. */
25182
ef79ee0ceedd (display-buffer): Don't get confused
Richard M. Stallman <rms@gnu.org>
parents: 25115
diff changeset
2906 if (!NILP (Vspecial_display_function) && NILP (swp))
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
2907 {
16390
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2908 tem = Fspecial_display_p (XBUFFER (buffer)->name);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2909 if (EQ (tem, Qt))
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
2910 return call1 (Vspecial_display_function, buffer);
16390
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2911 if (CONSP (tem))
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
2912 return call2 (Vspecial_display_function, buffer, tem);
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
2913 }
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
2914
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
2915 /* If there are no frames open that have more than a minibuffer,
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
2916 we need to create a new frame. */
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
2917 if (pop_up_frames || last_nonminibuf_frame == 0)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2918 {
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
2919 window = Fframe_selected_window (call0 (Vpop_up_frame_function));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2920 Fset_window_buffer (window, buffer);
13619
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
2921 return display_buffer_1 (window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2922 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2923
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2924 f = SELECTED_FRAME ();
358
71c9042fb90d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
2925 if (pop_up_windows
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2926 || FRAME_MINIBUF_ONLY_P (f)
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2927 /* If the current frame is a special display frame,
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2928 don't try to reuse its windows. */
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2929 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated))
358
71c9042fb90d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
2930 {
6517
8f5f79c3091a (unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents: 6487
diff changeset
2931 Lisp_Object frames;
8f5f79c3091a (unshow_buffer, window_loop, Fdisplay_buffer): Use assignment, not
Karl Heuer <kwzh@gnu.org>
parents: 6487
diff changeset
2932
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
2933 frames = Qnil;
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2934 if (FRAME_MINIBUF_ONLY_P (f))
9282
f4fa46f6a032 (Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents: 9243
diff changeset
2935 XSETFRAME (frames, last_nonminibuf_frame);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2936 /* Don't try to create a window if would get an error */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2937 if (split_height_threshold < window_min_height << 1)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2938 split_height_threshold = window_min_height << 1;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2939
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2940 /* Note that both Fget_largest_window and Fget_lru_window
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2941 ignore minibuffers and dedicated windows.
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2942 This means they can return nil. */
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2943
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2944 /* If the frame we would try to split cannot be split,
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2945 try other frames. */
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
2946 if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame))
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2947 {
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2948 /* Try visible frames first. */
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2949 window = Fget_largest_window (Qvisible);
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2950 /* If that didn't work, try iconified frames. */
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2951 if (NILP (window))
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2952 window = Fget_largest_window (make_number (0));
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2953 if (NILP (window))
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2954 window = Fget_largest_window (Qt);
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2955 }
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2956 else
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2957 window = Fget_largest_window (frames);
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2958
9567
cf4f4c8a3ef6 (Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents: 9324
diff changeset
2959 /* If we got a tall enough full-width window that can be split,
cf4f4c8a3ef6 (Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents: 9324
diff changeset
2960 split it. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
2961 if (!NILP (window)
9567
cf4f4c8a3ef6 (Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents: 9324
diff changeset
2962 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2963 && window_height (window) >= split_height_threshold
16297
701db778b7a4 (Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents: 16208
diff changeset
2964 && WINDOW_FULL_WIDTH_P (XWINDOW (window)))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2965 window = Fsplit_window (window, Qnil, Qnil);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2966 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2967 {
9614
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
2968 Lisp_Object upper, lower, other;
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
2969
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
2970 window = Fget_lru_window (frames);
9567
cf4f4c8a3ef6 (Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents: 9324
diff changeset
2971 /* If the LRU window is selected, and big enough,
cf4f4c8a3ef6 (Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents: 9324
diff changeset
2972 and can be split, split it. */
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2973 if (!NILP (window)
9567
cf4f4c8a3ef6 (Fdisplay_buffer): In desperation case of looking for
Richard M. Stallman <rms@gnu.org>
parents: 9324
diff changeset
2974 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2975 && (EQ (window, selected_window)
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2976 || EQ (XWINDOW (window)->parent, Qnil))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2977 && window_height (window) >= window_min_height << 1)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2978 window = Fsplit_window (window, Qnil, Qnil);
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2979 /* If Fget_lru_window returned nil, try other approaches. */
17628
0b6db83d4663 (Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents: 17540
diff changeset
2980
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2981 /* Try visible frames first. */
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2982 if (NILP (window))
17628
0b6db83d4663 (Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents: 17540
diff changeset
2983 window = Fget_buffer_window (buffer, Qvisible);
0b6db83d4663 (Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents: 17540
diff changeset
2984 if (NILP (window))
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2985 window = Fget_largest_window (Qvisible);
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2986 /* If that didn't work, try iconified frames. */
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2987 if (NILP (window))
17628
0b6db83d4663 (Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents: 17540
diff changeset
2988 window = Fget_buffer_window (buffer, make_number (0));
0b6db83d4663 (Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents: 17540
diff changeset
2989 if (NILP (window))
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2990 window = Fget_largest_window (make_number (0));
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2991 /* Try invisible frames. */
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2992 if (NILP (window))
17628
0b6db83d4663 (Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents: 17540
diff changeset
2993 window = Fget_buffer_window (buffer, Qt);
0b6db83d4663 (Fdisplay_buffer): If we give up and try other frames,
Richard M. Stallman <rms@gnu.org>
parents: 17540
diff changeset
2994 if (NILP (window))
8263
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2995 window = Fget_largest_window (Qt);
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2996 /* As a last resort, make a new frame. */
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2997 if (NILP (window))
bae811318a57 (Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents: 8245
diff changeset
2998 window = Fframe_selected_window (call0 (Vpop_up_frame_function));
9614
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
2999 /* If window appears above or below another,
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3000 even out their heights. */
11750
b911d6f75664 (Fdisplay_buffer): Initialize other, upper, lower.
Richard M. Stallman <rms@gnu.org>
parents: 11731
diff changeset
3001 other = upper = lower = Qnil;
9614
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3002 if (!NILP (XWINDOW (window)->prev))
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3003 other = upper = XWINDOW (window)->prev, lower = window;
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3004 if (!NILP (XWINDOW (window)->next))
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3005 other = lower = XWINDOW (window)->next, upper = window;
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3006 if (!NILP (other)
34261
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
3007 && !NILP (Veven_window_heights)
9614
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3008 /* Check that OTHER and WINDOW are vertically arrayed. */
17365
fc2ec9ced22f (delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents: 17281
diff changeset
3009 && !EQ (XWINDOW (other)->top, XWINDOW (window)->top)
fc2ec9ced22f (delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents: 17281
diff changeset
3010 && (XFASTINT (XWINDOW (other)->height)
fc2ec9ced22f (delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents: 17281
diff changeset
3011 > XFASTINT (XWINDOW (window)->height)))
9614
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3012 {
17365
fc2ec9ced22f (delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents: 17281
diff changeset
3013 int total = (XFASTINT (XWINDOW (other)->height)
fc2ec9ced22f (delete_window): Don't return value from void function.
Karl Heuer <kwzh@gnu.org>
parents: 17281
diff changeset
3014 + XFASTINT (XWINDOW (window)->height));
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3015 enlarge_window (upper,
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3016 total / 2 - XFASTINT (XWINDOW (upper)->height),
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3017 0);
9614
e466cdfd962e (Fdisplay_buffer): If the other window is smaller
Richard M. Stallman <rms@gnu.org>
parents: 9572
diff changeset
3018 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3019 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3020 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3021 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3022 window = Fget_lru_window (Qnil);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3023
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3024 Fset_window_buffer (window, buffer);
13619
3fa8cd29e1da (Fdisplay_buffer): Always deiconify the window's frame.
Richard M. Stallman <rms@gnu.org>
parents: 13583
diff changeset
3025 return display_buffer_1 (window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3026 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3027
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3028 void
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3029 temp_output_buffer_show (buf)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3030 register Lisp_Object buf;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3031 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3032 register struct buffer *old = current_buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3033 register Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3034 register struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3035
18493
d65021d5c39e (temp_output_buffer_show): Copy default-directory from current buffer.
Richard M. Stallman <rms@gnu.org>
parents: 18065
diff changeset
3036 XBUFFER (buf)->directory = current_buffer->directory;
d65021d5c39e (temp_output_buffer_show): Copy default-directory from current buffer.
Richard M. Stallman <rms@gnu.org>
parents: 18065
diff changeset
3037
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3038 Fset_buffer (buf);
10302
34556316a48a (temp_output_buffer_show): Use BUF_SAVE_MODIFF.
Richard M. Stallman <rms@gnu.org>
parents: 10043
diff changeset
3039 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3040 BEGV = BEG;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3041 ZV = Z;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3042 SET_PT (BEG);
25375
919b568e4108 (Fset_window_hscroll): Set
Gerd Moellmann <gerd@gnu.org>
parents: 25356
diff changeset
3043 XBUFFER (buf)->prevent_redisplay_optimizations_p = 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3044 set_buffer_internal (old);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3045
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3046 if (!EQ (Vtemp_buffer_show_function, Qnil))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3047 call1 (Vtemp_buffer_show_function, buf);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3048 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3049 {
20867
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
3050 window = Fdisplay_buffer (buf, Qnil, Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3051
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
3052 if (!EQ (XWINDOW (window)->frame, selected_frame))
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3053 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3054 Vminibuf_scroll_window = window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3055 w = XWINDOW (window);
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
3056 XSETFASTINT (w->hscroll, 0);
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
3057 set_marker_restricted_both (w->start, buf, 1, 1);
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
3058 set_marker_restricted_both (w->pointm, buf, 1, 1);
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3059
22149
ad3ee5ec90d1 (Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21844
diff changeset
3060 /* Run temp-buffer-show-hook, with the chosen window selected
ad3ee5ec90d1 (Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21844
diff changeset
3061 and it sbuffer current. */
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3062 if (!NILP (Vrun_hooks))
11405
645e3883da72 (temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents: 11307
diff changeset
3063 {
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3064 Lisp_Object tem;
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3065 tem = Fboundp (Qtemp_buffer_show_hook);
11405
645e3883da72 (temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents: 11307
diff changeset
3066 if (!NILP (tem))
645e3883da72 (temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents: 11307
diff changeset
3067 {
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3068 tem = Fsymbol_value (Qtemp_buffer_show_hook);
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3069 if (!NILP (tem))
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3070 {
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3071 int count = specpdl_ptr - specpdl;
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
3072 Lisp_Object prev_window;
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
3073 prev_window = selected_window;
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3074
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3075 /* Select the window that was chosen, for running the hook. */
23728
0d1a0ded9aa1 (temp_output_buffer_show): Around temp-buffer-show-hook,
Richard M. Stallman <rms@gnu.org>
parents: 23410
diff changeset
3076 record_unwind_protect (Fselect_window, prev_window);
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
3077 select_window_1 (window, 0);
22149
ad3ee5ec90d1 (Fselect_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21844
diff changeset
3078 Fset_buffer (w->buffer);
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3079 call1 (Vrun_hooks, Qtemp_buffer_show_hook);
22187
9509e86a7be5 (window_loop): Pass new arg to Fother_buffer.
Richard M. Stallman <rms@gnu.org>
parents: 22155
diff changeset
3080 select_window_1 (prev_window, 0);
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3081 unbind_to (count, Qnil);
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
3082 }
11405
645e3883da72 (temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents: 11307
diff changeset
3083 }
645e3883da72 (temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents: 11307
diff changeset
3084 }
645e3883da72 (temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents: 11307
diff changeset
3085 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3086 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3087
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
3088 static void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3089 make_dummy_parent (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3090 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3091 {
9970
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3092 Lisp_Object new;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3093 register struct window *o, *p;
9970
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3094 register struct Lisp_Vector *vec;
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3095 int i;
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3096
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3097 o = XWINDOW (window);
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3098 vec = allocate_vectorlike ((EMACS_INT)VECSIZE (struct window));
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3099 for (i = 0; i < VECSIZE (struct window); ++i)
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3100 vec->contents[i] = ((struct Lisp_Vector *)o)->contents[i];
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3101 vec->size = VECSIZE (struct window);
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3102 p = (struct window *)vec;
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3103 XSETWINDOW (new, p);
76910d506a80 (make_dummy_parent, make_window): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9964
diff changeset
3104
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
3105 XSETFASTINT (p->sequence_number, ++sequence_number);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3106
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3107 /* Put new into window structure in place of window */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3108 replace_window (window, new);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3109
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3110 o->next = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3111 o->prev = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3112 o->vchild = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3113 o->hchild = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3114 o->parent = new;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3115
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3116 p->start = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3117 p->pointm = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3118 p->buffer = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3119 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3120
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3121 DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "",
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3122 "Split WINDOW, putting SIZE lines in the first of the pair.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3123 WINDOW defaults to selected one and SIZE to half its size.\n\
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3124 If optional third arg HORFLAG is non-nil, split side by side\n\
22923
970b3bad71fd (Fsplit_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 22897
diff changeset
3125 and put SIZE columns in the first of the pair. In that case,\n\
970b3bad71fd (Fsplit_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 22897
diff changeset
3126 SIZE includes that window's scroll bar, or the divider column to its right.")
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3127 (window, size, horflag)
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3128 Lisp_Object window, size, horflag;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3129 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3130 register Lisp_Object new;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3131 register struct window *o, *p;
13723
4e170419e83c (Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents: 13619
diff changeset
3132 FRAME_PTR fo;
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3133 register int size_int;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3134
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3135 if (NILP (window))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3136 window = selected_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3137 else
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
3138 CHECK_LIVE_WINDOW (window, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3139
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3140 o = XWINDOW (window);
13723
4e170419e83c (Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents: 13619
diff changeset
3141 fo = XFRAME (WINDOW_FRAME (o));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3142
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3143 if (NILP (size))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3144 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3145 if (!NILP (horflag))
13723
4e170419e83c (Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents: 13619
diff changeset
3146 /* Calculate the size of the left-hand window, by dividing
25044
e6c2ab650ebc (Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents: 24997
diff changeset
3147 the usable space in columns by two.
e6c2ab650ebc (Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents: 24997
diff changeset
3148 We round up, since the left-hand window may include
e6c2ab650ebc (Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents: 24997
diff changeset
3149 a dividing line, while the right-hand may not. */
e6c2ab650ebc (Fsplit_window): For default size, round up for left window.
Karl Heuer <kwzh@gnu.org>
parents: 24997
diff changeset
3150 size_int = (XFASTINT (o->width) + 1) >> 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3151 else
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3152 size_int = XFASTINT (o->height) >> 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3153 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3154 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3155 {
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3156 CHECK_NUMBER (size, 1);
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3157 size_int = XINT (size);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3158 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3159
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3160 if (MINI_WINDOW_P (o))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3161 error ("Attempt to split minibuffer window");
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3162 else if (window_fixed_size_p (o, !NILP (horflag), 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3163 error ("Attempt to split fixed-size window");
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3164
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
3165 check_min_window_sizes ();
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3166
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3167 if (NILP (horflag))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3168 {
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3169 if (size_int < window_min_height)
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3170 error ("Window height %d too small (after splitting)", size_int);
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3171 if (size_int + window_min_height > XFASTINT (o->height))
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
3172 error ("Window height %d too small (after splitting)",
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3173 XFASTINT (o->height) - size_int);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3174 if (NILP (o->parent)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3175 || NILP (XWINDOW (o->parent)->vchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3176 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3177 make_dummy_parent (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3178 new = o->parent;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3179 XWINDOW (new)->vchild = window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3180 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3181 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3182 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3183 {
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3184 if (size_int < window_min_width)
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3185 error ("Window width %d too small (after splitting)", size_int);
15902
985270efc514 (Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents: 15712
diff changeset
3186
985270efc514 (Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents: 15712
diff changeset
3187 if (size_int + window_min_width > XFASTINT (o->width))
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
3188 error ("Window width %d too small (after splitting)",
15902
985270efc514 (Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents: 15712
diff changeset
3189 XFASTINT (o->width) - size_int);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3190 if (NILP (o->parent)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3191 || NILP (XWINDOW (o->parent)->hchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3192 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3193 make_dummy_parent (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3194 new = o->parent;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3195 XWINDOW (new)->hchild = window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3196 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3197 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3198
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3199 /* Now we know that window's parent is a vertical combination
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3200 if we are dividing vertically, or a horizontal combination
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3201 if we are making side-by-side windows */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3202
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3203 windows_or_buffers_changed++;
13723
4e170419e83c (Fsplit_window): Account for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents: 13619
diff changeset
3204 FRAME_WINDOW_SIZES_CHANGED (fo) = 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3205 new = make_window ();
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3206 p = XWINDOW (new);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3207
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3208 p->frame = o->frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3209 p->next = o->next;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3210 if (!NILP (p->next))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3211 XWINDOW (p->next)->prev = new;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3212 p->prev = window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3213 o->next = new;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3214 p->parent = o->parent;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3215 p->buffer = Qt;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3216 p->window_end_valid = Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3217 bzero (&p->last_cursor, sizeof p->last_cursor);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3218
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3219 /* Apportion the available frame space among the two new windows */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3220
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3221 if (!NILP (horflag))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3222 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3223 p->height = o->height;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3224 p->top = o->top;
15902
985270efc514 (Fsplit_window): Treat width just like height;
Richard M. Stallman <rms@gnu.org>
parents: 15712
diff changeset
3225 XSETFASTINT (p->width, XFASTINT (o->width) - size_int);
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3226 XSETFASTINT (o->width, size_int);
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3227 XSETFASTINT (p->left, XFASTINT (o->left) + size_int);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3228 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3229 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3230 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3231 p->left = o->left;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3232 p->width = o->width;
13780
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3233 XSETFASTINT (p->height, XFASTINT (o->height) - size_int);
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3234 XSETFASTINT (o->height, size_int);
732a8bd9c552 (Fsplit_window): Rename size to size_int and chsize to size.
Karl Heuer <kwzh@gnu.org>
parents: 13723
diff changeset
3235 XSETFASTINT (p->top, XFASTINT (o->top) + size_int);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3236 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3237
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3238 /* Adjust glyph matrices. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3239 adjust_glyphs (fo);
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3240 Fset_window_buffer (new, o->buffer);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3241 return new;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3242 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3243
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3244 DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p",
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3245 "Make current window ARG lines bigger.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3246 From program, optional second arg non-nil means grow sideways ARG columns.")
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
3247 (arg, side)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
3248 register Lisp_Object arg, side;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3249 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
3250 CHECK_NUMBER (arg, 0);
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3251 enlarge_window (selected_window, XINT (arg), !NILP (side));
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3252
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3253 if (! NILP (Vwindow_configuration_change_hook))
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3254 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3255
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3256 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3257 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3258
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3259 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p",
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3260 "Make current window ARG lines smaller.\n\
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
3261 From program, optional second arg non-nil means shrink sideways arg columns.")
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
3262 (arg, side)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
3263 register Lisp_Object arg, side;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3264 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
3265 CHECK_NUMBER (arg, 0);
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3266 enlarge_window (selected_window, -XINT (arg), !NILP (side));
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3267
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3268 if (! NILP (Vwindow_configuration_change_hook))
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3269 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3270
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3271 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3272 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3273
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3274 int
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3275 window_height (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3276 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3277 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3278 register struct window *p = XWINDOW (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3279 return XFASTINT (p->height);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3280 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3281
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3282 int
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3283 window_width (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3284 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3285 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3286 register struct window *p = XWINDOW (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3287 return XFASTINT (p->width);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3288 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3289
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3290
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3291 #define CURBEG(w) \
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3292 *(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3293
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3294 #define CURSIZE(w) \
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3295 *(widthflag ? &(XWINDOW (w)->width) : &(XWINDOW (w)->height))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3296
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3297
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3298 /* Enlarge selected_window by DELTA. WIDTHFLAG non-zero means
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3299 increase its width. Siblings of the selected window are resized to
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3300 fullfil the size request. If they become too small in the process,
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3301 they will be deleted. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3302
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3303 static void
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3304 enlarge_window (window, delta, widthflag)
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3305 Lisp_Object window;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3306 int delta, widthflag;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3307 {
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3308 Lisp_Object parent, next, prev;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3309 struct window *p;
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3310 Lisp_Object *sizep;
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3311 int maximum;
20351
f69eb2ab4f0f Add prototypes.
Andreas Schwab <schwab@suse.de>
parents: 20090
diff changeset
3312 int (*sizefun) P_ ((Lisp_Object))
f69eb2ab4f0f Add prototypes.
Andreas Schwab <schwab@suse.de>
parents: 20090
diff changeset
3313 = widthflag ? window_width : window_height;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3314 void (*setsizefun) P_ ((Lisp_Object, int, int))
20351
f69eb2ab4f0f Add prototypes.
Andreas Schwab <schwab@suse.de>
parents: 20090
diff changeset
3315 = (widthflag ? set_window_width : set_window_height);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3316
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3317 /* Check values of window_min_width and window_min_height for
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3318 validity. */
972
f47d221cbfe6 * window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
Jim Blandy <jimb@redhat.com>
parents: 780
diff changeset
3319 check_min_window_sizes ();
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3320
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3321 /* Give up if this window cannot be resized. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3322 if (window_fixed_size_p (XWINDOW (window), widthflag, 1))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3323 error ("Window is not resizable");
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3324
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3325 /* Find the parent of the selected window. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3326 while (1)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3327 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3328 p = XWINDOW (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3329 parent = p->parent;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3330
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3331 if (NILP (parent))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3332 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3333 if (widthflag)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3334 error ("No other window to side of this one");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3335 break;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3336 }
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3337
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3338 if (widthflag
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3339 ? !NILP (XWINDOW (parent)->hchild)
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3340 : !NILP (XWINDOW (parent)->vchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3341 break;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3342
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3343 window = parent;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3344 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3345
1049
25046e48ce9a * window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents: 1016
diff changeset
3346 sizep = &CURSIZE (window);
25046e48ce9a * window.c (coordinates_in_window): Do not assume that all
Jim Blandy <jimb@redhat.com>
parents: 1016
diff changeset
3347
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3348 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3349 register int maxdelta;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3350
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3351 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep)
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3352 : !NILP (p->next) ? ((*sizefun) (p->next)
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3353 - window_min_size (XWINDOW (p->next),
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3354 widthflag, 0, 0))
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3355 : !NILP (p->prev) ? ((*sizefun) (p->prev)
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3356 - window_min_size (XWINDOW (p->prev),
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3357 widthflag, 0, 0))
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3358 /* This is a frame with only one window, a minibuffer-only
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3359 or a minibufferless frame. */
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
3360 : (delta = 0));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3361
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3362 if (delta > maxdelta)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3363 /* This case traps trying to make the minibuffer
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3364 the full frame, or make the only window aside from the
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3365 minibuffer the full frame. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3366 delta = maxdelta;
7618
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3367 }
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3368
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3369 if (XINT (*sizep) + delta < window_min_size (XWINDOW (window), widthflag, 0, 0))
7618
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3370 {
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
3371 delete_window (window);
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
3372 return;
7618
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3373 }
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3374
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3375 if (delta == 0)
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3376 return;
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
3377
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3378 /* Find the total we can get from other siblings. */
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3379 maximum = 0;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3380 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next)
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3381 maximum += (*sizefun) (next) - window_min_size (XWINDOW (next),
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3382 widthflag, 0, 0);
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3383 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev)
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3384 maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev),
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3385 widthflag, 0, 0);
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3386
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3387 /* If we can get it all from them, do so. */
18900
23ee59ec294b (set_window_height): Allow all heights > 0 for minibuffer windows.
Richard M. Stallman <rms@gnu.org>
parents: 18737
diff changeset
3388 if (delta <= maximum)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3389 {
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3390 Lisp_Object first_unaffected;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3391 Lisp_Object first_affected;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3392 int fixed_p;
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3393
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3394 next = p->next;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3395 prev = p->prev;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3396 first_affected = window;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3397 /* Look at one sibling at a time,
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3398 moving away from this window in both directions alternately,
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3399 and take as much as we can get without deleting that sibling. */
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3400 while (delta != 0 && (!NILP (next) || !NILP (prev)))
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3401 {
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3402 if (! NILP (next))
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3403 {
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3404 int this_one = ((*sizefun) (next)
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3405 - window_min_size (XWINDOW (next),
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3406 widthflag, 0, &fixed_p));
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3407 if (!fixed_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3408 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3409 if (this_one > delta)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3410 this_one = delta;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3411
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3412 (*setsizefun) (next, (*sizefun) (next) - this_one, 0);
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3413 (*setsizefun) (window, XINT (*sizep) + this_one, 0);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3414
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3415 delta -= this_one;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3416 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3417
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3418 next = XWINDOW (next)->next;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3419 }
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3420
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3421 if (delta == 0)
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3422 break;
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3423
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3424 if (! NILP (prev))
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3425 {
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3426 int this_one = ((*sizefun) (prev)
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3427 - window_min_size (XWINDOW (prev),
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3428 widthflag, 0, &fixed_p));
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3429 if (!fixed_p)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3430 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3431 if (this_one > delta)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3432 this_one = delta;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3433
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3434 first_affected = prev;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3435
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3436 (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0);
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3437 (*setsizefun) (window, XINT (*sizep) + this_one, 0);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3438
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3439 delta -= this_one;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3440 }
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3441
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3442 prev = XWINDOW (prev)->prev;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3443 }
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3444 }
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3445
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3446 xassert (delta == 0);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3447
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3448 /* Now recalculate the edge positions of all the windows affected,
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3449 based on the new sizes. */
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3450 first_unaffected = next;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3451 prev = first_affected;
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3452 for (next = XWINDOW (prev)->next; ! EQ (next, first_unaffected);
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3453 prev = next, next = XWINDOW (next)->next)
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3454 {
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3455 XSETINT (CURBEG (next), XINT (CURBEG (prev)) + (*sizefun) (prev));
16982
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3456 /* This does not change size of NEXT,
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3457 but it propagates the new top edge to its children */
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3458 (*setsizefun) (next, (*sizefun) (next), 0);
8516fb50f3e5 (change_window_height): Take size from multiple siblings,
Richard M. Stallman <rms@gnu.org>
parents: 16980
diff changeset
3459 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3460 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3461 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3462 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3463 register int delta1;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3464 register int opht = (*sizefun) (parent);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3465
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3466 /* If trying to grow this window to or beyond size of the parent,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3467 make delta1 so big that, on shrinking back down,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3468 all the siblings end up with less than one line and are deleted. */
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3469 if (opht <= XINT (*sizep) + delta)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3470 delta1 = opht * opht * 2;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3471 else
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3472 {
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3473 /* Otherwise, make delta1 just right so that if we add
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3474 delta1 lines to this window and to the parent, and then
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3475 shrink the parent back to its original size, the new
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3476 proportional size of this window will increase by delta.
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3477
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3478 The function size_window will compute the new height h'
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3479 of the window from delta1 as:
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3480
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3481 e = delta1/n
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3482 x = delta1 - delta1/n * n for the 1st resizable child
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3483 h' = h + e + x
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3484
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3485 where n is the number of children that can be resized.
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3486 We can ignore x by choosing a delta1 that is a multiple of
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3487 n. We want the height of this window to come out as
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3488
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3489 h' = h + delta
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3490
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3491 So, delta1 must be
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3492
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3493 h + e = h + delta
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3494 delta1/n = delta
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3495 delta1 = n * delta.
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3496
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3497 The number of children n rquals the number of resizable
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3498 children of this window + 1 because we know window itself
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3499 is resizable (otherwise we would have signalled an error. */
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3500
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3501 struct window *w = XWINDOW (window);
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3502 Lisp_Object s;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3503 int n = 1;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3504
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3505 for (s = w->next; !NILP (s); s = XWINDOW (s)->next)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3506 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3507 ++n;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3508 for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev)
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3509 if (!window_fixed_size_p (XWINDOW (s), widthflag, 0))
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3510 ++n;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3511
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3512 delta1 = n * delta;
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
3513 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3514
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3515 /* Add delta1 lines or columns to this window, and to the parent,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3516 keeping things consistent while not affecting siblings. */
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3517 XSETINT (CURSIZE (parent), opht + delta1);
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3518 (*setsizefun) (window, XINT (*sizep) + delta1, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3519
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3520 /* Squeeze out delta1 lines or columns from our parent,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3521 shriking this window and siblings proportionately.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3522 This brings parent back to correct size.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3523 Delta1 was calculated so this makes this window the desired size,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3524 taking it all out of the siblings. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3525 (*setsizefun) (parent, opht, 0);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3526 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3527
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
3528 XSETFASTINT (p->last_modified, 0);
16208
e3a834653117 (Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents: 16068
diff changeset
3529 XSETFASTINT (p->last_overlay_modified, 0);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3530
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3531 /* Adjust glyph matrices. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3532 adjust_glyphs (XFRAME (WINDOW_FRAME (XWINDOW (window))));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3533 }
25254
518d62d71d21 (MINSIZE): Removed.
Gerd Moellmann <gerd@gnu.org>
parents: 25182
diff changeset
3534
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3535 #undef CURBEG
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3536 #undef CURSIZE
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3537
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3538
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3539
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3540 /***********************************************************************
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3541 Resizing Mini-Windows
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3542 ***********************************************************************/
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3543
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3544 static void shrink_window_lowest_first P_ ((struct window *, int));
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3545
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3546 enum save_restore_action
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3547 {
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3548 CHECK_ORIG_SIZES,
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3549 SAVE_ORIG_SIZES,
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3550 RESTORE_ORIG_SIZES
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3551 };
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3552
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3553 static int save_restore_orig_size P_ ((struct window *,
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3554 enum save_restore_action));
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3555
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3556 /* Shrink windows rooted in window W to HEIGHT. Take the space needed
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3557 from lowest windows first. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3558
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3559 static void
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3560 shrink_window_lowest_first (w, height)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3561 struct window *w;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3562 int height;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3563 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3564 struct window *c;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3565 Lisp_Object child;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3566 int old_height;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3567
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3568 xassert (!MINI_WINDOW_P (w));
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3569
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3570 /* Set redisplay hints. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3571 XSETFASTINT (w->last_modified, 0);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3572 XSETFASTINT (w->last_overlay_modified, 0);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3573 windows_or_buffers_changed++;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3574 FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3575
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3576 old_height = XFASTINT (w->height);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3577 XSETFASTINT (w->height, height);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3578
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3579 if (!NILP (w->hchild))
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3580 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3581 for (child = w->hchild; !NILP (child); child = c->next)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3582 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3583 c = XWINDOW (child);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3584 c->top = w->top;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3585 shrink_window_lowest_first (c, height);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3586 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3587 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3588 else if (!NILP (w->vchild))
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3589 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3590 Lisp_Object last_child;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3591 int delta = old_height - height;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3592 int last_top;
31829
43566b0aec59 Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents: 31393
diff changeset
3593
43566b0aec59 Avoid some more compiler warnings.
Gerd Moellmann <gerd@gnu.org>
parents: 31393
diff changeset
3594 last_child = Qnil;
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3595
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3596 /* Find the last child. We are taking space from lowest windows
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3597 first, so we iterate over children from the last child
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3598 backwards. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3599 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3600 last_child = child;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3601
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3602 /* Assign new heights. We leave only MIN_SAFE_WINDOW_HEIGHT. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3603 for (child = last_child; delta && !NILP (child); child = c->prev)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3604 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3605 int this_one;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3606
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3607 c = XWINDOW (child);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3608 this_one = XFASTINT (c->height) - MIN_SAFE_WINDOW_HEIGHT;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3609
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3610 if (this_one > delta)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3611 this_one = delta;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3612
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3613 shrink_window_lowest_first (c, XFASTINT (c->height) - this_one);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3614 delta -= this_one;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3615 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3616
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3617 /* Compute new positions. */
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3618 last_top = XINT (w->top);
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3619 for (child = w->vchild; !NILP (child); child = c->next)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3620 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3621 c = XWINDOW (child);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3622 c->top = make_number (last_top);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3623 shrink_window_lowest_first (c, XFASTINT (c->height));
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3624 last_top += XFASTINT (c->height);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3625 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3626 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3627 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3628
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3629
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3630 /* Save, restore, or check positions and sizes in the window tree
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3631 rooted at W. ACTION says what to do.
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3632
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3633 If ACTION is CHECK_ORIG_SIZES, check if orig_top and orig_height
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3634 members are valid for all windows in the window tree. Value is
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3635 non-zero if they are valid.
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3636
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3637 If ACTION is SAVE_ORIG_SIZES, save members top and height in
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3638 orig_top and orig_height for all windows in the tree.
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3639
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3640 If ACTION is RESTORE_ORIG_SIZES, restore top and height from
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3641 values stored in orig_top and orig_height for all windows. */
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3642
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3643 static int
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3644 save_restore_orig_size (w, action)
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3645 struct window *w;
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3646 enum save_restore_action action;
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3647 {
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3648 int success_p = 1;
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3649
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3650 while (w)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3651 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3652 if (!NILP (w->hchild))
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3653 {
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3654 if (!save_restore_orig_size (XWINDOW (w->hchild), action))
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3655 success_p = 0;
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3656 }
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3657 else if (!NILP (w->vchild))
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3658 {
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3659 if (!save_restore_orig_size (XWINDOW (w->vchild), action))
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3660 success_p = 0;
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3661 }
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3662
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3663 switch (action)
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3664 {
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3665 case CHECK_ORIG_SIZES:
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3666 if (!INTEGERP (w->orig_top) || !INTEGERP (w->orig_height))
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3667 return 0;
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3668 break;
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3669
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3670 case SAVE_ORIG_SIZES:
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3671 w->orig_top = w->top;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3672 w->orig_height = w->height;
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3673 XSETFASTINT (w->last_modified, 0);
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3674 XSETFASTINT (w->last_overlay_modified, 0);
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3675 break;
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3676
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3677 case RESTORE_ORIG_SIZES:
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3678 xassert (INTEGERP (w->orig_top) && INTEGERP (w->orig_height));
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3679 w->top = w->orig_top;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3680 w->height = w->orig_height;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3681 w->orig_height = w->orig_top = Qnil;
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3682 XSETFASTINT (w->last_modified, 0);
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3683 XSETFASTINT (w->last_overlay_modified, 0);
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3684 break;
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3685
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3686 default:
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3687 abort ();
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3688 }
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3689
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3690 w = NILP (w->next) ? NULL : XWINDOW (w->next);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3691 }
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3692
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3693 return success_p;
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3694 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3695
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3696
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3697 /* Grow mini-window W by DELTA lines, DELTA >= 0, or as much as we can
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3698 without deleting other windows. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3699
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3700 void
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3701 grow_mini_window (w, delta)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3702 struct window *w;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3703 int delta;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3704 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3705 struct frame *f = XFRAME (w->frame);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3706 struct window *root;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3707
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3708 xassert (MINI_WINDOW_P (w));
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3709 xassert (delta >= 0);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3710
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3711 /* Check values of window_min_width and window_min_height for
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3712 validity. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3713 check_min_window_sizes ();
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3714
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3715 /* Compute how much we can enlarge the mini-window without deleting
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3716 other windows. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3717 root = XWINDOW (FRAME_ROOT_WINDOW (f));
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3718 if (delta)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3719 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3720 int min_height = window_min_size (root, 0, 0, 0);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3721 if (XFASTINT (root->height) - delta < min_height)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3722 delta = XFASTINT (root->height) - min_height;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3723 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3724
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3725 if (delta)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3726 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3727 /* Save original window sizes and positions, if not already done. */
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3728 if (!save_restore_orig_size (root, CHECK_ORIG_SIZES))
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3729 save_restore_orig_size (root, SAVE_ORIG_SIZES);
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3730
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3731 /* Shrink other windows. */
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3732 shrink_window_lowest_first (root, XFASTINT (root->height) - delta);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3733
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3734 /* Grow the mini-window. */
28463
4591d285fb65 * window.c (CURBEG, CURSIZE): Don't overload lisp object lvalues
Ken Raeburn <raeburn@raeburn.org>
parents: 28417
diff changeset
3735 w->top = make_number (XFASTINT (root->top) + XFASTINT (root->height));
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3736 w->height = make_number (XFASTINT (w->height) + delta);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3737 XSETFASTINT (w->last_modified, 0);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3738 XSETFASTINT (w->last_overlay_modified, 0);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3739
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3740 adjust_glyphs (f);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3741 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3742 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3743
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3744
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3745 /* Shrink mini-window W. If there is recorded info about window sizes
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3746 before a call to grow_mini_window, restore recorded window sizes.
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3747 Otherwise, if the mini-window is higher than 1 line, resize it to 1
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3748 line. */
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3749
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3750 void
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3751 shrink_mini_window (w)
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3752 struct window *w;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3753 {
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3754 struct frame *f = XFRAME (w->frame);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3755 struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3756
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3757 if (save_restore_orig_size (root, CHECK_ORIG_SIZES))
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3758 {
26046
9204dfa34c1b (enum save_restore_action): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25797
diff changeset
3759 save_restore_orig_size (root, RESTORE_ORIG_SIZES);
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3760 adjust_glyphs (f);
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3761 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3762 windows_or_buffers_changed = 1;
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3763 }
25797
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3764 else if (XFASTINT (w->height) > 1)
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3765 {
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3766 Lisp_Object window;
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3767 XSETWINDOW (window, w);
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3768 enlarge_window (window, 1 - XFASTINT (w->height), 0);
0d73a1e7b7f2 (enlarge_window): Add window parameter instead of using
Gerd Moellmann <gerd@gnu.org>
parents: 25792
diff changeset
3769 }
25792
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3770 }
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3771
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3772
80e84cb91f1e (window_min_size): Add parameter ignore_fixed_p.
Gerd Moellmann <gerd@gnu.org>
parents: 25739
diff changeset
3773
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3774 /* Mark window cursors off for all windows in the window tree rooted
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3775 at W by setting their phys_cursor_on_p flag to zero. Called from
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3776 xterm.c, e.g. when a frame is cleared and thereby all cursors on
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3777 the frame are cleared. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3778
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3779 void
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3780 mark_window_cursors_off (w)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3781 struct window *w;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3782 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3783 while (w)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3784 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3785 if (!NILP (w->hchild))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3786 mark_window_cursors_off (XWINDOW (w->hchild));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3787 else if (!NILP (w->vchild))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3788 mark_window_cursors_off (XWINDOW (w->vchild));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3789 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3790 w->phys_cursor_on_p = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3791
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3792 w = NILP (w->next) ? 0 : XWINDOW (w->next);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3793 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3794 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3795
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3796
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3797 /* Return number of lines of text (not counting mode line) in W. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3798
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3799 int
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3800 window_internal_height (w)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3801 struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3802 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3803 int ht = XFASTINT (w->height);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3804
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3805 if (MINI_WINDOW_P (w))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3806 return ht;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3807
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3808 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
3809 || !NILP (w->next) || !NILP (w->prev)
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
3810 || FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (w))))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3811 return ht - 1;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3812
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3813 return ht;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3814 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3815
1783
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3816
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3817 /* Return the number of columns in W.
1994
73ce9dd21093 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1931
diff changeset
3818 Don't count columns occupied by scroll bars or the vertical bar
1783
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3819 separating W from the sibling to its right. */
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3820
1783
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3821 int
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3822 window_internal_width (w)
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3823 struct window *w;
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3824 {
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3825 struct frame *f = XFRAME (WINDOW_FRAME (w));
1783
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3826 int width = XINT (w->width);
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3827
1994
73ce9dd21093 Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents: 1931
diff changeset
3828 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3829 /* Scroll bars occupy a few columns. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3830 width -= FRAME_SCROLL_BAR_COLS (f);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3831 else if (!WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3832 /* The column of `|' characters separating side-by-side windows
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3833 occupies one column only. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3834 width -= 1;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3835
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3836 /* On window-systems, areas to the left and right of the window
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3837 are used to display bitmaps there. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3838 if (FRAME_WINDOW_P (f))
25462
19b101d6ee2a (coordinates_in_window): Use
Gerd Moellmann <gerd@gnu.org>
parents: 25402
diff changeset
3839 width -= FRAME_FLAGS_AREA_COLS (f);
16297
701db778b7a4 (Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents: 16208
diff changeset
3840
701db778b7a4 (Fwindow_edges): Use new WINDOW_RIGHT_EDGE macro.
Richard M. Stallman <rms@gnu.org>
parents: 16208
diff changeset
3841 return width;
1783
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3842 }
8e7932110418 * window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents: 1716
diff changeset
3843
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3844
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3845 /************************************************************************
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3846 Window Scrolling
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3847 ***********************************************************************/
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3848
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3849 /* Scroll contents of window WINDOW up. If WHOLE is non-zero, scroll
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3850 one screen-full, which is defined as the height of the window minus
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3851 next_screen_context_lines. If WHOLE is zero, scroll up N lines
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3852 instead. Negative values of N mean scroll down. NOERROR non-zero
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3853 means don't signal an error if we try to move over BEGV or ZV,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3854 respectively. */
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
3855
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
3856 static void
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
3857 window_scroll (window, n, whole, noerror)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3858 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3859 int n;
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
3860 int whole;
522
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
3861 int noerror;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3862 {
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3863 /* If we must, use the pixel-based version which is much slower than
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3864 the line-based one but can handle varying line heights. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3865 if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame)))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3866 window_scroll_pixel_based (window, n, whole, noerror);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3867 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3868 window_scroll_line_based (window, n, whole, noerror);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3869 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3870
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3871
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3872 /* Implementation of window_scroll that works based on pixel line
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3873 heights. See the comment of window_scroll for parameter
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3874 descriptions. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3875
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3876 static void
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3877 window_scroll_pixel_based (window, n, whole, noerror)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3878 Lisp_Object window;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3879 int n;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3880 int whole;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3881 int noerror;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3882 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3883 struct it it;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3884 struct window *w = XWINDOW (window);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3885 struct text_pos start;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3886 Lisp_Object tem;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3887 int this_scroll_margin;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3888 int preserve_y;
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3889 /* True if we fiddled the window vscroll field without really scrolling. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3890 int vscrolled = 0;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3891
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3892 SET_TEXT_POS_FROM_MARKER (start, w->start);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3893
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3894 /* If PT is not visible in WINDOW, move back one half of
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3895 the screen. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3896 XSETFASTINT (tem, PT);
32773
a7fdbf39d4de (window_scroll_pixel_based, window_scroll_line_based):
Miles Bader <miles@gnu.org>
parents: 32752
diff changeset
3897 tem = Fpos_visible_in_window_p (tem, window, Qnil);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3898 if (NILP (tem))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3899 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3900 /* Move backward half the height of the window. Performance note:
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3901 vmotion used here is about 10% faster, but would give wrong
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3902 results for variable height lines. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3903 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3904 it.current_y = it.last_visible_y;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3905 move_it_vertically (&it, -it.last_visible_y / 2);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3906
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3907 /* The function move_iterator_vertically may move over more than
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3908 the specified y-distance. If it->w is small, e.g. a
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3909 mini-buffer window, we may end up in front of the window's
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3910 display area. This is the case when Start displaying at the
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3911 start of the line containing PT in this case. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3912 if (it.current_y <= 0)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3913 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3914 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3915 move_it_vertically (&it, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3916 it.current_y = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3917 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3918
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3919 start = it.current.pos;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3920 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3921
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3922 /* If scroll_preserve_screen_position is non-zero, we try to set
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3923 point in the same window line as it is now, so get that line. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3924 if (!NILP (Vscroll_preserve_screen_position))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3925 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3926 start_display (&it, w, start);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3927 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3928 preserve_y = it.current_y;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3929 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3930 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3931 preserve_y = -1;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3932
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3933 /* Move iterator it from start the specified distance forward or
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3934 backward. The result is the new window start. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3935 start_display (&it, w, start);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3936 if (whole)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3937 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3938 int screen_full = (it.last_visible_y
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3939 - next_screen_context_lines * CANON_Y_UNIT (it.f));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3940 int direction = n < 0 ? -1 : 1;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3941 move_it_vertically (&it, direction * screen_full);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3942 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3943 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3944 move_it_by_lines (&it, n, 1);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3945
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3946 /* End if we end up at ZV or BEGV. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3947 if ((n > 0 && IT_CHARPOS (it) == ZV)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3948 || (n < 0 && IT_CHARPOS (it) == CHARPOS (start)))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3949 {
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3950 if (IT_CHARPOS (it) == ZV)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3951 {
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3952 if (it.current_y + it.max_ascent + it.max_descent
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3953 > it.last_visible_y)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3954 /* The last line was only partially visible, make it fully
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3955 visible. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3956 w->vscroll =
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3957 it.last_visible_y
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3958 - it.current_y + it.max_ascent + it.max_descent;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3959 else if (noerror)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3960 return;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3961 else
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3962 Fsignal (Qend_of_buffer, Qnil);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3963 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3964 else
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3965 {
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3966 if (w->vscroll != 0)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3967 /* The first line was only partially visible, make it fully
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3968 visible. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3969 w->vscroll = 0;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3970 else if (noerror)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3971 return;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3972 else
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3973 Fsignal (Qbeginning_of_buffer, Qnil);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3974 }
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3975
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3976 /* If control gets here, then we vscrolled. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3977
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3978 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3979
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3980 /* Don't try to change the window start below. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3981 vscrolled = 1;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3982 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3983
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3984 if (! vscrolled)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3985 {
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3986 /* Set the window start, and set up the window for redisplay. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3987 set_marker_restricted (w->start, make_number (IT_CHARPOS (it)),
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3988 w->buffer);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3989 w->start_at_line_beg = Fbolp ();
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3990 w->update_mode_line = Qt;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3991 XSETFASTINT (w->last_modified, 0);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3992 XSETFASTINT (w->last_overlay_modified, 0);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3993 /* Set force_start so that redisplay_window will run the
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3994 window-scroll-functions. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3995 w->force_start = Qt;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
3996 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3998 it.current_y = it.vpos = 0;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
3999
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4000 /* Preserve the screen position if we must. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4001 if (preserve_y >= 0)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4002 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4003 move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4004 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4005 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4006 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4007 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4008 /* Move PT out of scroll margins. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4009 this_scroll_margin = max (0, scroll_margin);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4010 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->height) / 4);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4011 this_scroll_margin *= CANON_Y_UNIT (it.f);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4012
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4013 if (n > 0)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4014 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4015 /* We moved the window start towards ZV, so PT may be now
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4016 in the scroll margin at the top. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4017 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4018 while (it.current_y < this_scroll_margin)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4019 move_it_by_lines (&it, 1, 1);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4020 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4021 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4022 else if (n < 0)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4023 {
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4024 int charpos, bytepos;
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4025
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4026 /* We moved the window start towards BEGV, so PT may be now
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4027 in the scroll margin at the bottom. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4028 move_it_to (&it, PT, -1,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4029 it.last_visible_y - this_scroll_margin - 1, -1,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4030 MOVE_TO_POS | MOVE_TO_Y);
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4031
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4032 /* Save our position, in case it's correct. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4033 charpos = IT_CHARPOS (it);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4034 bytepos = IT_BYTEPOS (it);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4035
34381
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4036 /* See if point is on a partially visible line at the end. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4037 move_it_by_lines (&it, 1, 1);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4038 if (it.current_y > it.last_visible_y)
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4039 /* The last line was only partially visible, so back up two
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4040 lines to make sure we're on a fully visible line. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4041 {
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4042 move_it_by_lines (&it, -2, 0);
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4043 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4044 }
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4045 else
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4046 /* No, the position we saved is OK, so use it. */
f9d7bc96177b (Fpos_visible_in_window_p): Replace FULLY parameter with PARTIALLY,
Miles Bader <miles@gnu.org>
parents: 34277
diff changeset
4047 SET_PT_BOTH (charpos, bytepos);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4048 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4049 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4050 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4051
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4052
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4053 /* Implementation of window_scroll that works based on screen lines.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4054 See the comment of window_scroll for parameter descriptions. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4055
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4056 static void
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4057 window_scroll_line_based (window, n, whole, noerror)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4058 Lisp_Object window;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4059 int n;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4060 int whole;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4061 int noerror;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4062 {
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4063 register struct window *w = XWINDOW (window);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4064 register int opoint = PT, opoint_byte = PT_BYTE;
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4065 register int pos, pos_byte;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4066 register int ht = window_internal_height (w);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4067 register Lisp_Object tem;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4068 int lose;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4069 Lisp_Object bolp;
16658
584563254f25 (window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents: 16587
diff changeset
4070 int startpos;
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4071 struct position posit;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4072 int original_vpos;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4073
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4074 startpos = marker_position (w->start);
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4075
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4076 posit = *compute_motion (startpos, 0, 0, 0,
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4077 PT, ht, 0,
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4078 window_internal_width (w), XINT (w->hscroll),
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4079 0, w);
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4080 original_vpos = posit.vpos;
13102
960db92441d8 (window_scroll): Always set force_start.
Richard M. Stallman <rms@gnu.org>
parents: 12981
diff changeset
4081
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
4082 XSETFASTINT (tem, PT);
32773
a7fdbf39d4de (window_scroll_pixel_based, window_scroll_line_based):
Miles Bader <miles@gnu.org>
parents: 32752
diff changeset
4083 tem = Fpos_visible_in_window_p (tem, window, Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4084
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4085 if (NILP (tem))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4086 {
6341
dfc758dd2b08 (window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents: 6326
diff changeset
4087 Fvertical_motion (make_number (- (ht / 2)), window);
16658
584563254f25 (window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents: 16587
diff changeset
4088 startpos = PT;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4089 }
16658
584563254f25 (window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents: 16587
diff changeset
4090
584563254f25 (window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents: 16587
diff changeset
4091 SET_PT (startpos);
7347
3a677a303d5b Use PT, not point.
Karl Heuer <kwzh@gnu.org>
parents: 7080
diff changeset
4092 lose = n < 0 && PT == BEGV;
6326
5e662ad3f594 (Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents: 6269
diff changeset
4093 Fvertical_motion (make_number (n), window);
7347
3a677a303d5b Use PT, not point.
Karl Heuer <kwzh@gnu.org>
parents: 7080
diff changeset
4094 pos = PT;
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4095 pos_byte = PT_BYTE;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4096 bolp = Fbolp ();
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4097 SET_PT_BOTH (opoint, opoint_byte);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4098
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4099 if (lose)
522
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4100 {
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4101 if (noerror)
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4102 return;
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4103 else
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4104 Fsignal (Qbeginning_of_buffer, Qnil);
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4105 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4106
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4107 if (pos < ZV)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4108 {
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4109 int this_scroll_margin = scroll_margin;
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4110
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4111 /* Don't use a scroll margin that is negative or too large. */
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4112 if (this_scroll_margin < 0)
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4113 this_scroll_margin = 0;
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4114
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4115 if (XINT (w->height) < 4 * scroll_margin)
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4116 this_scroll_margin = XINT (w->height) / 4;
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4117
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4118 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4119 w->start_at_line_beg = bolp;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4120 w->update_mode_line = Qt;
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
4121 XSETFASTINT (w->last_modified, 0);
16208
e3a834653117 (Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents: 16068
diff changeset
4122 XSETFASTINT (w->last_overlay_modified, 0);
16658
584563254f25 (window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents: 16587
diff changeset
4123 /* Set force_start so that redisplay_window will run
584563254f25 (window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents: 16587
diff changeset
4124 the window-scroll-functions. */
584563254f25 (window_scroll): Don't set w->start or w->force_start if signaling an error.
Richard M. Stallman <rms@gnu.org>
parents: 16587
diff changeset
4125 w->force_start = Qt;
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4126
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4127 if (whole && !NILP (Vscroll_preserve_screen_position))
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4128 {
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4129 SET_PT_BOTH (pos, pos_byte);
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4130 Fvertical_motion (make_number (original_vpos), window);
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4131 }
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4132 /* If we scrolled forward, put point enough lines down
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4133 that it is outside the scroll margin. */
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4134 else if (n > 0)
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4135 {
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4136 int top_margin;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4137
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4138 if (this_scroll_margin > 0)
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4139 {
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4140 SET_PT_BOTH (pos, pos_byte);
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4141 Fvertical_motion (make_number (this_scroll_margin), window);
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4142 top_margin = PT;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4143 }
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4144 else
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4145 top_margin = pos;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4146
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4147 if (top_margin <= opoint)
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4148 SET_PT_BOTH (opoint, opoint_byte);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4149 else if (!NILP (Vscroll_preserve_screen_position))
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4150 {
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4151 SET_PT_BOTH (pos, pos_byte);
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4152 Fvertical_motion (make_number (original_vpos), window);
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4153 }
16980
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
4154 else
20046
8baac8399a29 (window_scroll): When scrolling forward and point is
Karl Heuer <kwzh@gnu.org>
parents: 19667
diff changeset
4155 SET_PT (top_margin);
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4156 }
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4157 else if (n < 0)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4158 {
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4159 int bottom_margin;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4160
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4161 /* If we scrolled backward, put point near the end of the window
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4162 but not within the scroll margin. */
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4163 SET_PT_BOTH (pos, pos_byte);
16559
d62b7f309f2b (window_scroll): Handle scroll_margin
Richard M. Stallman <rms@gnu.org>
parents: 16555
diff changeset
4164 tem = Fvertical_motion (make_number (ht - this_scroll_margin), window);
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4165 if (XFASTINT (tem) == ht - this_scroll_margin)
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4166 bottom_margin = PT;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4167 else
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4168 bottom_margin = PT + 1;
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4169
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4170 if (bottom_margin > opoint)
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4171 SET_PT_BOTH (opoint, opoint_byte);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4172 else
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4173 {
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4174 if (!NILP (Vscroll_preserve_screen_position))
16980
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
4175 {
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4176 SET_PT_BOTH (pos, pos_byte);
16980
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
4177 Fvertical_motion (make_number (original_vpos), window);
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
4178 }
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
4179 else
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
4180 Fvertical_motion (make_number (-1), window);
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4181 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4182 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4183 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4184 else
522
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4185 {
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4186 if (noerror)
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4187 return;
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4188 else
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4189 Fsignal (Qend_of_buffer, Qnil);
bacdab90fa8b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
4190 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4191 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4192
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4193
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4194 /* Scroll selected_window up or down. If N is nil, scroll a
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4195 screen-full which is defined as the height of the window minus
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4196 next_screen_context_lines. If N is the symbol `-', scroll.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4197 DIRECTION may be 1 meaning to scroll down, or -1 meaning to scroll
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4198 up. This is the guts of Fscroll_up and Fscroll_down. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4199
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4200 static void
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4201 scroll_command (n, direction)
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4202 Lisp_Object n;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4203 int direction;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4204 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4205 register int defalt;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4206 int count = specpdl_ptr - specpdl;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4207
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4208 xassert (abs (direction) == 1);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4209
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4210 /* If selected window's buffer isn't current, make it current for
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4211 the moment. But don't screw up if window_scroll gets an error. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4212 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
548
a7b7b759f694 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 522
diff changeset
4213 {
a7b7b759f694 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 522
diff changeset
4214 record_unwind_protect (save_excursion_restore, save_excursion_save ());
a7b7b759f694 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 522
diff changeset
4215 Fset_buffer (XWINDOW (selected_window)->buffer);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4216
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4217 /* Make redisplay consider other windows than just selected_window. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4218 ++windows_or_buffers_changed;
548
a7b7b759f694 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 522
diff changeset
4219 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4220
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4221 defalt = (window_internal_height (XWINDOW (selected_window))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4222 - next_screen_context_lines);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4223 defalt = direction * (defalt < 1 ? 1 : defalt);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4224
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4225 if (NILP (n))
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4226 window_scroll (selected_window, defalt, 1, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4227 else if (EQ (n, Qminus))
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4228 window_scroll (selected_window, - defalt, 1, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4229 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4230 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4231 n = Fprefix_numeric_value (n);
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4232 window_scroll (selected_window, XINT (n) * direction, 0, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4233 }
548
a7b7b759f694 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 522
diff changeset
4234
a7b7b759f694 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 522
diff changeset
4235 unbind_to (count, Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4236 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4237
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4238 DEFUN ("scroll-up", Fscroll_up, Sscroll_up, 0, 1, "P",
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4239 "Scroll text of current window upward ARG lines; or near full screen if no ARG.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4240 A near full screen is `next-screen-context-lines' less than a full screen.\n\
6487
e1b0356ae3c9 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 6341
diff changeset
4241 Negative ARG means scroll downward.\n\
22288
d8f011778094 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22223
diff changeset
4242 If ARG is the atom `-', scroll downward by nearly full screen.\n\
d8f011778094 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22223
diff changeset
4243 When calling from a program, supply as argument a number, nil, or `-'.")
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4244 (arg)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4245 Lisp_Object arg;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4246 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4247 scroll_command (arg, 1);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4248 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4249 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4250
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4251 DEFUN ("scroll-down", Fscroll_down, Sscroll_down, 0, 1, "P",
22155
884e912db9de (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 22149
diff changeset
4252 "Scroll text of current window down ARG lines; or near full screen if no ARG.\n\
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4253 A near full screen is `next-screen-context-lines' less than a full screen.\n\
6487
e1b0356ae3c9 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 6341
diff changeset
4254 Negative ARG means scroll upward.\n\
22288
d8f011778094 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22223
diff changeset
4255 If ARG is the atom `-', scroll upward by nearly full screen.\n\
d8f011778094 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22223
diff changeset
4256 When calling from a program, supply as argument a number, nil, or `-'.")
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4257 (arg)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4258 Lisp_Object arg;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4259 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4260 scroll_command (arg, -1);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4261 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4262 }
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4263
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4264 DEFUN ("other-window-for-scrolling", Fother_window_for_scrolling, Sother_window_for_scrolling, 0, 0, 0,
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4265 "Return the other window for \"other window scroll\" commands.\n\
6232
d695df82e96a (Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 6099
diff changeset
4266 If in the minibuffer, `minibuffer-scroll-window' if non-nil\n\
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4267 specifies the window.\n\
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4268 If `other-window-scroll-buffer' is non-nil, a window\n\
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4269 showing that buffer is used.")
8059
59baddaf62a0 (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8053
diff changeset
4270 ()
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4271 {
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4272 Lisp_Object window;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4273
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4274 if (MINI_WINDOW_P (XWINDOW (selected_window))
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4275 && !NILP (Vminibuf_scroll_window))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4276 window = Vminibuf_scroll_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4277 /* If buffer is specified, scroll that buffer. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4278 else if (!NILP (Vother_window_scroll_buffer))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4279 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4280 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4281 if (NILP (window))
20867
fccf74829150 (Fdisplay_buffer): New arg FRAME.
Richard M. Stallman <rms@gnu.org>
parents: 20777
diff changeset
4282 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt, Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4283 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4284 else
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4285 {
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4286 /* Nothing specified; look for a neighboring window on the same
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4287 frame. */
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4288 window = Fnext_window (selected_window, Qnil, Qnil);
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4289
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4290 if (EQ (window, selected_window))
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4291 /* That didn't get us anywhere; look for a window on another
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4292 visible frame. */
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4293 do
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4294 window = Fnext_window (window, Qnil, Qt);
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4295 while (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (window))))
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4296 && ! EQ (window, selected_window));
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4297 }
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1805
diff changeset
4298
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4299 CHECK_LIVE_WINDOW (window, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4300
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4301 if (EQ (window, selected_window))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4302 error ("There is no other window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4303
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4304 return window;
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4305 }
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4306
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4307 DEFUN ("scroll-other-window", Fscroll_other_window, Sscroll_other_window, 0, 1, "P",
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4308 "Scroll next window upward ARG lines; or near full screen if no ARG.\n\
22288
d8f011778094 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22223
diff changeset
4309 A near full screen is `next-screen-context-lines' less than a full screen.\n\
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4310 The next window is the one below the current one; or the one at the top\n\
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4311 if the current one is at the bottom. Negative ARG means scroll downward.\n\
22288
d8f011778094 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22223
diff changeset
4312 If ARG is the atom `-', scroll downward by nearly full screen.\n\
d8f011778094 (Fscroll_up, Fscroll_down, Fscroll_other_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 22223
diff changeset
4313 When calling from a program, supply as argument a number, nil, or `-'.\n\
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4314 \n\
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4315 If in the minibuffer, `minibuffer-scroll-window' if non-nil\n\
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4316 specifies the window to scroll.\n\
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4317 If `other-window-scroll-buffer' is non-nil, scroll the window\n\
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4318 showing that buffer, popping the buffer up if necessary.")
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4319 (arg)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4320 register Lisp_Object arg;
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4321 {
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4322 register Lisp_Object window;
10373
c5c1ffa3755e (Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents: 10302
diff changeset
4323 register int defalt;
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4324 register struct window *w;
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4325 register int count = specpdl_ptr - specpdl;
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4326
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4327 window = Fother_window_for_scrolling ();
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
4328
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4329 w = XWINDOW (window);
10373
c5c1ffa3755e (Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents: 10302
diff changeset
4330 defalt = window_internal_height (w) - next_screen_context_lines;
c5c1ffa3755e (Fscroll_other_window): On small windows, scroll by 1 line.
Karl Heuer <kwzh@gnu.org>
parents: 10302
diff changeset
4331 if (defalt < 1) defalt = 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4332
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4333 /* Don't screw up if window_scroll gets an error. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4334 record_unwind_protect (save_excursion_restore, save_excursion_save ());
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4335 ++windows_or_buffers_changed;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4336
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4337 Fset_buffer (w->buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4338 SET_PT (marker_position (w->pointm));
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4339
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4340 if (NILP (arg))
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4341 window_scroll (window, defalt, 1, 1);
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4342 else if (EQ (arg, Qminus))
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4343 window_scroll (window, -defalt, 1, 1);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4344 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4345 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4346 if (CONSP (arg))
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4347 arg = Fcar (arg);
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4348 CHECK_NUMBER (arg, 0);
16751
d393cbcfb69c (window_scroll): Preserve vpos of point
Richard M. Stallman <rms@gnu.org>
parents: 16658
diff changeset
4349 window_scroll (window, XINT (arg), 0, 1);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4350 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4351
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4352 set_marker_both (w->pointm, Qnil, PT, PT_BYTE);
1931
129d8225f748 * keyboard.c (recursive_edit_1, command_loop_1): Pass the proper
Jim Blandy <jimb@redhat.com>
parents: 1829
diff changeset
4353 unbind_to (count, Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4354
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4355 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4356 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4357
3621
0576930165ed (Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents: 3535
diff changeset
4358 DEFUN ("scroll-left", Fscroll_left, Sscroll_left, 0, 1, "P",
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4359 "Scroll selected window display ARG columns left.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4360 Default for ARG is window width minus 2.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4361 (arg)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4362 register Lisp_Object arg;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4363 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4364
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4365 if (NILP (arg))
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
4366 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4367 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4368 arg = Fprefix_numeric_value (arg);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4369
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4370 return
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4371 Fset_window_hscroll (selected_window,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4372 make_number (XINT (XWINDOW (selected_window)->hscroll)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4373 + XINT (arg)));
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4374 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4375
3621
0576930165ed (Fscroll_left): Make argument optional.
Richard M. Stallman <rms@gnu.org>
parents: 3535
diff changeset
4376 DEFUN ("scroll-right", Fscroll_right, Sscroll_right, 0, 1, "P",
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4377 "Scroll selected window display ARG columns right.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4378 Default for ARG is window width minus 2.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4379 (arg)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4380 register Lisp_Object arg;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4381 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4382 if (NILP (arg))
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
4383 XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4384 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4385 arg = Fprefix_numeric_value (arg);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4386
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4387 return
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4388 Fset_window_hscroll (selected_window,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4389 make_number (XINT (XWINDOW (selected_window)->hscroll)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4390 - XINT (arg)));
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4391 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4392
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4393 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P",
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
4394 "Center point in window and redisplay frame. With ARG, put point on line ARG.\n\
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4395 The desired position of point is always relative to the current window.\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
4396 Just C-u as prefix means put point in the center of the window.\n\
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4397 If ARG is omitted or nil, erases the entire frame and then\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
4398 redraws with point in the center of the current window.")
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4399 (arg)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4400 register Lisp_Object arg;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4401 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4402 register struct window *w = XWINDOW (selected_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4403 register int ht = window_internal_height (w);
9243
c35d0ed03819 (Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents: 9114
diff changeset
4404 struct position pos;
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4405 struct buffer *buf = XBUFFER (w->buffer);
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4406 struct buffer *obuf = current_buffer;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4407
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4408 if (NILP (arg))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4409 {
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
4410 extern int frame_garbaged;
26873
5281eb29603f (Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents: 26761
diff changeset
4411 int i;
5281eb29603f (Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents: 26761
diff changeset
4412
5281eb29603f (Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents: 26761
diff changeset
4413 /* Invalidate pixel data calculated for all compositions. */
5281eb29603f (Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents: 26761
diff changeset
4414 for (i = 0; i < n_compositions; i++)
5281eb29603f (Frecenter): Clear all caches of compositions.
Kenichi Handa <handa@m17n.org>
parents: 26761
diff changeset
4415 composition_table[i]->font = NULL;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4416
25402
857e8b5b1194 (Frecenter): Clear frame if called with nil or no arg.
Gerd Moellmann <gerd@gnu.org>
parents: 25387
diff changeset
4417 Fredraw_frame (w->frame);
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
4418 SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w)));
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4419 XSETFASTINT (arg, ht / 2);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4420 }
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4421 else if (CONSP (arg)) /* Just C-u. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4422 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4423 XSETFASTINT (arg, ht / 2);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4424 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4425 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4426 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4427 arg = Fprefix_numeric_value (arg);
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4428 CHECK_NUMBER (arg, 0);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4429 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4430
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4431 if (XINT (arg) < 0)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4432 XSETINT (arg, XINT (arg) + ht);
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4433
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4434 set_buffer_internal (buf);
16039
855c8d8ba0f0 Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents: 15905
diff changeset
4435 pos = *vmotion (PT, - XINT (arg), w);
9243
c35d0ed03819 (Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents: 9114
diff changeset
4436
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4437 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos);
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4438 w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4439 || FETCH_BYTE (pos.bytepos - 1) == '\n')
9243
c35d0ed03819 (Frecenter): Don't trigger point-motion hooks.
Karl Heuer <kwzh@gnu.org>
parents: 9114
diff changeset
4440 ? Qt : Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4441 w->force_start = Qt;
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4442 set_buffer_internal (obuf);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4443
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4444 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4445 }
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4446
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4447
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4448 /* Value is the number of lines actually displayed in window W,
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4449 as opposed to its height. */
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4450
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4451 static int
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4452 displayed_window_lines (w)
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4453 struct window *w;
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4454 {
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4455 struct it it;
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4456 struct text_pos start;
29488
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4457 int height = window_box_height (w);
33059
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4458 struct buffer *old_buffer;
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4459 int bottom_y;
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4460
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4461 if (XBUFFER (w->buffer) != current_buffer)
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4462 {
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4463 old_buffer = current_buffer;
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4464 set_buffer_internal (XBUFFER (w->buffer));
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4465 }
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4466 else
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4467 old_buffer = NULL;
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4468
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4469 SET_TEXT_POS_FROM_MARKER (start, w->start);
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4470 start_display (&it, w, start);
29488
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4471 move_it_vertically (&it, height);
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4472
33059
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4473 if (old_buffer)
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4474 set_buffer_internal (old_buffer);
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4475
34416
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4476 bottom_y = it.current_y + it.max_ascent + it.max_descent;
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4477
34417
fef41c786c7a (displayed_window_lines): Fix off-by-one error.
Miles Bader <miles@gnu.org>
parents: 34416
diff changeset
4478 if (bottom_y > it.current_y && bottom_y <= it.last_visible_y)
34416
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4479 /* Hit a line without a terminating newline. */
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4480 it.vpos++;
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4481
29488
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4482 /* Add in empty lines at the bottom of the window. */
33059
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4483 if (bottom_y < height)
29488
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4484 {
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4485 struct frame *f = XFRAME (w->frame);
33059
8fab1b57781b (displayed_window_lines): Change buffers if necessary.
Gerd Moellmann <gerd@gnu.org>
parents: 32937
diff changeset
4486 int rest = height - bottom_y;
34409
eaeb04956022 (displayed_window_lines): Don't round up when converting empty space at
Miles Bader <miles@gnu.org>
parents: 34384
diff changeset
4487 int lines = rest / CANON_Y_UNIT (f);
29488
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4488 it.vpos += lines;
4eef390d6155 (displayed_window_lines): Take empty lines at
Gerd Moellmann <gerd@gnu.org>
parents: 29485
diff changeset
4489 }
34384
9669bb49fca2 (Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents: 34381
diff changeset
4490
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4491 return it.vpos;
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4492 }
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4493
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4494
34416
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4495 DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4496 0, 1, 0,
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4497 "Return the height in lines of the text display area of WINDOW.\n\
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4498 This doesn't include the mode-line (or header-line if any) or any\n\
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4499 partial-height lines in the text display area.")
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4500 (window)
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4501 Lisp_Object window;
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4502 {
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4503 struct window *w = decode_window (window);
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4504 int pixel_height = window_box_height (w);
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4505 int line_height = pixel_height / CANON_Y_UNIT (XFRAME (w->frame));
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4506 return make_number (line_height);
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4507 }
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4508
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
4509
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4510
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4511 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4512 1, 1, "P",
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4513 "Position point relative to window.\n\
8411
9a68cba600fc (Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8366
diff changeset
4514 With no argument, position point at center of window.\n\
22897
e694821e2b96 (Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 22288
diff changeset
4515 An argument specifies vertical position within the window;\n\
e694821e2b96 (Fmove_to_window_line): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 22288
diff changeset
4516 zero means top of window, negative means relative to bottom of window.")
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4517 (arg)
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4518 Lisp_Object arg;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4519 {
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4520 struct window *w = XWINDOW (selected_window);
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4521 int lines, start;
6326
5e662ad3f594 (Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents: 6269
diff changeset
4522 Lisp_Object window;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4523
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4524 window = selected_window;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4525 start = marker_position (w->start);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4526 if (start < BEGV || start > ZV)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4527 {
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4528 int height = window_internal_height (w);
6341
dfc758dd2b08 (window_scroll, Fmove_to_window_line): Avoid dividing negative numbers,
Karl Heuer <kwzh@gnu.org>
parents: 6326
diff changeset
4529 Fvertical_motion (make_number (- (height / 2)), window);
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4530 set_marker_both (w->start, w->buffer, PT, PT_BYTE);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4531 w->start_at_line_beg = Fbolp ();
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4532 w->force_start = Qt;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4533 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4534 else
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4535 Fgoto_char (w->start);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4536
29485
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4537 lines = displayed_window_lines (w);
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4538 if (NILP (arg))
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4539 XSETFASTINT (arg, lines / 2);
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4540 else
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4541 {
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4542 arg = Fprefix_numeric_value (arg);
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4543 if (XINT (arg) < 0)
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4544 XSETINT (arg, XINT (arg) + lines);
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4545 }
362c61b5411b (displayed_window_lines): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 28918
diff changeset
4546
34384
9669bb49fca2 (Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents: 34381
diff changeset
4547 if (w->vscroll)
9669bb49fca2 (Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents: 34381
diff changeset
4548 /* Skip past a partially visible first line. */
9669bb49fca2 (Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents: 34381
diff changeset
4549 XSETINT (arg, XINT (arg) + 1);
9669bb49fca2 (Fmove_to_window_line): Skip past any partially visible first line.
Miles Bader <miles@gnu.org>
parents: 34381
diff changeset
4550
6326
5e662ad3f594 (Fdelete_other_windows): Pass new arg to Fvertical_motion.
Richard M. Stallman <rms@gnu.org>
parents: 6269
diff changeset
4551 return Fvertical_motion (arg, window);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4552 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4553
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4554
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4555
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4556 /***********************************************************************
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4557 Window Configuration
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4558 ***********************************************************************/
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4559
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4560 struct save_window_data
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4561 {
15712
a272ccf6c225 (struct save_window_data, struct saved_window): First
Karl Heuer <kwzh@gnu.org>
parents: 15385
diff changeset
4562 EMACS_INT size_from_Lisp_Vector_struct;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4563 struct Lisp_Vector *next_from_Lisp_Vector_struct;
6099
19eaf70457d4 (Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents: 5990
diff changeset
4564 Lisp_Object frame_width, frame_height, frame_menu_bar_lines;
25544
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4565 Lisp_Object frame_tool_bar_lines;
1325
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
4566 Lisp_Object selected_frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4567 Lisp_Object current_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4568 Lisp_Object current_buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4569 Lisp_Object minibuf_scroll_window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4570 Lisp_Object root_window;
1325
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
4571 Lisp_Object focus_frame;
8931
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4572 /* Record the values of window-min-width and window-min-height
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4573 so that window sizes remain consistent with them. */
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4574 Lisp_Object min_width, min_height;
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
4575 /* A vector, each of whose elements is a struct saved_window
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
4576 for one window. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4577 Lisp_Object saved_windows;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4578 };
1326
709532b86646 * window.c (SAVE_WINDOW_DATA_SIZE): Define this using sizeof,
Jim Blandy <jimb@redhat.com>
parents: 1325
diff changeset
4579
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
4580 /* This is saved as a Lisp_Vector */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4581 struct saved_window
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4582 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4583 /* these first two must agree with struct Lisp_Vector in lisp.h */
15712
a272ccf6c225 (struct save_window_data, struct saved_window): First
Karl Heuer <kwzh@gnu.org>
parents: 15385
diff changeset
4584 EMACS_INT size_from_Lisp_Vector_struct;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4585 struct Lisp_Vector *next_from_Lisp_Vector_struct;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4586
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4587 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4588 Lisp_Object buffer, start, pointm, mark;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4589 Lisp_Object left, top, width, height, hscroll;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4590 Lisp_Object parent, prev;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4591 Lisp_Object start_at_line_beg;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4592 Lisp_Object display_table;
34090
7721faa485ea (struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents: 33957
diff changeset
4593 Lisp_Object orig_top, orig_height;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4594 };
34090
7721faa485ea (struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents: 33957
diff changeset
4595 #define SAVED_WINDOW_VECTOR_SIZE 16 /* Arg to Fmake_vector */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4596
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4597 #define SAVED_WINDOW_N(swv,n) \
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4598 ((struct saved_window *) (XVECTOR ((swv)->contents[(n)])))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4599
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4600 DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0,
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
4601 "Return t if OBJECT is a window-configuration object.")
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4602 (object)
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4603 Lisp_Object object;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4604 {
14089
415aa106fa17 (Fwindowp, Fwindow_live_p, Fother_window, Fenlarge_window, Fshrink_window,
Erik Naggum <erik@naggum.no>
parents: 14027
diff changeset
4605 if (WINDOW_CONFIGURATIONP (object))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4606 return Qt;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4607 return Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4608 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4609
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4610 DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_configuration_frame, 1, 1, 0,
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4611 "Return the frame that CONFIG, a window-configuration object, is about.")
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4612 (config)
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4613 Lisp_Object config;
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4614 {
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4615 register struct save_window_data *data;
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4616 struct Lisp_Vector *saved_windows;
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4617
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4618 if (! WINDOW_CONFIGURATIONP (config))
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4619 wrong_type_argument (Qwindow_configuration_p, config);
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4620
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4621 data = (struct save_window_data *) XVECTOR (config);
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4622 saved_windows = XVECTOR (data->saved_windows);
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4623 return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4624 }
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4625
2297
bb88d48c290f (Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents: 2210
diff changeset
4626 DEFUN ("set-window-configuration", Fset_window_configuration,
bb88d48c290f (Fselect_window): Use Fhandle_switch_frame.
Richard M. Stallman <rms@gnu.org>
parents: 2210
diff changeset
4627 Sset_window_configuration, 1, 1, 0,
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4628 "Set the configuration of windows and buffers as specified by CONFIGURATION.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4629 CONFIGURATION must be a value previously returned\n\
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4630 by `current-window-configuration' (which see).\n\
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4631 If CONFIGURATION was made from a frame that is now deleted,\n\
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4632 only frame-independent values can be restored. In this case,\n\
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4633 the return value is nil. Otherwise the value is t.")
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4634 (configuration)
1016
817b0ce337d7 * window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents: 983
diff changeset
4635 Lisp_Object configuration;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4636 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4637 register struct save_window_data *data;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4638 struct Lisp_Vector *saved_windows;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4639 Lisp_Object new_current_buffer;
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4640 Lisp_Object frame;
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
4641 FRAME_PTR f;
18657
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4642 int old_point = -1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4643
9105
984a4b1be1d1 (Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents: 9028
diff changeset
4644 while (!WINDOW_CONFIGURATIONP (configuration))
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4645 wrong_type_argument (Qwindow_configuration_p, configuration);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4646
1016
817b0ce337d7 * window.c (Fset_window_configuration): Removed #if 0'd code which
Jim Blandy <jimb@redhat.com>
parents: 983
diff changeset
4647 data = (struct save_window_data *) XVECTOR (configuration);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4648 saved_windows = XVECTOR (data->saved_windows);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4649
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4650 new_current_buffer = data->current_buffer;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4651 if (NILP (XBUFFER (new_current_buffer)->name))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4652 new_current_buffer = Qnil;
18657
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4653 else
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4654 {
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4655 if (XBUFFER (new_current_buffer) == current_buffer)
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4656 old_point = PT;
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4657 }
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4658
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4659 frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4660 f = XFRAME (frame);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4661
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4662 /* If f is a dead frame, don't bother rebuilding its window tree.
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4663 However, there is other stuff we should still try to do below. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4664 if (FRAME_LIVE_P (f))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4665 {
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4666 register struct window *w;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4667 register struct saved_window *p;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4668 struct window *root_window;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4669 struct window **leaf_windows;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4670 int n_leaf_windows;
33277
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4671 int k, i, n;
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4672
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4673 /* If the frame has been resized since this window configuration was
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4674 made, we change the frame to the size specified in the
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4675 configuration, restore the configuration, and then resize it
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4676 back. We keep track of the prevailing height in these variables. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4677 int previous_frame_height = FRAME_HEIGHT (f);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4678 int previous_frame_width = FRAME_WIDTH (f);
6099
19eaf70457d4 (Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents: 5990
diff changeset
4679 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
25544
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4680 int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4681
18657
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4682 /* The mouse highlighting code could get screwed up
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4683 if it runs during this. */
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4684 BLOCK_INPUT;
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4685
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4686 if (XFASTINT (data->frame_height) != previous_frame_height
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4687 || XFASTINT (data->frame_width) != previous_frame_width)
21533
b7df83bf15ff (Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents: 21514
diff changeset
4688 change_frame_size (f, XFASTINT (data->frame_height),
25356
5db69f7aadca Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents: 25315
diff changeset
4689 XFASTINT (data->frame_width), 0, 0, 0);
16051
ccf489f8596e Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents: 16039
diff changeset
4690 #if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS)
6099
19eaf70457d4 (Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents: 5990
diff changeset
4691 if (XFASTINT (data->frame_menu_bar_lines)
19eaf70457d4 (Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents: 5990
diff changeset
4692 != previous_frame_menu_bar_lines)
21533
b7df83bf15ff (Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents: 21514
diff changeset
4693 x_set_menu_bar_lines (f, data->frame_menu_bar_lines, make_number (0));
25115
2105537c5916 (Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents: 25044
diff changeset
4694 #ifdef HAVE_WINDOW_SYSTEM
25544
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4695 if (XFASTINT (data->frame_tool_bar_lines)
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4696 != previous_frame_tool_bar_lines)
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4697 x_set_tool_bar_lines (f, data->frame_tool_bar_lines, make_number (0));
6852
5cc78dd8efc3 (Fset_window_configuration): Only call X fns if HAVE_X_WINDOWS.
Karl Heuer <kwzh@gnu.org>
parents: 6851
diff changeset
4698 #endif
25115
2105537c5916 (Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents: 25044
diff changeset
4699 #endif
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4700
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4701 /* "Swap out" point from the selected window
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4702 into its buffer. We do this now, before
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4703 restoring the window contents, and prevent it from
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4704 being done later on when we select a new window. */
20627
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4705 if (! NILP (XWINDOW (selected_window)->buffer))
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4706 {
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4707 w = XWINDOW (selected_window);
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4708 set_marker_both (w->pointm,
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4709 w->buffer,
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4710 BUF_PT (XBUFFER (w->buffer)),
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4711 BUF_PT_BYTE (XBUFFER (w->buffer)));
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4712 }
0753fa7a67f3 (Fselect_window): Don't set OW->pointm if OW->buffer is nil.
Richard M. Stallman <rms@gnu.org>
parents: 20535
diff changeset
4713
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4714 windows_or_buffers_changed++;
10666
e1dfb47b664e (Fdelete_window, set_window_height, set_window_width)
Richard M. Stallman <rms@gnu.org>
parents: 10461
diff changeset
4715 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4716
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4717 /* Problem: Freeing all matrices and later allocating them again
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4718 is a serious redisplay flickering problem. What we would
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4719 really like to do is to free only those matrices not reused
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4720 below. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4721 root_window = XWINDOW (FRAME_ROOT_WINDOW (f));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4722 leaf_windows
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4723 = (struct window **) alloca (count_windows (root_window)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4724 * sizeof (struct window *));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4725 n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4726
8931
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4727 /* Temporarily avoid any problems with windows that are smaller
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4728 than they are supposed to be. */
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4729 window_min_height = 1;
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4730 window_min_width = 1;
c64388cd7346 (struct saved_window_data): New slots min_width, min_height.
Richard M. Stallman <rms@gnu.org>
parents: 8536
diff changeset
4731
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4732 /* Kludge Alert!
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4733 Mark all windows now on frame as "deleted".
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4734 Restoring the new configuration "undeletes" any that are in it.
14536
12de7dac154b (display_buffer_1): Fix typo in last change.
Roland McGrath <roland@gnu.org>
parents: 14535
diff changeset
4735
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4736 Save their current buffers in their height fields, since we may
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4737 need it later, if a buffer saved in the configuration is now
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4738 dead. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4739 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f)));
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4740
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4741 for (k = 0; k < saved_windows->size; k++)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4742 {
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4743 p = SAVED_WINDOW_N (saved_windows, k);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4744 w = XWINDOW (p->window);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4745 w->next = Qnil;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4746
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4747 if (!NILP (p->parent))
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4748 w->parent = SAVED_WINDOW_N (saved_windows,
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4749 XFASTINT (p->parent))->window;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4750 else
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4751 w->parent = Qnil;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4752
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4753 if (!NILP (p->prev))
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4754 {
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4755 w->prev = SAVED_WINDOW_N (saved_windows,
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4756 XFASTINT (p->prev))->window;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4757 XWINDOW (w->prev)->next = p->window;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4758 }
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4759 else
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4760 {
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4761 w->prev = Qnil;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4762 if (!NILP (w->parent))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4763 {
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4764 if (EQ (p->width, XWINDOW (w->parent)->width))
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4765 {
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4766 XWINDOW (w->parent)->vchild = p->window;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4767 XWINDOW (w->parent)->hchild = Qnil;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4768 }
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4769 else
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4770 {
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4771 XWINDOW (w->parent)->hchild = p->window;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4772 XWINDOW (w->parent)->vchild = Qnil;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4773 }
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4774 }
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4775 }
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4776
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4777 /* If we squirreled away the buffer in the window's height,
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4778 restore it now. */
9105
984a4b1be1d1 (Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents: 9028
diff changeset
4779 if (BUFFERP (w->height))
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4780 w->buffer = w->height;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4781 w->left = p->left;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4782 w->top = p->top;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4783 w->width = p->width;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4784 w->height = p->height;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4785 w->hscroll = p->hscroll;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4786 w->display_table = p->display_table;
34090
7721faa485ea (struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents: 33957
diff changeset
4787 w->orig_top = p->orig_top;
7721faa485ea (struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents: 33957
diff changeset
4788 w->orig_height = p->orig_height;
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
4789 XSETFASTINT (w->last_modified, 0);
16208
e3a834653117 (Fset_window_start): Clear last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents: 16068
diff changeset
4790 XSETFASTINT (w->last_overlay_modified, 0);
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4791
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4792 /* Reinstall the saved buffer and pointers into it. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4793 if (NILP (p->buffer))
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4794 w->buffer = p->buffer;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4795 else
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4796 {
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4797 if (!NILP (XBUFFER (p->buffer)->name))
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4798 /* If saved buffer is alive, install it. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4799 {
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4800 w->buffer = p->buffer;
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4801 w->start_at_line_beg = p->start_at_line_beg;
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4802 set_marker_restricted (w->start, p->start, w->buffer);
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4803 set_marker_restricted (w->pointm, p->pointm, w->buffer);
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4804 Fset_marker (XBUFFER (w->buffer)->mark,
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4805 p->mark, w->buffer);
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4806
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4807 /* As documented in Fcurrent_window_configuration, don't
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4808 save the location of point in the buffer which was current
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4809 when the window configuration was recorded. */
7618
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
4810 if (!EQ (p->buffer, new_current_buffer)
45298374e242 (change_window_height): Test for DELTA too small
Richard M. Stallman <rms@gnu.org>
parents: 7545
diff changeset
4811 && XBUFFER (p->buffer) == current_buffer)
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4812 Fgoto_char (w->pointm);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4813 }
3535
581c09f72dbd (Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents: 3354
diff changeset
4814 else if (NILP (w->buffer) || NILP (XBUFFER (w->buffer)->name))
581c09f72dbd (Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents: 3354
diff changeset
4815 /* Else unless window has a live buffer, get one. */
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4816 {
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4817 w->buffer = Fcdr (Fcar (Vbuffer_alist));
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4818 /* This will set the markers to beginning of visible
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4819 range. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4820 set_marker_restricted (w->start, make_number (0), w->buffer);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4821 set_marker_restricted (w->pointm, make_number (0),w->buffer);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4822 w->start_at_line_beg = Qt;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4823 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4824 else
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4825 /* Keeping window's old buffer; make sure the markers
3535
581c09f72dbd (Fset_window_configuration): If a window is supposed
Richard M. Stallman <rms@gnu.org>
parents: 3354
diff changeset
4826 are real. */
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4827 {
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4828 /* Set window markers at start of visible range. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4829 if (XMARKER (w->start)->buffer == 0)
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4830 set_marker_restricted (w->start, make_number (0),
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4831 w->buffer);
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4832 if (XMARKER (w->pointm)->buffer == 0)
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4833 set_marker_restricted_both (w->pointm, w->buffer,
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4834 BUF_PT (XBUFFER (w->buffer)),
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
4835 BUF_PT_BYTE (XBUFFER (w->buffer)));
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4836 w->start_at_line_beg = Qt;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4837 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4838 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4839 }
1237
3929b2135e58 * window.c (delete_all_subwindows): Save the window's buffer in
Jim Blandy <jimb@redhat.com>
parents: 1123
diff changeset
4840
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4841 FRAME_ROOT_WINDOW (f) = data->root_window;
27869
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4842 /* Prevent "swapping out point" in the old selected window
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4843 using the buffer that has been restored into it.
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4844 That swapping out has already been done,
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4845 near the beginning of this function. */
1322db65a230 (select_window_1): If selected_window is nil,
Gerd Moellmann <gerd@gnu.org>
parents: 27850
diff changeset
4846 selected_window = Qnil;
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4847 Fselect_window (data->current_window);
17678
c13cd575945a (Fset_window_configuration): Set last_selected_window
Richard M. Stallman <rms@gnu.org>
parents: 17628
diff changeset
4848 XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
c13cd575945a (Fset_window_configuration): Set last_selected_window
Richard M. Stallman <rms@gnu.org>
parents: 17628
diff changeset
4849 = selected_window;
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4850
1716
95db936d47c0 * keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents: 1685
diff changeset
4851 if (NILP (data->focus_frame)
9105
984a4b1be1d1 (Fwindowp, Fwindow_live_p, window_display_table, window_loop,
Karl Heuer <kwzh@gnu.org>
parents: 9028
diff changeset
4852 || (FRAMEP (data->focus_frame)
1716
95db936d47c0 * keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents: 1685
diff changeset
4853 && FRAME_LIVE_P (XFRAME (data->focus_frame))))
95db936d47c0 * keyboard.c (Qscrollbar_movement, Qvertical_scrollbar,
Jim Blandy <jimb@redhat.com>
parents: 1685
diff changeset
4854 Fredirect_frame_focus (frame, data->focus_frame);
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4855
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4856 #if 0 /* I don't understand why this is needed, and it causes problems
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4857 when the frame's old selected window has been deleted. */
15385
72b57d1c8de0 Whitespace and #if 0 code changes.
Richard M. Stallman <rms@gnu.org>
parents: 15384
diff changeset
4858 if (f != selected_frame && FRAME_WINDOW_P (f))
12288
36d3bd1212de (Fset_window_configuration): Use do_switch_frame directly.
Richard M. Stallman <rms@gnu.org>
parents: 11852
diff changeset
4859 do_switch_frame (WINDOW_FRAME (XWINDOW (data->root_window)),
36d3bd1212de (Fset_window_configuration): Use do_switch_frame directly.
Richard M. Stallman <rms@gnu.org>
parents: 11852
diff changeset
4860 Qnil, 0);
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4861 #endif
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4862
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4863 /* Set the screen height to the value it had before this function. */
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4864 if (previous_frame_height != FRAME_HEIGHT (f)
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4865 || previous_frame_width != FRAME_WIDTH (f))
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4866 change_frame_size (f, previous_frame_height, previous_frame_width,
25356
5db69f7aadca Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents: 25315
diff changeset
4867 0, 0, 0);
16051
ccf489f8596e Removed support for !MULTI_FRAME.
Karl Heuer <kwzh@gnu.org>
parents: 16039
diff changeset
4868 #if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS)
6099
19eaf70457d4 (Fset_window_configuration): Allow for menu-bar-lines to have changed since
Karl Heuer <kwzh@gnu.org>
parents: 5990
diff changeset
4869 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f))
21533
b7df83bf15ff (Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents: 21514
diff changeset
4870 x_set_menu_bar_lines (f, make_number (previous_frame_menu_bar_lines),
b7df83bf15ff (Fset_window_configuration): Fix mixing of Lisp_Object
Andreas Schwab <schwab@suse.de>
parents: 21514
diff changeset
4871 make_number (0));
25115
2105537c5916 (Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents: 25044
diff changeset
4872 #ifdef HAVE_WINDOW_SYSTEM
25544
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4873 if (previous_frame_tool_bar_lines != FRAME_TOOL_BAR_LINES (f))
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4874 x_set_tool_bar_lines (f, make_number (previous_frame_tool_bar_lines),
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
4875 make_number (0));
6852
5cc78dd8efc3 (Fset_window_configuration): Only call X fns if HAVE_X_WINDOWS.
Karl Heuer <kwzh@gnu.org>
parents: 6851
diff changeset
4876 #endif
25115
2105537c5916 (Fset_window_configuration) [MSDOS]: Don't call
Eli Zaretskii <eliz@gnu.org>
parents: 25044
diff changeset
4877 #endif
18657
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4878
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4879 /* Now, free glyph matrices in windows that were not reused. */
33277
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4880 for (i = n = 0; i < n_leaf_windows; ++i)
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4881 {
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4882 if (NILP (leaf_windows[i]->buffer))
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4883 {
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4884 /* Assert it's not reused as a combination. */
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4885 xassert (NILP (leaf_windows[i]->hchild)
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4886 && NILP (leaf_windows[i]->vchild));
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4887 free_window_matrices (leaf_windows[i]);
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4888 SET_FRAME_GARBAGED (f);
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4889 }
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4890 else if (EQ (leaf_windows[i]->buffer, new_current_buffer))
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4891 ++n;
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4892 }
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4893
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4894 /* If more than one window shows the new and old current buffer,
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4895 don't try to preserve point in that buffer. */
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4896 if (old_point > 0 && n > 1)
8239087d52c5 (Fset_window_configuration): Don't try to preserve
Gerd Moellmann <gerd@gnu.org>
parents: 33255
diff changeset
4897 old_point = -1;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4898
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4899 adjust_glyphs (f);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4900
18657
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4901 UNBLOCK_INPUT;
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4902
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4903 /* Fselect_window will have made f the selected frame, so we
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4904 reselect the proper frame here. Fhandle_switch_frame will change the
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4905 selected window too, but that doesn't make the call to
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4906 Fselect_window above totally superfluous; it still sets f's
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4907 selected window. */
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4908 if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4909 do_switch_frame (data->selected_frame, Qnil, 0);
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4910
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4911 if (! NILP (Vwindow_configuration_change_hook)
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4912 && ! NILP (Vrun_hooks))
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4913 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4914 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4915
1325
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
4916 if (!NILP (new_current_buffer))
18657
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4917 {
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4918 Fset_buffer (new_current_buffer);
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4919
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4920 /* If the buffer that is current now is the same
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4921 that was current before setting the window configuration,
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4922 don't alter its PT. */
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4923 if (old_point >= 0)
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4924 SET_PT (old_point);
1dc4d7e374d5 Include blockinput.h.
Richard M. Stallman <rms@gnu.org>
parents: 18493
diff changeset
4925 }
1325
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
4926
21198
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4927 /* Restore the minimum heights recorded in the configuration. */
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4928 window_min_height = XINT (data->min_height);
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4929 window_min_width = XINT (data->min_width);
10518dc95b25 (Frecenter): Operate on window's buffer even if some other was current.
Richard M. Stallman <rms@gnu.org>
parents: 21022
diff changeset
4930
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4931 Vminibuf_scroll_window = data->minibuf_scroll_window;
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
4932
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
4933 return (FRAME_LIVE_P (f) ? Qt : Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4934 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4935
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
4936 /* Mark all windows now on frame as deleted
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4937 by setting their buffers to nil. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4938
1685
8d7fc70d3103 * window.c (Fset_window_configuration): If we're restoring the
Jim Blandy <jimb@redhat.com>
parents: 1572
diff changeset
4939 void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4940 delete_all_subwindows (w)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4941 register struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4942 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4943 if (!NILP (w->next))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4944 delete_all_subwindows (XWINDOW (w->next));
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4945 if (!NILP (w->vchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4946 delete_all_subwindows (XWINDOW (w->vchild));
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4947 if (!NILP (w->hchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4948 delete_all_subwindows (XWINDOW (w->hchild));
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4949
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4950 w->height = w->buffer; /* See Fset_window_configuration for excuse. */
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4951
16068
b19129a8c644 (unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents: 16051
diff changeset
4952 if (!NILP (w->buffer))
b19129a8c644 (unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents: 16051
diff changeset
4953 unshow_buffer (w);
b19129a8c644 (unshow_buffer): Clear last_selected_window slot, maybe.
Richard M. Stallman <rms@gnu.org>
parents: 16051
diff changeset
4954
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4955 /* We set all three of these fields to nil, to make sure that we can
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4956 distinguish this dead window from any live window. Live leaf
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4957 windows will have buffer set, and combination windows will have
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4958 vchild or hchild set. */
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4959 w->buffer = Qnil;
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4960 w->vchild = Qnil;
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
4961 w->hchild = Qnil;
30045
ff2db81c11c1 (delete_all_subwindows): Reset Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents: 30039
diff changeset
4962
ff2db81c11c1 (delete_all_subwindows): Reset Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents: 30039
diff changeset
4963 Vwindow_list = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4964 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4965
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4966 static int
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4967 count_windows (window)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4968 register struct window *window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4969 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4970 register int count = 1;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4971 if (!NILP (window->next))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4972 count += count_windows (XWINDOW (window->next));
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4973 if (!NILP (window->vchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4974 count += count_windows (XWINDOW (window->vchild));
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
4975 if (!NILP (window->hchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4976 count += count_windows (XWINDOW (window->hchild));
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4977 return count;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4978 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4979
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4980
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4981 /* Fill vector FLAT with leaf windows under W, starting at index I.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4982 Value is last index + 1. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4983
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4984 static int
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4985 get_leaf_windows (w, flat, i)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4986 struct window *w;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4987 struct window **flat;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4988 int i;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4989 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4990 while (w)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4991 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4992 if (!NILP (w->hchild))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4993 i = get_leaf_windows (XWINDOW (w->hchild), flat, i);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4994 else if (!NILP (w->vchild))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4995 i = get_leaf_windows (XWINDOW (w->vchild), flat, i);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4996 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4997 flat[i++] = w;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4998
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
4999 w = NILP (w->next) ? 0 : XWINDOW (w->next);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5000 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5001
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5002 return i;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5003 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5004
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5005
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5006 /* Return a pointer to the glyph W's physical cursor is on. Value is
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5007 null if W's current matrix is invalid, so that no meaningfull glyph
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5008 can be returned. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5009
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5010 struct glyph *
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5011 get_phys_cursor_glyph (w)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5012 struct window *w;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5013 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5014 struct glyph_row *row;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5015 struct glyph *glyph;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5016
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5017 if (w->phys_cursor.vpos >= 0
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5018 && w->phys_cursor.vpos < w->current_matrix->nrows
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5019 && (row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos),
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5020 row->enabled_p)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5021 && row->used[TEXT_AREA] > w->phys_cursor.hpos)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5022 glyph = row->glyphs[TEXT_AREA] + w->phys_cursor.hpos;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5023 else
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5024 glyph = NULL;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5025
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5026 return glyph;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5027 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5028
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5029
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5030 static int
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5031 save_window_save (window, vector, i)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5032 Lisp_Object window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5033 struct Lisp_Vector *vector;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5034 int i;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5035 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5036 register struct saved_window *p;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5037 register struct window *w;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5038 register Lisp_Object tem;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5039
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
5040 for (;!NILP (window); window = w->next)
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5041 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5042 p = SAVED_WINDOW_N (vector, i);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5043 w = XWINDOW (window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5044
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
5045 XSETFASTINT (w->temslot, i++);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5046 p->window = window;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5047 p->buffer = w->buffer;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5048 p->left = w->left;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5049 p->top = w->top;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5050 p->width = w->width;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5051 p->height = w->height;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5052 p->hscroll = w->hscroll;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5053 p->display_table = w->display_table;
34090
7721faa485ea (struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents: 33957
diff changeset
5054 p->orig_top = w->orig_top;
7721faa485ea (struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents: 33957
diff changeset
5055 p->orig_height = w->orig_height;
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
5056 if (!NILP (w->buffer))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5057 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5058 /* Save w's value of point in the window configuration.
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5059 If w is the selected window, then get the value of point
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5060 from the buffer; pointm is garbage in the selected window. */
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5061 if (EQ (window, selected_window))
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5062 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5063 p->pointm = Fmake_marker ();
20535
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
5064 set_marker_both (p->pointm, w->buffer,
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
5065 BUF_PT (XBUFFER (w->buffer)),
3094e3fd9764 (unshow_buffer): Set PT with TEMP_SET_PT_BOTH.
Richard M. Stallman <rms@gnu.org>
parents: 20351
diff changeset
5066 BUF_PT_BYTE (XBUFFER (w->buffer)));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5067 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5068 else
12981
7a540e9cb21a (save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents: 12643
diff changeset
5069 p->pointm = Fcopy_marker (w->pointm, Qnil);
7a540e9cb21a (save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents: 12643
diff changeset
5070
7a540e9cb21a (save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents: 12643
diff changeset
5071 p->start = Fcopy_marker (w->start, Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5072 p->start_at_line_beg = w->start_at_line_beg;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5073
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5074 tem = XBUFFER (w->buffer)->mark;
12981
7a540e9cb21a (save_window_save): Pass the new arg to Fcopy_marker.
Richard M. Stallman <rms@gnu.org>
parents: 12643
diff changeset
5075 p->mark = Fcopy_marker (tem, Qnil);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5076 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5077 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5078 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5079 p->pointm = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5080 p->start = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5081 p->mark = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5082 p->start_at_line_beg = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5083 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5084
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
5085 if (NILP (w->parent))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5086 p->parent = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5087 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5088 p->parent = XWINDOW (w->parent)->temslot;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5089
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
5090 if (NILP (w->prev))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5091 p->prev = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5092 else
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5093 p->prev = XWINDOW (w->prev)->temslot;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5094
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
5095 if (!NILP (w->vchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5096 i = save_window_save (w->vchild, vector, i);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 432
diff changeset
5097 if (!NILP (w->hchild))
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5098 i = save_window_save (w->hchild, vector, i);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5099 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5100
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5101 return i;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5102 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5103
16485
9b919c5464a4 Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents: 16392
diff changeset
5104 DEFUN ("current-window-configuration", Fcurrent_window_configuration,
9b919c5464a4 Reorganize function definitions so etags finds them.
Erik Naggum <erik@naggum.no>
parents: 16392
diff changeset
5105 Scurrent_window_configuration, 0, 1, 0,
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5106 "Return an object representing the current window configuration of FRAME.\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5107 If FRAME is nil or omitted, use the selected frame.\n\
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5108 This describes the number of windows, their sizes and current buffers,\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5109 and for each displayed buffer, where display starts, and the positions of\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5110 point and mark. An exception is made for point in the current buffer:\n\
1325
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
5111 its value is -not- saved.\n\
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
5112 This also records the currently selected frame, and FRAME's focus\n\
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
5113 redirection (see `redirect-frame-focus').")
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5114 (frame)
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5115 Lisp_Object frame;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5116 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5117 register Lisp_Object tem;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5118 register int n_windows;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5119 register struct save_window_data *data;
9974
5cda62e4222a (Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9970
diff changeset
5120 register struct Lisp_Vector *vec;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5121 register int i;
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5122 FRAME_PTR f;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5123
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5124 if (NILP (frame))
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5125 frame = selected_frame;
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5126 CHECK_LIVE_FRAME (frame, 0);
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5127 f = XFRAME (frame);
358
71c9042fb90d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
5128
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5129 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
9974
5cda62e4222a (Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9970
diff changeset
5130 vec = allocate_vectorlike (VECSIZE (struct save_window_data));
5cda62e4222a (Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9970
diff changeset
5131 for (i = 0; i < VECSIZE (struct save_window_data); i++)
5cda62e4222a (Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9970
diff changeset
5132 vec->contents[i] = Qnil;
5cda62e4222a (Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9970
diff changeset
5133 vec->size = VECSIZE (struct save_window_data);
5cda62e4222a (Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9970
diff changeset
5134 data = (struct save_window_data *)vec;
5cda62e4222a (Fcurrent_window_configuration): Use allocate_vectorlike and VECSIZE.
Karl Heuer <kwzh@gnu.org>
parents: 9970
diff changeset
5135
9324
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
5136 XSETFASTINT (data->frame_width, FRAME_WIDTH (f));
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
5137 XSETFASTINT (data->frame_height, FRAME_HEIGHT (f));
ac6a5691607f (make_window, Fset_window_hscroll, Fset_window_start, set_window_height,
Karl Heuer <kwzh@gnu.org>
parents: 9282
diff changeset
5138 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f));
25544
693ca9ba497a Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents: 25540
diff changeset
5139 XSETFASTINT (data->frame_tool_bar_lines, FRAME_TOOL_BAR_LINES (f));
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5140 data->selected_frame = selected_frame;
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5141 data->current_window = FRAME_SELECTED_WINDOW (f);
9282
f4fa46f6a032 (Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents: 9243
diff changeset
5142 XSETBUFFER (data->current_buffer, current_buffer);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5143 data->minibuf_scroll_window = Vminibuf_scroll_window;
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5144 data->root_window = FRAME_ROOT_WINDOW (f);
1325
f03e559aac3e * window.c (struct save_window_data): Save the currently selected
Jim Blandy <jimb@redhat.com>
parents: 1280
diff changeset
5145 data->focus_frame = FRAME_FOCUS_FRAME (f);
9282
f4fa46f6a032 (Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents: 9243
diff changeset
5146 XSETINT (data->min_height, window_min_height);
f4fa46f6a032 (Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents: 9243
diff changeset
5147 XSETINT (data->min_width, window_min_width);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5148 tem = Fmake_vector (make_number (n_windows), Qnil);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5149 data->saved_windows = tem;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5150 for (i = 0; i < n_windows; i++)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5151 XVECTOR (tem)->contents[i]
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5152 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil);
34090
7721faa485ea (struct saved_window): Add members orig_top and
Gerd Moellmann <gerd@gnu.org>
parents: 33957
diff changeset
5153 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
9282
f4fa46f6a032 (Fminibuffer_window, Fwindow_at, Fwindow_end, Fnext_window, Fprevious_window,
Karl Heuer <kwzh@gnu.org>
parents: 9243
diff changeset
5154 XSETWINDOW_CONFIGURATION (tem, data);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5155 return (tem);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5156 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5157
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5158 DEFUN ("save-window-excursion", Fsave_window_excursion, Ssave_window_excursion,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5159 0, UNEVALLED, 0,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5160 "Execute body, preserving window sizes and contents.\n\
8059
59baddaf62a0 (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8053
diff changeset
5161 Restore which buffer appears in which window, where display starts,\n\
59baddaf62a0 (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8053
diff changeset
5162 and the value of point and mark for each window.\n\
28104
7eb1735d6d4d (Fsave_window_excursion): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 28004
diff changeset
5163 Also restore the choice of selected window.\n\
8059
59baddaf62a0 (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8053
diff changeset
5164 Also restore which buffer is current.\n\
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5165 Does not restore the value of point in current buffer.")
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5166 (args)
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5167 Lisp_Object args;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5168 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5169 register Lisp_Object val;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5170 register int count = specpdl_ptr - specpdl;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5171
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5172 record_unwind_protect (Fset_window_configuration,
358
71c9042fb90d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 338
diff changeset
5173 Fcurrent_window_configuration (Qnil));
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5174 val = Fprogn (args);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5175 return unbind_to (count, val);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5176 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5177
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5178
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5179 /***********************************************************************
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5180 Marginal Areas
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5181 ***********************************************************************/
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5182
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5183 DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins,
27553
49dd86912d71 (Fset_window_margins): Don't make interactive. Doc fix.
Dave Love <fx@gnu.org>
parents: 26873
diff changeset
5184 2, 3, 0,
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5185 "Set width of marginal areas of window WINDOW.\n\
27553
49dd86912d71 (Fset_window_margins): Don't make interactive. Doc fix.
Dave Love <fx@gnu.org>
parents: 26873
diff changeset
5186 If window is nil, set margins of the currently selected window.\n\
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5187 First parameter LEFT-WIDTH specifies the number of character\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5188 cells to reserve for the left marginal area. Second parameter\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5189 RIGHT-WIDTH does the same for the right marginal area.\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5190 A nil width parameter means no margin.")
25591
d58d733a75d6 (Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25549
diff changeset
5191 (window, left, right)
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5192 Lisp_Object window, left, right;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5193 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5194 struct window *w = decode_window (window);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5195
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5196 if (!NILP (left))
25591
d58d733a75d6 (Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25549
diff changeset
5197 CHECK_NUMBER_OR_FLOAT (left, 1);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5198 if (!NILP (right))
25591
d58d733a75d6 (Fset_window_margins): Make window the first argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25549
diff changeset
5199 CHECK_NUMBER_OR_FLOAT (right, 2);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5200
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5201 /* Check widths < 0 and translate a zero width to nil.
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5202 Margins that are too wide have to be checked elsewhere. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5203 if ((INTEGERP (left) && XINT (left) < 0)
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 26153
diff changeset
5204 || (FLOATP (left) && XFLOAT_DATA (left) <= 0))
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5205 XSETFASTINT (left, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5206 if (INTEGERP (left) && XFASTINT (left) == 0)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5207 left = Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5208
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5209 if ((INTEGERP (right) && XINT (right) < 0)
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 26153
diff changeset
5210 || (FLOATP (right) && XFLOAT_DATA (right) <= 0))
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5211 XSETFASTINT (right, 0);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5212 if (INTEGERP (right) && XFASTINT (right) == 0)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5213 right = Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5214
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5215 w->left_margin_width = left;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5216 w->right_margin_width = right;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5217
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5218 ++windows_or_buffers_changed;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5219 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5220 return Qnil;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5221 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5222
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5223
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5224 DEFUN ("window-margins", Fwindow_margins, Swindow_margins,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5225 0, 1, 0,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5226 "Get width of marginal areas of window WINDOW.\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5227 If WINDOW is omitted or nil, use the currently selected window.\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5228 Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5229 If a marginal area does not exist, its width will be returned\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5230 as nil.")
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5231 (window)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5232 Lisp_Object window;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5233 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5234 struct window *w = decode_window (window);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5235 return Fcons (w->left_margin_width, w->right_margin_width);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5236 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5237
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5238
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5239
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5240 /***********************************************************************
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5241 Smooth scrolling
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5242 ***********************************************************************/
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5243
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5244 DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 1, 0,
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5245 "Return the amount by which WINDOW is scrolled vertically.\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5246 Use the selected window if WINDOW is nil or omitted.\n\
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5247 Value is a multiple of the canonical character height of WINDOW.")
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5248 (window)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5249 Lisp_Object window;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5250 {
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5251 Lisp_Object result;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5252 struct frame *f;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5253 struct window *w;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5254
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5255 if (NILP (window))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5256 window = selected_window;
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5257 else
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5258 CHECK_WINDOW (window, 0);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5259 w = XWINDOW (window);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5260 f = XFRAME (w->frame);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5261
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5262 if (FRAME_WINDOW_P (f))
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5263 result = CANON_Y_FROM_PIXEL_Y (f, -w->vscroll);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5264 else
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5265 result = make_number (0);
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5266 return result;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5267 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5268
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5269
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5270 DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll,
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5271 2, 2, 0,
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5272 "Set amount by which WINDOW should be scrolled vertically to VSCROLL.\n\
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5273 WINDOW nil or omitted means use the selected window. VSCROLL is a\n\
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5274 non-negative multiple of the canonical character height of WINDOW.")
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5275 (window, vscroll)
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5276 Lisp_Object window, vscroll;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5277 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5278 struct window *w;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5279 struct frame *f;
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5280
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5281 if (NILP (window))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5282 window = selected_window;
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5283 else
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5284 CHECK_WINDOW (window, 0);
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5285 CHECK_NUMBER_OR_FLOAT (vscroll, 1);
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5286
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5287 w = XWINDOW (window);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5288 f = XFRAME (w->frame);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5289
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5290 if (FRAME_WINDOW_P (f))
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5291 {
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5292 int old_dy = w->vscroll;
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5293
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5294 w->vscroll = - CANON_Y_UNIT (f) * XFLOATINT (vscroll);
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5295 w->vscroll = min (w->vscroll, 0);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5296
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5297 /* Adjust glyph matrix of the frame if the virtual display
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5298 area becomes larger than before. */
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5299 if (w->vscroll < 0 && w->vscroll < old_dy)
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5300 adjust_glyphs (f);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5301
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5302 /* Prevent redisplay shortcuts. */
25375
919b568e4108 (Fset_window_hscroll): Set
Gerd Moellmann <gerd@gnu.org>
parents: 25356
diff changeset
5303 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5304 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5305
25549
63deb587dce1 (Fset_window_vscroll): Make window the first argument,
Gerd Moellmann <gerd@gnu.org>
parents: 25546
diff changeset
5306 return Fwindow_vscroll (window);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5307 }
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5308
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5309
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5310 /* Call FN for all leaf windows on frame F. FN is called with the
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5311 first argument being a pointer to the leaf window, and with
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5312 additional argument USER_DATA. Stops when FN returns 0. */
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5313
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5314 void
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5315 foreach_window (f, fn, user_data)
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5316 struct frame *f;
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5317 int (* fn) P_ ((struct window *, void *));
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5318 void *user_data;
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5319 {
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5320 foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data);
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5321 }
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5322
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5323
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5324 /* Helper function for foreach_window. Call FN for all leaf windows
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5325 reachable from W. FN is called with the first argument being a
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5326 pointer to the leaf window, and with additional argument USER_DATA.
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5327 Stop when FN returns 0. Value is 0 if stopped by FN. */
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5328
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5329 static int
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5330 foreach_window_1 (w, fn, user_data)
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5331 struct window *w;
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5332 int (* fn) P_ ((struct window *, void *));
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5333 void *user_data;
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5334 {
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5335 int cont;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5336
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5337 for (cont = 1; w && cont;)
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5338 {
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5339 if (!NILP (w->hchild))
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5340 cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data);
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5341 else if (!NILP (w->vchild))
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5342 cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data);
30366
8dd313fc287d (foreach_window_1): Fix typo reversing an if-condition.
Gerd Moellmann <gerd@gnu.org>
parents: 30362
diff changeset
5343 else
8dd313fc287d (foreach_window_1): Fix typo reversing an if-condition.
Gerd Moellmann <gerd@gnu.org>
parents: 30362
diff changeset
5344 cont = fn (w, user_data);
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5345
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5346 w = NILP (w->next) ? 0 : XWINDOW (w->next);
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5347 }
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5348
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5349 return cont;
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5350 }
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5351
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5352
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5353 /* Freeze or unfreeze the window start of W if unless it is a
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5354 mini-window or the selected window. FREEZE_P non-null means freeze
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5355 the window start. */
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5356
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5357 static int
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5358 freeze_window_start (w, freeze_p)
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5359 struct window *w;
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5360 void *freeze_p;
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5361 {
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5362 if (w == XWINDOW (selected_window)
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5363 || MINI_WINDOW_P (w)
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5364 || (MINI_WINDOW_P (XWINDOW (selected_window))
28726
5f7ccec488b5 (freeze_window_start): Check that minibuffer scroll window isn't nil before
Ken Raeburn <raeburn@raeburn.org>
parents: 28505
diff changeset
5365 && ! NILP (Vminibuf_scroll_window)
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5366 && w == XWINDOW (Vminibuf_scroll_window)))
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5367 freeze_p = NULL;
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5368
30362
fc017b1b2a7d (foreach_window): Instead of a fake variable argument
Gerd Moellmann <gerd@gnu.org>
parents: 30265
diff changeset
5369 w->frozen_window_start_p = freeze_p != NULL;
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5370 return 1;
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5371 }
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5372
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5373
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5374 /* Freeze or unfreeze the window starts of all leaf windows on frame
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5375 F, except the selected window and a mini-window. FREEZE_P non-zero
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5376 means freeze the window start. */
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5377
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5378 void
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5379 freeze_window_starts (f, freeze_p)
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5380 struct frame *f;
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5381 int freeze_p;
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5382 {
31903
3e0a1f91c149 (freeze_window_starts): Construct last argument for
Gerd Moellmann <gerd@gnu.org>
parents: 31829
diff changeset
5383 foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0));
25517
619897099dc4 (foreach_window, foreach_window_1): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25462
diff changeset
5384 }
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5385
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5386
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5387 /***********************************************************************
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5388 Initialization
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5389 ***********************************************************************/
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5390
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5391 /* Return 1 if window configurations C1 and C2
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5392 describe the same state of affairs. This is used by Fequal. */
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5393
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5394 int
21022
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5395 compare_window_configurations (c1, c2, ignore_positions)
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5396 Lisp_Object c1, c2;
21022
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5397 int ignore_positions;
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5398 {
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5399 register struct save_window_data *d1, *d2;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5400 struct Lisp_Vector *sw1, *sw2;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5401 int i;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5402
28505
b5a7eb24964c (compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents: 28463
diff changeset
5403 if (!WINDOW_CONFIGURATIONP (c1))
b5a7eb24964c (compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents: 28463
diff changeset
5404 wrong_type_argument (Qwindow_configuration_p, c1);
b5a7eb24964c (compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents: 28463
diff changeset
5405 if (!WINDOW_CONFIGURATIONP (c2))
b5a7eb24964c (compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents: 28463
diff changeset
5406 wrong_type_argument (Qwindow_configuration_p, c2);
b5a7eb24964c (compare_window_configurations): Signal an error
Gerd Moellmann <gerd@gnu.org>
parents: 28463
diff changeset
5407
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5408 d1 = (struct save_window_data *) XVECTOR (c1);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5409 d2 = (struct save_window_data *) XVECTOR (c2);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5410 sw1 = XVECTOR (d1->saved_windows);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5411 sw2 = XVECTOR (d2->saved_windows);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5412
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5413 if (! EQ (d1->frame_width, d2->frame_width))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5414 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5415 if (! EQ (d1->frame_height, d2->frame_height))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5416 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5417 if (! EQ (d1->frame_menu_bar_lines, d2->frame_menu_bar_lines))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5418 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5419 if (! EQ (d1->selected_frame, d2->selected_frame))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5420 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5421 /* Don't compare the current_window field directly.
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5422 Instead see w1_is_current and w2_is_current, below. */
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5423 if (! EQ (d1->current_buffer, d2->current_buffer))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5424 return 0;
21022
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5425 if (! ignore_positions)
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5426 if (! EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window))
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5427 return 0;
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5428 /* Don't compare the root_window field.
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5429 We don't require the two configurations
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5430 to use the same window object,
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5431 and the two root windows must be equivalent
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5432 if everything else compares equal. */
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5433 if (! EQ (d1->focus_frame, d2->focus_frame))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5434 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5435 if (! EQ (d1->min_width, d2->min_width))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5436 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5437 if (! EQ (d1->min_height, d2->min_height))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5438 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5439
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5440 /* Verify that the two confis have the same number of windows. */
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5441 if (sw1->size != sw2->size)
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5442 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5443
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5444 for (i = 0; i < sw1->size; i++)
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5445 {
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5446 struct saved_window *p1, *p2;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5447 int w1_is_current, w2_is_current;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5448
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5449 p1 = SAVED_WINDOW_N (sw1, i);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5450 p2 = SAVED_WINDOW_N (sw2, i);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5451
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5452 /* Verify that the current windows in the two
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5453 configurations correspond to each other. */
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5454 w1_is_current = EQ (d1->current_window, p1->window);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5455 w2_is_current = EQ (d2->current_window, p2->window);
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5456
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5457 if (w1_is_current != w2_is_current)
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5458 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5459
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5460 /* Verify that the corresponding windows do match. */
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5461 if (! EQ (p1->buffer, p2->buffer))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5462 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5463 if (! EQ (p1->left, p2->left))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5464 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5465 if (! EQ (p1->top, p2->top))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5466 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5467 if (! EQ (p1->width, p2->width))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5468 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5469 if (! EQ (p1->height, p2->height))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5470 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5471 if (! EQ (p1->display_table, p2->display_table))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5472 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5473 if (! EQ (p1->parent, p2->parent))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5474 return 0;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5475 if (! EQ (p1->prev, p2->prev))
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5476 return 0;
21022
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5477 if (! ignore_positions)
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5478 {
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5479 if (! EQ (p1->hscroll, p2->hscroll))
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5480 return 0;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5481 if (! EQ (p1->start_at_line_beg, p2->start_at_line_beg))
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5482 return 0;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5483 if (NILP (Fequal (p1->start, p2->start)))
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5484 return 0;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5485 if (NILP (Fequal (p1->pointm, p2->pointm)))
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5486 return 0;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5487 if (NILP (Fequal (p1->mark, p2->mark)))
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5488 return 0;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5489 }
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5490 }
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5491
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5492 return 1;
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5493 }
21022
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5494
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5495 DEFUN ("compare-window-configurations", Fcompare_window_configurations,
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5496 Scompare_window_configurations, 2, 2, 0,
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5497 "Compare two window configurations as regards the structure of windows.\n\
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5498 This function ignores details such as the values of point and mark\n\
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5499 and scrolling positions.")
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5500 (x, y)
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5501 Lisp_Object x, y;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5502 {
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5503 if (compare_window_configurations (x, y, 1))
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5504 return Qt;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5505 return Qnil;
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5506 }
20777
a9e1b9bf06e3 (compare_window_configurations): New function.
Richard M. Stallman <rms@gnu.org>
parents: 20708
diff changeset
5507
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
5508 void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5509 init_window_once ()
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5510 {
25676
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5511 struct frame *f = make_terminal_frame ();
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5512 XSETFRAME (selected_frame, f);
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5513 Vterminal_frame = selected_frame;
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5514 minibuf_window = f->minibuffer_window;
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5515 selected_window = f->selected_window;
70c6d3f2f3b9 (Fminibuffer_window): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents: 25591
diff changeset
5516 last_nonminibuf_frame = f;
14445
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
5517
e73b37519cdc (Fset_window_buffer): Set buffer temporarily around running
Richard M. Stallman <rms@gnu.org>
parents: 14204
diff changeset
5518 window_initialized = 1;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5519 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5520
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
5521 void
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5522 init_window ()
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5523 {
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5524 Vwindow_list = Qnil;
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5525 }
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5526
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5527 void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5528 syms_of_window ()
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5529 {
25315
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
5530 Qleft_bitmap_area = intern ("left-bitmap-area");
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
5531 staticpro (&Qleft_bitmap_area);
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
5532 Qright_bitmap_area = intern ("right-bitmap-area");
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
5533 staticpro (&Qright_bitmap_area);
79bb4978ab2e (Fcoordinates_in_window_p): Return `left-bitmap-area'
Gerd Moellmann <gerd@gnu.org>
parents: 25300
diff changeset
5534
25540
2b4bdd114899 (Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents: 25517
diff changeset
5535 Qwindow_size_fixed = intern ("window-size-fixed");
2b4bdd114899 (Qwindow_size_fixed): Replaces Qfixed_window_size.
Gerd Moellmann <gerd@gnu.org>
parents: 25517
diff changeset
5536 staticpro (&Qwindow_size_fixed);
25268
ae698a1c13a4 (Qfixed_window_size): New.
Gerd Moellmann <gerd@gnu.org>
parents: 25255
diff changeset
5537
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5538 staticpro (&Qwindow_configuration_change_hook);
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5539 Qwindow_configuration_change_hook
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5540 = intern ("window-configuration-change-hook");
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5541
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5542 Qwindowp = intern ("windowp");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5543 staticpro (&Qwindowp);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5544
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
5545 Qwindow_configuration_p = intern ("window-configuration-p");
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
5546 staticpro (&Qwindow_configuration_p);
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
5547
2210
22d78dbb3cc7 Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents: 2190
diff changeset
5548 Qwindow_live_p = intern ("window-live-p");
22d78dbb3cc7 Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents: 2190
diff changeset
5549 staticpro (&Qwindow_live_p);
1444
559d2f2119aa * window.c: Try to deal coherently with deleted windows:
Jim Blandy <jimb@redhat.com>
parents: 1345
diff changeset
5550
11405
645e3883da72 (temp_output_buffer_show): Select the chosen window
Richard M. Stallman <rms@gnu.org>
parents: 11307
diff changeset
5551 Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook");
10461
d3dee0c530d6 (Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 10373
diff changeset
5552 staticpro (&Qtemp_buffer_show_hook);
d3dee0c530d6 (Qtemp_buffer_show_hook): New hook.
Richard M. Stallman <rms@gnu.org>
parents: 10373
diff changeset
5553
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5554 staticpro (&Vwindow_list);
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5555
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5556 DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5557 "Non-nil means call as function to display a help buffer.\n\
9696
20d9e38be33f (Vtemp_buffer_show_function): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 9624
diff changeset
5558 The function is called with one argument, the buffer to be displayed.\n\
11731
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
5559 Used by `with-output-to-temp-buffer'.\n\
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
5560 If this function is used, then it must do the entire job of showing\n\
b8d3aea195cd (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11427
diff changeset
5561 the buffer; `temp-buffer-show-hook' is not run unless this function runs it.");
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5562 Vtemp_buffer_show_function = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5563
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5564 DEFVAR_LISP ("display-buffer-function", &Vdisplay_buffer_function,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5565 "If non-nil, function to call to handle `display-buffer'.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5566 It will receive two args, the buffer and a flag which if non-nil means\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5567 that the currently selected window is not acceptable.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5568 Commands such as `switch-to-buffer-other-window' and `find-file-other-window'\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5569 work using this function.");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5570 Vdisplay_buffer_function = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5571
34261
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
5572 DEFVAR_LISP ("even-window-heights", &Veven_window_heights,
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
5573 "*If non-nil, `display-buffer' should even the window heights.\n\
34265
a8510beb9c9f (syms_of_window): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 34261
diff changeset
5574 If nil, `display-buffer' will leave the window configuration alone.");
34261
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
5575 Veven_window_heights = Qt;
c50a8c8171b7 (Veven_window_heights): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 34097
diff changeset
5576
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5577 DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5578 "Non-nil means it is the window that C-M-v in minibuffer should scroll.");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5579 Vminibuf_scroll_window = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5580
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5581 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5582 "If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window.");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5583 Vother_window_scroll_buffer = Qnil;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5584
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5585 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames,
780
b3b1e7d8b8aa entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 769
diff changeset
5586 "*Non-nil means `display-buffer' should make a separate frame.");
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5587 pop_up_frames = 0;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5588
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
5589 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames,
30777
3e4912d77e89 Fix embedded comment.
Dave Love <fx@gnu.org>
parents: 30743
diff changeset
5590 "*Non-nil means `display-buffer' should reuse frames.\n\
30560
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
5591 If the buffer in question is already displayed in a frame, raise that frame.");
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
5592 display_buffer_reuse_frames = 0;
e4ba830b426d (display_buffer_reuse_frames): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 30446
diff changeset
5593
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5594 DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function,
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5595 "Function to call to handle automatic new frame creation.\n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5596 It is called with no arguments and should return a newly created frame.\n\
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5597 \n\
769
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5598 A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5599 where `pop-up-frame-alist' would hold the default frame parameters.");
1f320a0729f8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
5600 Vpop_up_frame_function = Qnil;
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5601
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5602 DEFVAR_LISP ("special-display-buffer-names", &Vspecial_display_buffer_names,
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5603 "*List of buffer names that should have their own special frames.\n\
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5604 Displaying a buffer whose name is in this list makes a special frame for it\n\
16338
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5605 using `special-display-function'. See also `special-display-regexps'.\n\
10808
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
5606 \n\
16338
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5607 An element of the list can be a list instead of just a string.\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5608 There are two ways to use a list as an element:\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5609 (BUFFER FRAME-PARAMETERS...) (BUFFER FUNCTION OTHER-ARGS...)\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5610 In the first case, FRAME-PARAMETERS are used to create the frame.\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5611 In the latter case, FUNCTION is called with BUFFER as the first argument,\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5612 followed by OTHER-ARGS--it can display BUFFER in any way it likes.\n\
19667
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5613 All this is done by the function found in `special-display-function'.\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5614 \n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5615 If this variable appears \"not to work\", because you add a name to it\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5616 but that buffer still appears in the selected window, look at the\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5617 values of `same-window-buffer-names' and `same-window-regexps'.\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5618 Those variables take precedence over this one.");
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5619 Vspecial_display_buffer_names = Qnil;
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5620
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5621 DEFVAR_LISP ("special-display-regexps", &Vspecial_display_regexps,
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5622 "*List of regexps saying which buffers should have their own special frames.\n\
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5623 If a buffer name matches one of these regexps, it gets its own frame.\n\
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5624 Displaying a buffer whose name is in this list makes a special frame for it\n\
8991
2a9359b721da (display-buffer, special-display-buffer-names)
Richard M. Stallman <rms@gnu.org>
parents: 8944
diff changeset
5625 using `special-display-function'.\n\
10808
64fcde7a1438 (window_loop): Handle special display buffer frames
Richard M. Stallman <rms@gnu.org>
parents: 10666
diff changeset
5626 \n\
16338
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5627 An element of the list can be a list instead of just a string.\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5628 There are two ways to use a list as an element:\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5629 (REGEXP FRAME-PARAMETERS...) (REGEXP FUNCTION OTHER-ARGS...)\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5630 In the first case, FRAME-PARAMETERS are used to create the frame.\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5631 In the latter case, FUNCTION is called with the buffer as first argument,\n\
c39e44468b7a (syms_of_window): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 16297
diff changeset
5632 followed by OTHER-ARGS--it can display the buffer in any way it likes.\n\
19667
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5633 All this is done by the function found in `special-display-function'.\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5634 \n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5635 If this variable appears \"not to work\", because you add a regexp to it\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5636 but the matching buffers still appear in the selected window, look at the\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5637 values of `same-window-buffer-names' and `same-window-regexps'.\n\
0651874195c7 (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18900
diff changeset
5638 Those variables take precedence over this one.");
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5639 Vspecial_display_regexps = Qnil;
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5640
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5641 DEFVAR_LISP ("special-display-function", &Vspecial_display_function,
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5642 "Function to call to make a new frame for a special buffer.\n\
8991
2a9359b721da (display-buffer, special-display-buffer-names)
Richard M. Stallman <rms@gnu.org>
parents: 8944
diff changeset
5643 It is called with two arguments, the buffer and optional buffer specific\n\
2a9359b721da (display-buffer, special-display-buffer-names)
Richard M. Stallman <rms@gnu.org>
parents: 8944
diff changeset
5644 data, and should return a window displaying that buffer.\n\
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5645 The default value makes a separate frame for the buffer,\n\
9114
9853955949cf (syms_of_window): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 9105
diff changeset
5646 using `special-display-frame-alist' to specify the frame parameters.\n\
7056
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5647 \n\
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5648 A buffer is special if its is listed in `special-display-buffer-names'\n\
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5649 or matches a regexp in `special-display-regexps'.");
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5650 Vspecial_display_function = Qnil;
0a18af7eb587 Implement special frames for specified buffers.
Richard M. Stallman <rms@gnu.org>
parents: 6982
diff changeset
5651
10958
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5652 DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names,
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5653 "*List of buffer names that should appear in the selected window.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5654 Displaying one of these buffers using `display-buffer' or `pop-to-buffer'\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5655 switches to it in the selected window, rather than making it appear\n\
11088
e88e9a016cfa (syms_of_window): Fix missing \n\.
Karl Heuer <kwzh@gnu.org>
parents: 11003
diff changeset
5656 in some other window.\n\
10958
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5657 \n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5658 An element of the list can be a cons cell instead of just a string.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5659 Then the car must be a string, which specifies the buffer name.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5660 This is for compatibility with `special-display-buffer-names';\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5661 the cdr of the cons cell is ignored.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5662 \n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5663 See also `same-window-regexps'.");
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5664 Vsame_window_buffer_names = Qnil;
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5665
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5666 DEFVAR_LISP ("same-window-regexps", &Vsame_window_regexps,
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5667 "*List of regexps saying which buffers should appear in the selected window.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5668 If a buffer name matches one of these regexps, then displaying it\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5669 using `display-buffer' or `pop-to-buffer' switches to it\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5670 in the selected window, rather than making it appear in some other window.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5671 \n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5672 An element of the list can be a cons cell instead of just a string.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5673 Then the car must be a string, which specifies the buffer name.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5674 This is for compatibility with `special-display-buffer-names';\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5675 the cdr of the cons cell is ignored.\n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5676 \n\
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5677 See also `same-window-buffer-names'.");
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5678 Vsame_window_regexps = Qnil;
c0d821d95739 (Vsame_window_buffer_names, Vsame_window_regexps): New vars.
Richard M. Stallman <rms@gnu.org>
parents: 10808
diff changeset
5679
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5680 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5681 "*Non-nil means display-buffer should make new windows.");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5682 pop_up_windows = 1;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5683
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5684 DEFVAR_INT ("next-screen-context-lines", &next_screen_context_lines,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5685 "*Number of lines of continuity when scrolling by screenfuls.");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5686 next_screen_context_lines = 2;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5687
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5688 DEFVAR_INT ("split-height-threshold", &split_height_threshold,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5689 "*display-buffer would prefer to split the largest window if this large.\n\
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5690 If there is only one window, it is split regardless of this value.");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5691 split_height_threshold = 500;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5692
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5693 DEFVAR_INT ("window-min-height", &window_min_height,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5694 "*Delete any window less than this tall (including its mode line).");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5695 window_min_height = 4;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5696
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5697 DEFVAR_INT ("window-min-width", &window_min_width,
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5698 "*Delete any window less than this wide.");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5699 window_min_width = 10;
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5700
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5701 DEFVAR_LISP ("scroll-preserve-screen-position",
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5702 &Vscroll_preserve_screen_position,
16980
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
5703 "*Nonzero means scroll commands move point to keep its screen line unchanged.");
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5704 Vscroll_preserve_screen_position = Qnil;
16980
3da3a2934be5 (scroll_preserve_screen_position): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16751
diff changeset
5705
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5706 DEFVAR_LISP ("window-configuration-change-hook",
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5707 &Vwindow_configuration_change_hook,
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5708 "Functions to call when window configuration changes.\n\
20090
a364e9970764 (syms_of_window): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 20066
diff changeset
5709 The selected frame is the one whose configuration has changed.");
17281
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5710 Vwindow_configuration_change_hook = Qnil;
4f3c71b28278 (Qwindow_configuration_change_hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17226
diff changeset
5711
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5712 defsubr (&Sselected_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5713 defsubr (&Sminibuffer_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5714 defsubr (&Swindow_minibuffer_p);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5715 defsubr (&Swindowp);
2210
22d78dbb3cc7 Rename `live-window-p' to `window-live-p', for consistency with
Jim Blandy <jimb@redhat.com>
parents: 2190
diff changeset
5716 defsubr (&Swindow_live_p);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5717 defsubr (&Spos_visible_in_window_p);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5718 defsubr (&Swindow_buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5719 defsubr (&Swindow_height);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5720 defsubr (&Swindow_width);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5721 defsubr (&Swindow_hscroll);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5722 defsubr (&Sset_window_hscroll);
13457
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
5723 defsubr (&Swindow_redisplay_end_trigger);
8a1986b2cc76 (Fwindow_redisplay_end_trigger): New function.
Richard M. Stallman <rms@gnu.org>
parents: 13418
diff changeset
5724 defsubr (&Sset_window_redisplay_end_trigger);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5725 defsubr (&Swindow_edges);
432
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
5726 defsubr (&Scoordinates_in_window_p);
4d44159f7481 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 362
diff changeset
5727 defsubr (&Swindow_at);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5728 defsubr (&Swindow_point);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5729 defsubr (&Swindow_start);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5730 defsubr (&Swindow_end);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5731 defsubr (&Sset_window_point);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5732 defsubr (&Sset_window_start);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5733 defsubr (&Swindow_dedicated_p);
722
0a2391511b46 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 708
diff changeset
5734 defsubr (&Sset_window_dedicated_p);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5735 defsubr (&Swindow_display_table);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5736 defsubr (&Sset_window_display_table);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5737 defsubr (&Snext_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5738 defsubr (&Sprevious_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5739 defsubr (&Sother_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5740 defsubr (&Sget_lru_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5741 defsubr (&Sget_largest_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5742 defsubr (&Sget_buffer_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5743 defsubr (&Sdelete_other_windows);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5744 defsubr (&Sdelete_windows_on);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5745 defsubr (&Sreplace_buffer_in_windows);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5746 defsubr (&Sdelete_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5747 defsubr (&Sset_window_buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5748 defsubr (&Sselect_window);
16390
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
5749 defsubr (&Sspecial_display_p);
77051008303f (Fspecial_display_p, Fsame_window_p): New functions.
Erik Naggum <erik@naggum.no>
parents: 16338
diff changeset
5750 defsubr (&Ssame_window_p);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5751 defsubr (&Sdisplay_buffer);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5752 defsubr (&Ssplit_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5753 defsubr (&Senlarge_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5754 defsubr (&Sshrink_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5755 defsubr (&Sscroll_up);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5756 defsubr (&Sscroll_down);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5757 defsubr (&Sscroll_left);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5758 defsubr (&Sscroll_right);
8053
60792df5f81f (Fother_window_for_scrolling): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7663
diff changeset
5759 defsubr (&Sother_window_for_scrolling);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5760 defsubr (&Sscroll_other_window);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5761 defsubr (&Srecenter);
34416
0d16962724cb (displayed_window_lines): Handle non-newline-terminated final lines properly.
Miles Bader <miles@gnu.org>
parents: 34409
diff changeset
5762 defsubr (&Swindow_text_height);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5763 defsubr (&Smove_to_window_line);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5764 defsubr (&Swindow_configuration_p);
23410
02cc44ea2455 (window_loop): New alternative CHECK_ALL_WINDOWS.
Richard M. Stallman <rms@gnu.org>
parents: 22923
diff changeset
5765 defsubr (&Swindow_configuration_frame);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5766 defsubr (&Sset_window_configuration);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5767 defsubr (&Scurrent_window_configuration);
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5768 defsubr (&Ssave_window_excursion);
24997
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5769 defsubr (&Sset_window_margins);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5770 defsubr (&Swindow_margins);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5771 defsubr (&Swindow_vscroll);
5e507b813c1d (Fcoordinates_in_window_p): Rewritten.
Gerd Moellmann <gerd@gnu.org>
parents: 24230
diff changeset
5772 defsubr (&Sset_window_vscroll);
21022
52bc6b672a50 (compare_window_configurations): New arg ignore_positions.
Richard M. Stallman <rms@gnu.org>
parents: 20867
diff changeset
5773 defsubr (&Scompare_window_configurations);
30037
79b4fa5288c3 (Vwindow_list): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 29488
diff changeset
5774 defsubr (&Swindow_list);
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5775 }
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5776
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21227
diff changeset
5777 void
265
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5778 keys_of_window ()
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5779 {
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5780 initial_define_key (control_x_map, '1', "delete-other-windows");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5781 initial_define_key (control_x_map, '2', "split-window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5782 initial_define_key (control_x_map, '0', "delete-window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5783 initial_define_key (control_x_map, 'o', "other-window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5784 initial_define_key (control_x_map, '^', "enlarge-window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5785 initial_define_key (control_x_map, '<', "scroll-left");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5786 initial_define_key (control_x_map, '>', "scroll-right");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5787
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5788 initial_define_key (global_map, Ctl ('V'), "scroll-up");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5789 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5790 initial_define_key (meta_map, 'v', "scroll-down");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5791
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5792 initial_define_key (global_map, Ctl('L'), "recenter");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5793 initial_define_key (meta_map, 'r', "move-to-window-line");
8df170a4c9d1 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5794 }