aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2011-11-07 10:03:00 +0100
committerJoakim Verona2011-11-07 10:03:00 +0100
commitc649990b73768c7a024e111d8c63246030647b53 (patch)
treee5b47169dfc679b53fed30bbd66e2df98de2f02c
parentc823c667cd00b9d8036ce06b943f58f3f4efd7d9 (diff)
parentca78dc431fff3bc2a4f33f2a0fc1449608568d23 (diff)
downloademacs-c649990b73768c7a024e111d8c63246030647b53.tar.gz
emacs-c649990b73768c7a024e111d8c63246030647b53.zip
upstream
-rw-r--r--ChangeLog10
-rwxr-xr-xautogen/configure14
-rw-r--r--configure.in4
-rw-r--r--doc/emacs/ChangeLog17
-rw-r--r--doc/emacs/custom.texi2
-rw-r--r--doc/emacs/search.texi11
-rw-r--r--doc/emacs/windows.texi288
-rw-r--r--doc/lispref/ChangeLog10
-rw-r--r--doc/lispref/windows.texi445
-rw-r--r--etc/NEWS21
-rw-r--r--lib/makefile.w32-in4
-rw-r--r--lisp/ChangeLog39
-rw-r--r--lisp/mail/rmail.el30
-rw-r--r--lisp/window.el152
-rw-r--r--nt/ChangeLog37
-rw-r--r--nt/INSTALL42
-rw-r--r--nt/config.nt9
-rw-r--r--nt/gmake.defs5
-rw-r--r--nt/inc/stdint.h26
-rw-r--r--nt/makefile.w32-in24
-rw-r--r--nt/nmake.defs28
-rw-r--r--nt/runemacs.c44
-rw-r--r--src/ChangeLog160
-rw-r--r--src/alloc.c7
-rw-r--r--src/callproc.c1
-rw-r--r--src/coding.c2
-rw-r--r--src/dispextern.h16
-rw-r--r--src/gtkutil.c10
-rw-r--r--src/intervals.c22
-rw-r--r--src/keyboard.c8
-rw-r--r--src/lisp.h56
-rw-r--r--src/makefile.w32-in10
-rw-r--r--src/nsfns.m208
-rw-r--r--src/nsterm.m21
-rw-r--r--src/process.c1
-rw-r--r--src/regex.c4
-rw-r--r--src/s/ms-w32.h24
-rw-r--r--src/w32.c7
-rw-r--r--src/w32fns.c24
-rw-r--r--src/w32font.c27
-rw-r--r--src/w32term.c16
-rw-r--r--src/window.c129
-rw-r--r--src/xdisp.c29
-rw-r--r--src/xfns.c35
-rw-r--r--src/xmenu.c31
45 files changed, 1284 insertions, 826 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d8f5758afa..68f5042d7cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
12011-11-05 Eli Zaretskii <eliz@gnu.org>
2
3 * lib/makefile.w32-in (FRC): New dummy target.
4 (TAGS): Depend on FRC.
5
62011-11-04 Glenn Morris <rgm@gnu.org>
7
8 * configure.in: Increase minimum GnuTLS version to 2.6.6. (Bug#9929)
9 Do not include GnuTLS version info in final summary message.
10
12011-10-31 Eli Zaretskii <eliz@gnu.org> 112011-10-31 Eli Zaretskii <eliz@gnu.org>
2 12
3 * config.bat: Use config.in and Makefile.in from src/ and lib/, if 13 * config.bat: Use config.in and Makefile.in from src/ and lib/, if
diff --git a/autogen/configure b/autogen/configure
index b265133759e..b22541d8b22 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -11830,23 +11830,23 @@ fi
11830 else 11830 else
11831 PKG_CONFIG_MIN_VERSION=0.9.0 11831 PKG_CONFIG_MIN_VERSION=0.9.0
11832 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then 11832 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
11833 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls >= 2.6.0" >&5 11833 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls >= 2.6.6" >&5
11834$as_echo_n "checking for gnutls >= 2.6.0... " >&6; } 11834$as_echo_n "checking for gnutls >= 2.6.6... " >&6; }
11835 11835
11836 if $PKG_CONFIG --exists "gnutls >= 2.6.0" 2>&5; then 11836 if $PKG_CONFIG --exists "gnutls >= 2.6.6" 2>&5; then
11837 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 11837 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
11838$as_echo "yes" >&6; } 11838$as_echo "yes" >&6; }
11839 succeeded=yes 11839 succeeded=yes
11840 11840
11841 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_CFLAGS" >&5 11841 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_CFLAGS" >&5
11842$as_echo_n "checking LIBGNUTLS_CFLAGS... " >&6; } 11842$as_echo_n "checking LIBGNUTLS_CFLAGS... " >&6; }
11843 LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 2.6.0"|sed -e 's,///*,/,g'` 11843 LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 2.6.6"|sed -e 's,///*,/,g'`
11844 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_CFLAGS" >&5 11844 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_CFLAGS" >&5
11845$as_echo "$LIBGNUTLS_CFLAGS" >&6; } 11845$as_echo "$LIBGNUTLS_CFLAGS" >&6; }
11846 11846
11847 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_LIBS" >&5 11847 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_LIBS" >&5
11848$as_echo_n "checking LIBGNUTLS_LIBS... " >&6; } 11848$as_echo_n "checking LIBGNUTLS_LIBS... " >&6; }
11849 LIBGNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 2.6.0"|sed -e 's,///*,/,g'` 11849 LIBGNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 2.6.6"|sed -e 's,///*,/,g'`
11850 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_LIBS" >&5 11850 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_LIBS" >&5
11851$as_echo "$LIBGNUTLS_LIBS" >&6; } 11851$as_echo "$LIBGNUTLS_LIBS" >&6; }
11852 else 11852 else
@@ -11856,7 +11856,7 @@ $as_echo "no" >&6; }
11856 LIBGNUTLS_LIBS="" 11856 LIBGNUTLS_LIBS=""
11857 ## If we have a custom action on failure, don't print errors, but 11857 ## If we have a custom action on failure, don't print errors, but
11858 ## do set a variable so people can do so. 11858 ## do set a variable so people can do so.
11859 LIBGNUTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnutls >= 2.6.0"` 11859 LIBGNUTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnutls >= 2.6.6"`
11860 11860
11861 fi 11861 fi
11862 11862
@@ -24283,7 +24283,7 @@ echo " Does Emacs use -lgpm? ${HAVE_GPM}"
24283echo " Does Emacs use -ldbus? ${HAVE_DBUS}" 24283echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
24284echo " Does Emacs use -lgconf? ${HAVE_GCONF}" 24284echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
24285echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" 24285echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
24286echo " Does Emacs use -lgnutls (2.6.x or higher)? ${HAVE_GNUTLS}" 24286echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
24287echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}" 24287echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
24288 24288
24289echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}" 24289echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
diff --git a/configure.in b/configure.in
index db3e2b7ade1..e301b142fe4 100644
--- a/configure.in
+++ b/configure.in
@@ -2113,7 +2113,7 @@ AC_SUBST(LIBSELINUX_LIBS)
2113HAVE_GNUTLS=no 2113HAVE_GNUTLS=no
2114HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=no 2114HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=no
2115if test "${with_gnutls}" = "yes" ; then 2115if test "${with_gnutls}" = "yes" ; then
2116 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.0], HAVE_GNUTLS=yes, HAVE_GNUTLS=no) 2116 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no)
2117 if test "${HAVE_GNUTLS}" = "yes"; then 2117 if test "${HAVE_GNUTLS}" = "yes"; then
2118 AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.]) 2118 AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
2119 fi 2119 fi
@@ -3770,7 +3770,7 @@ echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
3770echo " Does Emacs use -lgconf? ${HAVE_GCONF}" 3770echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
3771echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}" 3771echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
3772echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" 3772echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
3773echo " Does Emacs use -lgnutls (2.6.x or higher)? ${HAVE_GNUTLS}" 3773echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
3774echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}" 3774echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
3775 3775
3776echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}" 3776echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 9a501d38375..a808a96b444 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,20 @@
12011-11-06 Chong Yidong <cyd@gnu.org>
2
3 * windows.texi (Basic Window): Add xref to Cursor Display.
4 (Split Window): Document negative arg for splitting commands.
5 (Other Window): Document mouse-1 in text area of window.
6 (Change Window): Don't mention window attributes, since they
7 aren't defined. C-x 1 can't be used with minibuffer windows.
8 Windows are no longer auto-deleted.
9 (Window Choice): Add xref to Choosing Window in Lisp manual.
10 (Window Convenience): Note that windmove disables shift-selection.
11 Move M-x compare-windows here from Other Window node.
12
13 * custom.texi (Mouse Buttons):
14 * search.texi (Isearch Scroll):
15 * windows.texi (Split Window): Use new names split-window-below
16 and split-window-right.
17
12011-10-26 Juanma Barranquero <lekktu@gmail.com> 182011-10-26 Juanma Barranquero <lekktu@gmail.com>
2 19
3 * emacs.texi (Top): Fix typo. 20 * emacs.texi (Top): Fix typo.
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index d87c22ec28e..fd680576b4e 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1774,7 +1774,7 @@ button, @code{mouse-2} for the next, and so on. Here is how you can
1774redefine the second mouse button to split the current window: 1774redefine the second mouse button to split the current window:
1775 1775
1776@example 1776@example
1777(global-set-key [mouse-2] 'split-window-vertically) 1777(global-set-key [mouse-2] 'split-window-below)
1778@end example 1778@end example
1779 1779
1780 The symbols for drag events are similar, but have the prefix 1780 The symbols for drag events are similar, but have the prefix
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index a8bd1cdf18d..0b68373d47c 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -328,12 +328,11 @@ prefix arguments to these commands in the usual way. This feature
328won't let you scroll the current match out of visibility, however. 328won't let you scroll the current match out of visibility, however.
329 329
330 The @code{isearch-allow-scroll} feature also affects some other 330 The @code{isearch-allow-scroll} feature also affects some other
331commands, such as @kbd{C-x 2} (@code{split-window-vertically}) and 331commands, such as @kbd{C-x 2} (@code{split-window-below}) and @kbd{C-x
332@kbd{C-x ^} (@code{enlarge-window}), which don't exactly scroll but do 332^} (@code{enlarge-window}), which don't exactly scroll but do affect
333affect where the text appears on the screen. It applies to any 333where the text appears on the screen. It applies to any command whose
334command whose name has a non-@code{nil} @code{isearch-scroll} 334name has a non-@code{nil} @code{isearch-scroll} property. So you can
335property. So you can control which commands are affected by changing 335control which commands are affected by changing these properties.
336these properties.
337 336
338 For example, to make @kbd{C-h l} usable within an incremental search 337 For example, to make @kbd{C-h l} usable within an incremental search
339in all future Emacs sessions, use @kbd{C-h c} to find what command it 338in all future Emacs sessions, use @kbd{C-h c} to find what command it
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 600d0b07818..ad2040c9047 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -34,24 +34,22 @@ has its own value of point.
34 34
35@cindex selected window 35@cindex selected window
36 At any time, one Emacs window is the @dfn{selected window}; the 36 At any time, one Emacs window is the @dfn{selected window}; the
37buffer this window is displaying is the current buffer. The terminal's 37buffer this window is displaying is the current buffer. Each window
38cursor shows the location of point in this window. Each other window 38has its own value of point. On graphical displays, the point is
39has a location of point as well. On text-only terminals, there is no 39indicated by a solid blinking cursor in the selected window, and by a
40way to show where those locations are, since the terminal has only one 40hollow box in non-selected windows. On text-only terminals, the
41cursor. On a graphical display, the location of point in a 41cursor is drawn only in the selected window. @xref{Cursor Display}.
42non-selected window is indicated by a hollow box; the cursor in the 42
43selected window is blinking or solid. 43 Commands to move point affect the value of point for the selected
44 44Emacs window only. They do not change the value of point in other
45 Commands to move point affect the value of point for the selected Emacs 45Emacs windows, even those showing the same buffer. The same is true
46window only. They do not change the value of point in other Emacs 46for buffer-switching commands such as @kbd{C-x b}; they do not affect
47windows, even those showing the same buffer. The same is true for commands 47other windows at all. However, there are other commands such as
48such as @kbd{C-x b} to switch buffers in the selected window; 48@kbd{C-x 4 b} that select a different window and switch buffers in it.
49they do not affect other windows at all. However, there are other commands 49Also, all commands that display information in a window, including
50such as @kbd{C-x 4 b} that select a different window and switch buffers in
51it. Also, all commands that display information in a window, including
52(for example) @kbd{C-h f} (@code{describe-function}) and @kbd{C-x C-b} 50(for example) @kbd{C-h f} (@code{describe-function}) and @kbd{C-x C-b}
53(@code{list-buffers}), work by switching buffers in a nonselected window 51(@code{list-buffers}), work by switching buffers in a nonselected
54without affecting the selected window. 52window without affecting the selected window.
55 53
56 When multiple windows show the same buffer, they can have different 54 When multiple windows show the same buffer, they can have different
57regions, because they can have different values of point. However, 55regions, because they can have different values of point. However,
@@ -61,7 +59,7 @@ only one mark position.
61 Each window has its own mode line, which displays the buffer name, 59 Each window has its own mode line, which displays the buffer name,
62modification status and major and minor modes of the buffer that is 60modification status and major and minor modes of the buffer that is
63displayed in the window. The selected window's mode line appears in a 61displayed in the window. The selected window's mode line appears in a
64different color. @xref{Mode Line}, for full details on the mode line. 62different color. @xref{Mode Line}, for details.
65 63
66@node Split Window 64@node Split Window
67@section Splitting Windows 65@section Splitting Windows
@@ -69,91 +67,87 @@ different color. @xref{Mode Line}, for full details on the mode line.
69@table @kbd 67@table @kbd
70@item C-x 2 68@item C-x 2
71Split the selected window into two windows, one above the other 69Split the selected window into two windows, one above the other
72(@code{split-window-vertically}). 70(@code{split-window-below}).
73@item C-x 3 71@item C-x 3
74Split the selected window into two windows positioned side by side 72Split the selected window into two windows, positioned side by side
75(@code{split-window-horizontally}). 73(@code{split-window-right}).
76@item C-Mouse-2 74@item C-Mouse-2
77In the mode line or scroll bar of a window, split that window. 75In the mode line or scroll bar of a window, split that window.
78@end table 76@end table
79 77
80@kindex C-x 2 78@kindex C-x 2
81@findex split-window-vertically 79@findex split-window-below
82 The command @kbd{C-x 2} (@code{split-window-vertically}) breaks the 80 @kbd{C-x 2} (@code{split-window-below}) splits the selected window
83selected window into two windows, one above the other. Both windows start 81into two windows, one above the other. After splitting, the selected
84out displaying the same buffer, with the same value of point. By default 82window is the upper one, and the newly split-off window is below.
85the two windows each get half the height of the window that was split; a 83Both windows have the same value of point as before, and display the
86numeric argument specifies how many lines to give to the top window. 84same portion of the buffer (or as close to it as possible). If
85necessary, the windows are scrolled to keep point on-screen. By
86default, the two windows each get half the height of the original
87window. A positive numeric argument specifies how many lines to give
88to the top window; a negative numeric argument specifies how many
89lines to give to the bottom window.
87 90
88@kindex C-x 3 91@vindex split-window-keep-point
89@findex split-window-horizontally 92 If you change the variable @code{split-window-keep-point} to
90 @kbd{C-x 3} (@code{split-window-horizontally}) breaks the selected 93@code{nil}, @kbd{C-x 2} instead adjusts the portion of the buffer
91window into two side-by-side windows. A numeric argument specifies how 94displayed by the two windows, as well as the value of point in each
92many columns to give the one on the left. If you are not using 95window, in order to keep the text on the screen as close as possible
93scrollbars, a vertical line separates the two windows. 96to what it was before; furthermore, if point was in the lower half of
94You can customize its color with the face @code{vertical-border}. 97the original window, the bottom window is selected instead of the
95Windows that are not the full width of the screen have mode lines, but 98upper one.
96they are truncated. On terminals where Emacs does not support
97highlighting, truncated mode lines sometimes do not appear in inverse
98video.
99 99
100@kindex C-Mouse-2 @r{(scroll bar)} 100@kindex C-x 3
101 You can split a window horizontally or vertically by clicking 101@findex split-window-right
102@kbd{C-Mouse-2} in the mode line or the scroll bar. The line of 102 @kbd{C-x 3} (@code{split-window-right}) splits the selected window
103splitting goes through the place where you click: if you click on the 103into two side-by-side windows. The left window is the selected one;
104mode line, the new scroll bar goes above the spot; if you click in the 104the right window displays the same portion of the same buffer, and has
105scroll bar, the mode line of the split window is side by side with 105the same value of point. A positive numeric argument specifies how
106your click. 106many columns to give the left window; a negative numeric argument
107specifies how many columns to give the right window.
107 108
108@vindex truncate-partial-width-windows 109@vindex truncate-partial-width-windows
109 When a window occupies less than the full width of the frame, it may 110 When you split a window with @kbd{C-x 3}, each resulting window
110become too narrow for most of the text lines in its buffer. If most of 111occupies less than the full width of the frame. If it becomes too
111its lines are continued (@pxref{Continuation Lines}), the buffer may 112narrow, the buffer may be difficult to read if continuation lines are
112become difficult to read. Therefore, Emacs automatically truncates 113in use (@pxref{Continuation Lines}). Therefore, Emacs automatically
113lines if the window width becomes narrower than 50 columns. This 114switches to line truncation if the window width becomes narrower than
114truncation occurs regardless of the value of the variable 11550 columns. This truncation occurs regardless of the value of the
115@code{truncate-lines} (@pxref{Line Truncation}); it is instead 116variable @code{truncate-lines} (@pxref{Line Truncation}); it is
116controlled by the variable @code{truncate-partial-width-windows}. If 117instead controlled by the variable
117the value of @code{truncate-partial-width-windows} is a positive integer 118@code{truncate-partial-width-windows}. If the value of this variable
118(the default is 50), that specifies the minimum width for a 119is a positive integer (the default is 50), that specifies the minimum
119partial-width window before automatic line truncation occurs; if the 120width for a partial-width window before automatic line truncation
120value is @code{nil}, automatic line truncation is disabled; and for any 121occurs; if the value is @code{nil}, automatic line truncation is
121other non-@code{nil} value, Emacs truncates lines in every partial-width 122disabled; and for any other non-@code{nil} value, Emacs truncates
122window regardless of its width. 123lines in every partial-width window regardless of its width.
123 124
124 Horizontal scrolling is often used in side-by-side windows. 125 On text terminals, side-by-side windows are separated by a vertical
125@xref{Horizontal Scrolling}. 126divider which is drawn using the @code{vertical-border} face.
126 127
127@vindex split-window-keep-point 128@kindex C-Mouse-2 @r{(scroll bar)}
128 If @code{split-window-keep-point} is non-@code{nil}, the default, 129 You can also split a window horizontally or vertically by clicking
129both of the windows resulting from @kbd{C-x 2} inherit the value of 130@kbd{C-Mouse-2} in the mode line or the scroll bar. If you click on
130point from the window that was split. This means that scrolling is 131the mode line, that puts the vertical divider where you click; if you
131inevitable. If this variable is @code{nil}, then @kbd{C-x 2} tries to 132click in the scroll bar, that puts the new mode-line where you click.
132avoid scrolling the text currently visible on the screen, by putting
133point in each window at a position already visible in the window. It
134also selects whichever window contains the screen line that the cursor
135was previously on. Some users prefer that mode on slow terminals.
136 133
137@node Other Window 134@node Other Window
138@section Using Other Windows 135@section Using Other Windows
139 136
140@table @kbd 137@table @kbd
141@item C-x o 138@item C-x o
142Select another window (@code{other-window}). That is @kbd{o}, not zero. 139Select another window (@code{other-window}).
143@item C-M-v 140@item C-M-v
144Scroll the next window (@code{scroll-other-window}). 141Scroll the next window (@code{scroll-other-window}).
145@item M-x compare-windows
146Find next place where the text in the selected window does not match
147the text in the next window.
148@item Mouse-1 142@item Mouse-1
149@kbd{Mouse-1}, in a window's mode line, selects that window 143@kbd{Mouse-1}, in the text area of a window, selects the window and
150but does not move point in it (@code{mouse-select-window}). 144moves point to the position clicked. Clicking in the mode line
145selects the window without moving point in it.
151@end table 146@end table
152 147
153@kindex C-x o 148@kindex C-x o
154@findex other-window 149@findex other-window
155 To select a different window, click with @kbd{Mouse-1} on its mode 150With the keyboard, you can switch windows by typing @kbd{C-x o}
156line. With the keyboard, you can switch windows by typing @kbd{C-x o}
157(@code{other-window}). That is an @kbd{o}, for ``other,'' not a zero. 151(@code{other-window}). That is an @kbd{o}, for ``other,'' not a zero.
158When there are more than two windows, this command moves through all the 152When there are more than two windows, this command moves through all the
159windows in a cyclic order, generally top to bottom and left to right. 153windows in a cyclic order, generally top to bottom and left to right.
@@ -172,17 +166,13 @@ finish supplying the minibuffer argument that is requested.
172window only, but there is one command to scroll the next window. 166window only, but there is one command to scroll the next window.
173@kbd{C-M-v} (@code{scroll-other-window}) scrolls the window that 167@kbd{C-M-v} (@code{scroll-other-window}) scrolls the window that
174@kbd{C-x o} would select. It takes arguments, positive and negative, 168@kbd{C-x o} would select. It takes arguments, positive and negative,
175like @kbd{C-v}. (In the minibuffer, @kbd{C-M-v} scrolls the window 169like @kbd{C-v}. (In the minibuffer, @kbd{C-M-v} scrolls the help
176that contains the minibuffer help display, if any, rather than the 170window associated with the minibuffer, if any, rather than the next
177next window in the standard cyclic order.) 171window in the standard cyclic order; @pxref{Minibuffer Edit}.)
178
179 The command @kbd{M-x compare-windows} lets you compare two files or
180buffers visible in two windows, by moving through them to the next
181mismatch. @xref{Comparing Files}, for details.
182 172
183@vindex mouse-autoselect-window 173@vindex mouse-autoselect-window
184 If you set @code{mouse-autoselect-window} to a non-@code{nil} value, 174 If you set @code{mouse-autoselect-window} to a non-@code{nil} value,
185moving the mouse into a different window selects that window. This 175moving the mouse over a different window selects that window. This
186feature is off by default. 176feature is off by default.
187 177
188@node Pop Up Window 178@node Pop Up Window
@@ -236,8 +226,7 @@ window (@code{find-file-read-only-other-window}). @xref{Visiting}.
236 226
237@table @kbd 227@table @kbd
238@item C-x 0 228@item C-x 0
239Delete the selected window (@code{delete-window}). The last character 229Delete the selected window (@code{delete-window}).
240in this key sequence is a zero.
241@item C-x 1 230@item C-x 1
242Delete all windows in the selected frame except the selected window 231Delete all windows in the selected frame except the selected window
243(@code{delete-other-windows}). 232(@code{delete-other-windows}).
@@ -260,14 +249,12 @@ Make all windows the same height (@code{balance-windows}).
260 249
261@kindex C-x 0 250@kindex C-x 0
262@findex delete-window 251@findex delete-window
263 To delete a window, type @kbd{C-x 0} (@code{delete-window}). (That is 252 To delete the selected window, type @kbd{C-x 0}
264a zero.) The space occupied by the deleted window is given to an 253(@code{delete-window}). (That is a zero.) Once a window is deleted,
265adjacent window (but not the minibuffer window, even if that is active 254the space that it occupied is given to an adjacent window (but not the
266at the time). Once a window is deleted, its attributes are forgotten; 255minibuffer window, even if that is active at the time). Deleting the
267only restoring a window configuration can bring it back. Deleting the
268window has no effect on the buffer it used to display; the buffer 256window has no effect on the buffer it used to display; the buffer
269continues to exist, and you can select it in any window with @kbd{C-x 257continues to exist, and you can still switch to with @kbd{C-x b}.
270b}.
271 258
272@findex kill-buffer-and-window 259@findex kill-buffer-and-window
273@kindex C-x 4 0 260@kindex C-x 4 0
@@ -277,31 +264,35 @@ selected window.
277 264
278@kindex C-x 1 265@kindex C-x 1
279@findex delete-other-windows 266@findex delete-other-windows
280 @kbd{C-x 1} (@code{delete-other-windows}) is more powerful in a 267 @kbd{C-x 1} (@code{delete-other-windows}) deletes all the windows,
281different way; it deletes all the windows except the selected one (and 268@emph{except} the selected one; the selected window expands to use the
282the minibuffer); the selected window expands to use the whole frame 269whole frame. (This command cannot be used while the minibuffer window
283except for the echo area. 270is active; attempting to do so signals an error.)
284 271
285@kindex C-x ^ 272@kindex C-x ^
286@findex enlarge-window 273@findex enlarge-window
287@kindex C-x @} 274@kindex C-x @}
288@findex enlarge-window-horizontally
289@vindex window-min-height 275@vindex window-min-height
276 The command @kbd{C-x ^} (@code{enlarge-window}) makes the selected
277window one line taller, taking space from a vertically adjacent window
278without changing the height of the frame. With a positive numeric
279argument, this command increases the window height by that many lines;
280with a negative argument, it reduces the height by that many lines.
281If there are no vertically adjacent windows (i.e. the window is at the
282full frame height), that signals an error. The command also signals
283an error if you attempt to reduce the height of any window below a
284certain minimum number of lines, specified by the variable
285@code{window-min-height} (the default is 4).
286
287@findex enlarge-window-horizontally
288@findex shrink-window-horizontally
290@vindex window-min-width 289@vindex window-min-width
291 To readjust the division of space among vertically adjacent windows, 290 Similarly, @kbd{C-x @}} (@code{enlarge-window-horizontally}) makes
292use @kbd{C-x ^} (@code{enlarge-window}). It makes the currently 291the selected window wider, and @kbd{C-x @{}
293selected window one line bigger, or as many lines as is specified 292(@code{shrink-window-horizontally}) makes it narrower. These commands
294with a numeric argument. With a negative argument, it makes the 293signal an error if you attempt to reduce the width of any window below
295selected window smaller. @kbd{C-x @}} 294a certain minimum number of columns, specified by the variable
296(@code{enlarge-window-horizontally}) makes the selected window wider by 295@code{window-min-width} (the default is 10).
297the specified number of columns. @kbd{C-x @{}
298(@code{shrink-window-horizontally}) makes the selected window narrower
299by the specified number of columns.
300
301 When you make a window bigger, the space comes from its peers. If
302this makes any window too small, it is deleted and its space is given
303to an adjacent window. The minimum size is specified by the variables
304@code{window-min-height} and @code{window-min-width}.
305 296
306@kindex C-x - 297@kindex C-x -
307@findex shrink-window-if-larger-than-buffer 298@findex shrink-window-if-larger-than-buffer
@@ -322,7 +313,7 @@ heights and to delete windows. @xref{Mode Line Mouse}.
322@section Displaying a Buffer in a Window 313@section Displaying a Buffer in a Window
323 314
324 It is a common Emacs operation to display or ``pop up'' some buffer 315 It is a common Emacs operation to display or ``pop up'' some buffer
325in response to a user command. There are several different ways by 316in response to a user command. There are several different ways in
326which commands do this. 317which commands do this.
327 318
328 Many commands, like @kbd{C-x C-f} (@code{find-file}), display the 319 Many commands, like @kbd{C-x C-f} (@code{find-file}), display the
@@ -333,18 +324,18 @@ usually work by calling @code{switch-to-buffer} internally
333 324
334@findex display-buffer 325@findex display-buffer
335 Some commands try to display ``intelligently'', trying not to take 326 Some commands try to display ``intelligently'', trying not to take
336over the selected window, e.g. by splitting the selected window and 327over the selected window, e.g. by splitting off a new window and
337displaying the desired buffer in the child window. Such commands, 328displaying the desired buffer there. Such commands, which include the
338which include the various help commands (@pxref{Help}), work by 329various help commands (@pxref{Help}), work by calling
339calling @code{display-buffer} internally. @xref{Window Choice}, for 330@code{display-buffer} internally. @xref{Window Choice}, for details.
340details.
341 331
342 Other commands do the same as @code{display-buffer}, and 332 Other commands do the same as @code{display-buffer}, and
343additionally select the displaying window so that you can begin 333additionally select the displaying window so that you can begin
344editing its buffer. The command @kbd{C-x `} (@code{next-error}) is 334editing its buffer. The command @kbd{C-x `} (@code{next-error}) is
345one example (@pxref{Compilation Mode}). Such commands work by calling 335one example (@pxref{Compilation Mode}). Such commands work by calling
346@code{pop-to-buffer} internally. @xref{Switching Buffers,,Switching 336the function @code{pop-to-buffer} internally. @xref{Switching
347to a Buffer in a Window, elisp, The Emacs Lisp Reference Manual}. 337Buffers,,Switching to a Buffer in a Window, elisp, The Emacs Lisp
338Reference Manual}.
348 339
349 Commands with names ending in @code{-other-window} behave like 340 Commands with names ending in @code{-other-window} behave like
350@code{display-buffer}, except that they never display in the selected 341@code{display-buffer}, except that they never display in the selected
@@ -367,7 +358,10 @@ Several of these commands are bound in the @kbd{C-x 5} prefix key.
367@findex display-buffer 358@findex display-buffer
368 359
369The @code{display-buffer} command (as well as commands that call it 360The @code{display-buffer} command (as well as commands that call it
370internally) chooses a window to display using the following steps: 361internally) chooses a window to display by following the steps given
362below. @xref{Choosing Window,,Choosing a Window for Display, elisp,
363The Emacs Lisp Reference Manual}, for details about how to alter this
364sequence of steps.
371 365
372@itemize 366@itemize
373@vindex same-window-buffer-names 367@vindex same-window-buffer-names
@@ -433,36 +427,38 @@ and display the buffer there.
433@cindex mode, Winner 427@cindex mode, Winner
434@cindex undoing window configuration changes 428@cindex undoing window configuration changes
435@cindex window configuration changes, undoing 429@cindex window configuration changes, undoing
436 @kbd{M-x winner-mode} is a global minor mode that records the 430 Winner mode is a global minor mode that records the changes in the
437changes in the window configuration (i.e. how the frames are 431window configuration (i.e. how the frames are partitioned into
438partitioned into windows), so that you can ``undo'' them. To undo, 432windows), so that you can ``undo'' them. You can toggle Winner mode
439use @kbd{C-c left} (@code{winner-undo}). If you change your mind 433with @kbd{M-x winner-mode}, or by customizing the variable
440while undoing, you can redo the changes you had undone using @kbd{C-c 434@code{winner-mode}. When the mode is enabled, @kbd{C-c left}
441right} (@code{M-x winner-redo}). Another way to enable Winner mode is 435(@code{winner-undo}) undoes the last window configuration change. If
442by customizing the variable @code{winner-mode}. 436you change your mind while undoing, you can redo the changes you had
437undone using @kbd{C-c right} (@code{M-x winner-redo}).
438
439 Follow mode (@kbd{M-x follow-mode}) synchronizes several windows on
440the same buffer so that they always display adjacent sections of that
441buffer. @xref{Follow Mode}.
443 442
444@cindex Windmove package 443@cindex Windmove package
445@cindex directional window selection 444@cindex directional window selection
446@findex windmove-right 445@findex windmove-right
447@findex windmove-default-keybindings 446@findex windmove-default-keybindings
448 The Windmove commands move directionally between neighboring windows in 447 The Windmove package defines commands for moving directionally
449a frame. @kbd{M-x windmove-right} selects the window immediately to the 448between neighboring windows in a frame. @kbd{M-x windmove-right}
450right of the currently selected one, and similarly for the ``left,'' ``up,'' 449selects the window immediately to the right of the currently selected
451and ``down'' counterparts. @kbd{M-x windmove-default-keybindings} binds 450one, and similarly for the ``left,'' ``up,'' and ``down''
452these commands to @kbd{S-right} etc. (Not all terminals support shifted 451counterparts. @kbd{M-x windmove-default-keybindings} binds these
453arrow keys, however.) 452commands to @kbd{S-right} etc.; doing so disables shift selection for
453those keys (@pxref{Shift Selection}).
454 454
455 Follow minor mode (@kbd{M-x follow-mode}) synchronizes several 455 The command @kbd{M-x compare-windows} lets you compare the text
456windows on the same buffer so that they always display adjacent 456shown in different windows. @xref{Comparing Files}.
457sections of that buffer. @xref{Follow Mode}.
458 457
459@vindex scroll-all-mode 458@vindex scroll-all-mode
460@cindex scrolling windows together 459@cindex scrolling windows together
461@cindex Scroll-all mode 460@cindex Scroll-all mode
462@cindex mode, Scroll-all 461@cindex mode, Scroll-all
463 @kbd{M-x scroll-all-mode} provides commands to scroll all visible 462 Scroll All mode (@kbd{M-x scroll-all-mode}) is a global minor mode
464windows together. You can also turn it on by customizing the variable 463that causes scrolling commands and point motion commands to apply to
465@code{scroll-all-mode}. The commands provided are @kbd{M-x 464every single window.
466scroll-all-scroll-down-all}, @kbd{M-x scroll-all-page-down-all} and
467their corresponding ``up'' equivalents. To make this mode useful,
468you should bind these commands to appropriate keys.
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 2da562bdcfb..1a692c6b36d 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,13 @@
12011-11-06 Chong Yidong <cyd@gnu.org>
2
3 * windows.texi (Basic Windows): Clarify various definitions.
4 Treat window-normalize-* as internal; don't document them.
5 (Windows and Frames): Various clarifications, e.g. non-live
6 windows also belong to frames. Fix window-list description.
7 Simplify window nesting example.
8 (Splitting Windows, Window Configurations): Use
9 split-window-below.
10
12011-11-04 Eli Zaretskii <eliz@gnu.org> 112011-11-04 Eli Zaretskii <eliz@gnu.org>
2 12
3 * windows.texi (Window Sizes): Mention in the doc string that the 13 * windows.texi (Window Sizes): Mention in the doc string that the
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index bd20f5d8f44..8b466e02214 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -50,216 +50,188 @@ is displayed in windows.
50@section Basic Concepts of Emacs Windows 50@section Basic Concepts of Emacs Windows
51@cindex window 51@cindex window
52 52
53A @dfn{window} in Emacs is the physical area of the screen in which a 53A @dfn{window} is a area of the screen which is used to display a
54buffer is displayed, see @ref{Buffers}. The term is also used to refer 54buffer (@pxref{Buffers}). In Emacs Lisp, windows are represented by a
55to a Lisp object that represents that screen area in Emacs Lisp. It 55special Lisp object type.
56should be clear from the context which is meant.
57 56
58@cindex multiple windows 57@cindex multiple windows
59 Emacs groups windows into frames; see @ref{Frames}. Each frame always 58 Windows are grouped into frames (@pxref{Frames}). Each frame
60contains at least one window, but you can subdivide it into multiple, 59contains at least one window; the user can subdivide it into multiple,
61non-overlapping Emacs windows. Users create multiple windows so they 60non-overlapping windows to view several buffers at once. Lisp
62can look at several buffers at once. Lisp libraries use multiple 61programs can use multiple windows for a variety of purposes. In
63windows for a variety of reasons, but most often to display related 62Rmail, for example, you can view a summary of message titles in one
64information. In Rmail, for example, you can move through a summary 63window, and the contents of the selected message in another window.
65buffer in one window while the other window shows messages one at a time
66as they are reached.
67 64
68@cindex terminal screen 65@cindex terminal screen
69@cindex screen of terminal 66@cindex screen of terminal
70 The meaning of ``window'' in Emacs is similar to what it means in the 67 Emacs uses the word ``window'' with a different meaning than in
71context of general-purpose window systems such as X, but not identical. 68graphical desktop environments and window systems, such as the X
72The X Window System places X windows on the screen; Emacs uses one or 69Window System. When Emacs is run on X, each of its graphical X
73more X windows as frames, and subdivides them into Emacs windows. When 70windows is an Emacs frame (containing one or more Emacs windows).
74you use Emacs on a character-only terminal, Emacs treats the whole 71When Emacs is run on a text-only terminal, the frame fills the entire
75terminal screen as one frame. 72terminal screen.
76 73
77@cindex tiled windows 74@cindex tiled windows
78 Most window systems support arbitrarily located overlapping windows. 75 Unlike X windows, Emacs windows are @dfn{tiled}; they never overlap
79In contrast, Emacs windows are @dfn{tiled}; they never overlap, and 76within the area of the frame. When a window is created, resized, or
80together they fill the whole screen or frame. Because of the way in 77deleted, the change in window space is taken from or given to the
81which Emacs creates new windows (@pxref{Splitting Windows}) and resizes 78adjacent windows, so that the total area of the frame is unchanged.
82them (@pxref{Resizing Windows}), not all conceivable tilings of windows
83on an Emacs frame are actually possible.
84
85 For practical purposes, a window exists only while it is displayed in
86a frame. Once removed from the frame, the window is effectively deleted
87and should not be used, even though the Lisp object representing it
88might be still referenced from other Lisp objects; see @ref{Deleting
89Windows}. Restoring a saved window configuration is the only way for a
90window no longer on the screen to come back to life; see @ref{Window
91Configurations}.
92
93@defun windowp object
94This function returns @code{t} if @var{object} is a window, @code{nil}
95otherwise. It can return @code{t} if @var{object} denotes a window that
96has been deleted.
97@end defun
98 79
99@cindex live windows 80@cindex live windows
100@cindex internal windows 81@cindex internal windows
101 For historical reasons a window is considered @dfn{live} if and only 82 A @dfn{live window} is one that is actually displaying a buffer in a
102if it currently displays a buffer; see @ref{Buffers and Windows}. In 83frame. Such a window can be @dfn{deleted}, i.e. removed from the
103order to show multiple windows within one and the same frame, Emacs 84frame (@pxref{Deleting Windows}); then it is no longer live, but the
104organizes them in form of a tree called window tree; see @ref{Windows 85Lisp object representing it might be still referenced from other Lisp
105and Frames}. The internal nodes of a window tree are called internal 86objects. A deleted window may be brought back to life by restoring a
106windows and are not considered live. The leaf nodes of a window tree 87saved window configuration (@pxref{Window Configurations}).
107constitute the windows displaying buffers and only they will be called 88
108live here. 89@defun windowp object
90This function returns @code{t} if @var{object} is a window (whether or
91not it is live). Otherwise, it returns @code{nil}.
92@end defun
109 93
110@defun window-live-p object 94@defun window-live-p object
111This function returns @code{t} if @var{object} is a live window and 95This function returns @code{t} if @var{object} is a live window and
112@code{nil} otherwise. A live window is a window that displays a buffer. 96@code{nil} otherwise. A live window is one that displays a buffer.
113@end defun 97@end defun
114 98
115@defun window-any-p object 99 The windows in each frame are organized into a @dfn{window tree}.
116This function returns @code{t} if @var{object} denotes a live or an 100@xref{Windows and Frames}. The leaf nodes of each window tree are
117internal window and @code{nil} otherwise. In particular, this function 101live windows---the ones actually displaying buffers. The internal
118returns @code{nil} if @var{object} is a window that has been 102nodes of the window tree are internal windows, which are not live.
119deleted. 103You can distinguish internal windows from deleted windows with
104@code{window-valid-p}.
105
106@defun window-valid-p object
107This function returns @code{t} if @var{object} is a live window, or an
108internal window in a window tree. Otherwise, it returns @code{nil},
109including for the case where @var{object} is a deleted window.
120@end defun 110@end defun
121 111
122@cindex selected window 112@cindex selected window
123In each frame, at any time, one and only one window is designated as 113 In each frame, at any time, exactly one Emacs window is designated
124@dfn{selected within the frame}. Also, at any time, one frame is the 114as @dfn{selected within the frame}. For the selected frame, that
125selected frame (@pxref{Input Focus}). The window selected within the 115window is called the @dfn{selected window}---the one in which most
126selected frame is the @dfn{selected window}. 116editing takes place, and in which the cursor for selected windows
127 117appears (@pxref{Cursor Parameters}). The selected window's buffer is
128 The selected window is always a live window. Its buffer is usually 118usually also the current buffer, except when @code{set-buffer} has
129the current buffer (except when @code{set-buffer} has been used); see 119been used (@pxref{Current Buffer}). As for non-selected frames, the
130@ref{Current Buffer}. 120window selected within the frame becomes the selected window if the
121frame is ever selected. @xref{Selecting Windows}.
131 122
132@defun selected-window 123@defun selected-window
133This function returns the selected window. This is the window in which 124This function returns the selected window (which is always a live
134the cursor for selected windows (@pxref{Cursor Parameters}) appears and 125window).
135to which many commands apply.
136@end defun
137
138The window handling functions can be roughly grouped into functions
139operating on live windows only and functions that accept any window as
140argument. Many of these functions accept as argument the value
141@code{nil} to specify the selected window. The two functions below can
142be used to ``normalize'' arguments specifying windows in a uniform
143manner.
144
145@defun window-normalize-any-window window
146This function returns the normalized value for @var{window} which can be
147any window that has not been deleted. More precisely, if @var{window}
148is @code{nil}, it returns the selected window. If @var{window} denotes
149a live or internal window, it returns that window. Otherwise, this
150function signals an error.
151@end defun
152
153@defun window-normalize-live-window window
154This functions returns the normalized value for a live window
155@var{window}. More precisely, if @var{window} is @code{nil}, it returns
156the selected window. If @var{window} is a live window, it returns that
157window. Otherwise, this function signals an error.
158@end defun 126@end defun
159 127
160
161@node Windows and Frames 128@node Windows and Frames
162@section Windows and Frames 129@section Windows and Frames
163 130
164Each window is part of one and only one frame (@pxref{Frames}); you can 131Each window belongs to exactly one frame (@pxref{Frames}).
165get that frame with the function described next.
166 132
167@defun window-frame window 133@defun window-frame window
168This function returns the frame that @var{window} is on. The argument 134This function returns the frame that the window @var{window} belongs
169@var{window} can be any window and defaults to the selected one. 135to. If @var{window} is @code{nil}, it defaults to the selected
136window.
170@end defun 137@end defun
171 138
172The following function returns a list of all live windows on a specific 139@defun window-list &optional frame minibuffer window
173frame. 140This function returns a list of live windows belonging to the frame
141@var{frame}. If @var{frame} is omitted or @code{nil}, it defaults to
142the selected frame.
174 143
175@defun window-list &optional frame minibuf window 144The optional argument @var{minibuffer} specifies whether to include
176This function returns a list of @var{frame}'s live windows, starting 145the minibuffer window in the returned list. If @var{minibuffer} is
177with @var{window}. The optional argument @var{frame} has to denote a 146@code{t}, the minibuffer window is included. If @var{minibuffer} is
178live frame and defaults to the selected frame. The optional argument 147@code{nil} or omitted, the minibuffer window is included only if it is
179@var{window} has to denote a live window on the frame specified by 148active. If @var{minibuffer} is neither @code{nil} nor @code{t}, the
180@var{frame} and defaults to the selected one. 149minibuffer window is never included.
181 150
182The argument @var{minibuf} specifies if the minibuffer window shall be 151The optional argument @var{window}, if non-@code{nil}, should be a
183included in the return value. If @var{minibuf} is @code{t}, the result 152live window on the specified frame; then @var{window} will be the
184always includes the minibuffer window. If @var{minibuf} is @code{nil} 153first element in the returned list. If @var{window} is omitted or
185or omitted, that includes the minibuffer window only if it is active. 154@code{nil}, the window selected within the frame is first element.
186If @var{minibuf} is neither @code{nil} nor @code{t}, the result never
187includes the minibuffer window.
188@end defun 155@end defun
189 156
190@cindex window tree 157@cindex window tree
191Windows within one and the same frame are organized in form of a tree 158@cindex root window
192called @dfn{window tree}. The leaf nodes of a window tree constitute 159 Windows in the same frame are organized into a @dfn{window tree},
193the windows visible to the user. These are the windows associated with 160whose leaf nodes are the live windows. The internal nodes of a window
194buffers and are usually called live windows. The internal nodes of a 161tree are not live; they exist for the purpose of organizing the
195window tree are needed for finding, traversing and displaying the live 162relationships between live windows. The root node of a window tree is
196windows. 163called the @dfn{root window}. It can be either a live window (if the
197 164frame has just one window), or an internal window.
198 A minibuffer window (@pxref{Minibuffer Windows}) is not considered 165
199part of its frame's window tree unless the frame is a minibuffer-only 166 A minibuffer window (@pxref{Minibuffer Windows}) is not part of its
200frame. Most functions covered in this section accept, however, the 167frame's window tree unless the frame is a minibuffer-only frame.
201minibuffer window as argument. Also, the minibuffer window is listed by 168Nonetheless, most of the functions in this section accept the
202the function @code{window-tree} described at the end of this section. 169minibuffer window as an argument. Also, the function
203 170@code{window-tree} described at the end of this section lists the
204 A window tree is rooted at the root window of its frame. 171minibuffer window alongside the actual window tree.
205 172
206@defun frame-root-window &optional frame-or-window 173@defun frame-root-window &optional frame-or-window
207This function returns the root window of @var{frame-or-window}. The 174This function returns the root window for @var{frame-or-window}. The
208argument @var{frame-or-window} has to denote either a window or a frame 175argument @var{frame-or-window} should be either a window or a frame;
209and defaults to the selected frame. If @var{frame-or-window} denotes a 176if omitted or @code{nil}, it defaults to the selected frame. If
210window, the return value is the root window of that window's frame. 177@var{frame-or-window} is a window, the return value is the root window
211This function always returns a window; a live window if the frame 178of that window's frame.
212specified by @var{frame-or-window} contains no other live windows and an
213internal window otherwise.
214@end defun 179@end defun
215 180
216@cindex subwindow 181@cindex parent window
217All other windows of a frame with the exception of the minibuffer window 182@cindex child window
218are subwindows of the frame's root window. A window is considered a 183@cindex sibling window
219@dfn{subwindow} of another window if it occupies a part of that other 184 When a window is split, there are two live windows where previously
220window's screen area. 185there was one. One of these is represented by the same Lisp window
221 186object as the original window, and the other is represented by a
222The functions described next allow to access the members of a window 187newly-created Lisp window object. Both of these live windows become
223tree and take an arbitrary window as argument. 188leaf nodes of the window tree, as @dfn{child windows} of a single
189internal window. If necessary, Emacs automatically creates this
190internal window, which is also called the @dfn{parent window}, and
191assigns it to the appropriate position in the window tree. A set of
192windows that share the same parent are called @dfn{siblings}.
224 193
225@cindex parent window 194@cindex parent window
226@defun window-parent &optional window 195@defun window-parent &optional window
227Return @var{window}'s parent in the window tree. The optional argument 196This function returns the parent window of @var{window}. If
228@var{window} can denote an arbitrary window and defaults to the selected 197@var{window} is omitted or @code{nil}, it defaults to the selected
229one. The return value is @code{nil} if @var{window} is a minibuffer 198window. The return value is @code{nil} if @var{window} has no parent
230window or the root window of its frame and an internal window otherwise. 199(i.e. it is a minibuffer window or the root window of its frame).
231@end defun 200@end defun
232 201
233@cindex child window 202 Each internal window always has at least two child windows. If this
234 Parent windows do not appear on the screen. The screen area of a 203number falls to one as a result of window deletion, Emacs
235parent window is the rectangular part of the window's frame occupied by 204automatically deletes the internal window, and its sole remaining
236the window's @dfn{child windows}, that is, the set of windows having 205child window takes its place in the window tree.
237that window as their parent. Each parent window has at least two child 206
238windows, so there are no ``Matryoshka'' windows. Minibuffer windows do 207 Each child window can be either a live window, or an internal window
239not have child windows. 208(which in turn would have its own child windows). Therefore, each
209internal window can be thought of as occupying a certain rectangular
210@dfn{screen area}---the union of the areas occupied by the live
211windows that are ultimately descended from it.
240 212
241@cindex window combination 213@cindex window combination
242@cindex vertical combination 214@cindex vertical combination
243@cindex horizontal combination 215@cindex horizontal combination
244The children of any parent window form either a vertical or a horizontal 216 For each internal window, the screen areas of the immediate children
245combination of windows. A @dfn{vertical combination} is a set of 217are arranged either vertically or horizontally (never both). If the
246windows arranged one above each other. A @dfn{horizontal combination} 218child windows are arranged one above the other, they are said to form
247is a set of windows arranged side by side. Consider the frame shown 219a @dfn{vertical combination}; if they are arranged side by side, they
248below (for simplicity we assume that the frame does not contain a 220are said to form a @dfn{horizontal combination}. Consider the
249minibuffer window): 221following example:
250 222
251@smallexample 223@smallexample
252@group 224@group
253 ______________________________________ 225 ______________________________________
254 | ______ ____________________________ | 226 | ______ ____________________________ |
255 || || __________________________ || 227 || || __________________________ ||
256 || ||| ___________ ___________ ||| 228 || ||| |||
257 || |||| || |||| 229 || ||| |||
258 || |||| || |||| 230 || ||| |||
259 || ||||_____W6____||_____W7____||||
260 || |||____________W4____________||| 231 || |||____________W4____________|||
261 || || __________________________ || 232 || || __________________________ ||
262 || ||| ||| 233 || ||| |||
234 || ||| |||
263 || |||____________W5____________||| 235 || |||____________W5____________|||
264 ||__W2__||_____________W3_____________ | 236 ||__W2__||_____________W3_____________ |
265 |__________________W1__________________| 237 |__________________W1__________________|
@@ -267,91 +239,70 @@ minibuffer window):
267@end group 239@end group
268@end smallexample 240@end smallexample
269 241
270The root window of the frame is @code{W1}---a horizontal combination of 242@noindent
271the live window @code{W2} and the internal window @code{W3}. Hence 243The root window of this frame is an internal window, @code{W1}. Its
272@code{(window-parent W1)} is @code{nil} while @code{(window-parent W2)} 244child windows form a horizontal combination, consisting of the live
273and @code{(window-parent W3)} are both @code{W1}. 245window @code{W2} and the internal window @code{W3}. The child windows
274 246of @code{W3} form a vertical combination, consisting of the live
275 The internal window @code{W3} is a vertical combination of @code{W4} 247windows @code{W4} and @code{W5}. Hence, the live windows in this
276and the live window @code{W5}. The internal window @code{W4} is a 248window tree are @code{W2} @code{W4}, and @code{W5}.
277horizontal combination of the live windows @code{W6} and @code{W7}. The 249
278windows you can actually see on the screen are @code{W2}, @code{W5}, 250 The following functions can be used to retrieve a child window of an
279@code{W6} and @code{W7}. 251internal window, and the siblings of a child window.
280 252
281 For any parent window, the first child window can be retrieved by the 253@defun window-top-child window
282functions given next. 254This function returns the topmost child window of @var{window}, if
283 255@var{window} is an internal window whose children form a vertical
284@defun window-top-child &optional window 256combination. For any other type of window, the return value is
285This function returns @var{window}'s first vertical child window. The 257@code{nil}.
286optional argument @var{window} can be an arbitrary window and defaults
287to the selected one. The return value is @code{nil} if @var{window} is
288a live window or its children form a horizontal combination. In the
289example above @code{(window-top-child W3)} is @code{W4} while
290@code{(window-top-child W4)} is @code{nil}.
291@end defun 258@end defun
292 259
293@defun window-left-child &optional window 260@defun window-left-child window
294This function returns @var{window}'s first horizontal child window. The 261This function returns the leftmost child window of @var{window}, if
295optional argument @var{window} can be an arbitrary window and defaults 262@var{window} is an internal window whose children form a horizontal
296to the selected one. The return value is @code{nil} if @var{window} is 263combination. For any other type of window, the return value is
297a live window or its children form a vertical combination. In the 264@code{nil}.
298example above @code{(window-left-child W4)} is @code{W6} while
299@code{(window-left-child W3)} is @code{nil}.
300@end defun 265@end defun
301 266
302@defun window-child window 267@defun window-child window
303This function return @var{window}'s first child window. The return 268This function returns the first child window of the internal window
304value is @code{nil} if @var{window} is a live window. In the example 269@var{window}---the topmost child window for a vertical combination, or
305above @code{(window-child W3)} is @code{W4} while @code{(window-child 270the leftmost child window for a horizontal combination. If
306W4)} is @code{W6}. 271@var{window} is a live window, the return value is @code{nil}.
307@end defun 272@end defun
308 273
309The following function is useful to determine whether a window is part
310of a vertical or horizontal combination.
311
312@defun window-combined-p &optional window horizontal 274@defun window-combined-p &optional window horizontal
313This function returns non-@code{nil} if and only if @var{window} is 275This function returns a non-@code{nil} value if and only if
314vertically combined. The argument @var{window} can specify any window 276@var{window} is part of a vertical combination. If @var{window} is
315and defaults to the selected one. The actual return value is the first 277omitted or nil, it defaults to the selected one.
316vertical child of window.
317 278
318If the optional argument @var{horizontal} is non-@code{nil}, this means 279If the optional argument @var{horizontal} is non-@code{nil}, this
319to return non-@code{nil} if and only if @var{window} is horizontally 280means to return non-@code{nil} if and only if @var{window} is part of
320combined. In this case, the return value is the first horizontal child 281a horizontal combination.
321of window.
322@end defun 282@end defun
323 283
324@cindex sibling window
325For any window that is part of a combination, the other windows in that
326combination are called the window's @dfn{siblings}. The only windows
327that do not have siblings are root windows of frames and minibuffer
328windows. A window's siblings can be retrieved with the following two
329functions.
330
331@defun window-next-sibling &optional window 284@defun window-next-sibling &optional window
332This function returns @var{window}'s next sibling. The optional 285This function returns the next sibling of the window @var{window}. If
333argument @var{window} can be an arbitrary window and defaults to the 286omitted or @code{nil}, @var{window} defaults to the selected window.
334selected window. It returns @code{nil} if @var{window} is the last 287The return value is @code{nil} if @var{window} is the last child of
335child of its parent. In our example @code{(window-next-sibling W2)} is 288its parent.
336@code{W3} while @code{(window-next-sibling W3)} is @code{nil}.
337@end defun 289@end defun
338 290
339@defun window-prev-sibling &optional window 291@defun window-prev-sibling &optional window
340This function returns @var{window}'s previous sibling. The optional 292This function returns the previous sibling of the window @var{window}.
341argument @var{window} can be an arbitrary window and defaults to the 293If omitted or @code{nil}, @var{window} defaults to the selected
342selected window. It returns @code{nil} if @var{window} is the first 294window. The return value is @code{nil} if @var{window} is the first
343child of its parent. In our example @code{(window-prev-sibling W3)} is 295child of its parent.
344@code{W2} and @code{(window-prev-sibling W2)} is @code{nil}.
345@end defun 296@end defun
346 297
347The functions @code{window-next-sibling} and @code{window-prev-sibling} 298The functions @code{window-next-sibling} and
348should not be confused with the functions @code{next-window} and 299@code{window-prev-sibling} should not be confused with the functions
349@code{previous-window} which respectively return the next and previous 300@code{next-window} and @code{previous-window} which respectively
350window in the cyclic ordering of windows, see @ref{Cyclic Window 301return the next and previous window in the cyclic ordering of windows
351Ordering}. 302(@pxref{Cyclic Window Ordering}).
352 303
353 In order to find the first live window on a frame, the following 304 You can use the following functions to find the first live window on
354function can be used. 305a frame, and to retrieve the entire window tree of a frame:
355 306
356@defun frame-first-window &optional frame-or-window 307@defun frame-first-window &optional frame-or-window
357This function returns the live window at the upper left corner of the 308This function returns the live window at the upper left corner of the
@@ -363,31 +314,27 @@ the assumption that the frame from our canonical example is selected
363@code{(frame-first-window)} returns @code{W2}. 314@code{(frame-first-window)} returns @code{W2}.
364@end defun 315@end defun
365 316
366You can get the window tree of a frame with the following function.
367
368@cindex window tree
369@defun window-tree &optional frame 317@defun window-tree &optional frame
370This function returns the window tree for frame @var{frame}. The 318This function returns a list representing the window tree for frame
371optional argument @var{frame} must be a live frame and defaults to the 319@var{frame}. If @var{frame} is omitted or @code{nil}, it defaults to
372selected one. 320the selected frame.
373 321
374The return value is a list of the form @code{(@var{root} @var{mini})}, 322The return value is a list of the form @code{(@var{root} @var{mini})},
375where @var{root} represents the window tree of the frame's 323where @var{root} represents the window tree of the frame's root
376root window, and @var{mini} is the frame's minibuffer window. 324window, and @var{mini} is the frame's minibuffer window.
377 325
378If the root window is live, @var{root} specifies the root window and 326If the root window is live, @var{root} is that window itself.
379nothing else. Otherwise, @var{root} is a list @code{(@var{dir} 327Otherwise, @var{root} is a list @code{(@var{dir} @var{edges} @var{w1}
380@var{edges} @var{w1} @var{w2} ...)} where @var{dir} is @code{nil} for a 328@var{w2} ...)} where @var{dir} is @code{nil} for a horizontal
381horizontal combination, and @code{t} for a vertical combination, 329combination and @code{t} for a vertical combination, @var{edges} gives
382@var{edges} gives the size and position of the combination, and the 330the size and position of the combination, and the remaining elements
383remaining elements are the child windows. Each child window may again 331are the child windows. Each child window may again be a window object
384be a live window or a list representing a window combination, and so on. 332(for a live window) or a list with the same format as above (for an
385The @var{edges} element is a list @code{(@var{left}@var{ top}@var{ 333internal window). The @var{edges} element is a list @code{(@var{left}
386right}@var{ bottom})} similar to the value returned by 334@var{top} @var{right} @var{bottom})}, similar to the value returned by
387@code{window-edges}, see @ref{Coordinates and Windows}. 335@code{window-edges} (@pxref{Coordinates and Windows}).
388@end defun 336@end defun
389 337
390
391@node Window Sizes 338@node Window Sizes
392@section Window Sizes 339@section Window Sizes
393@cindex window size 340@cindex window size
@@ -1566,7 +1513,7 @@ configuration.
1566For interactive use, Emacs provides two commands which always split the 1513For interactive use, Emacs provides two commands which always split the
1567selected window. 1514selected window.
1568 1515
1569@deffn Command split-window-above-each-other &optional size 1516@deffn Command split-window-below &optional size
1570This function splits the selected window into two windows, one above the 1517This function splits the selected window into two windows, one above the
1571other, leaving the upper of the two windows selected, with @var{size} 1518other, leaving the upper of the two windows selected, with @var{size}
1572lines. (If @var{size} is negative, then the lower of the two windows 1519lines. (If @var{size} is negative, then the lower of the two windows
@@ -1582,16 +1529,16 @@ is the new, lower window.
1582 1529
1583@defopt split-window-keep-point 1530@defopt split-window-keep-point
1584If this variable is non-@code{nil} (the default), then 1531If this variable is non-@code{nil} (the default), then
1585@code{split-window-above-each-other} behaves as described above. 1532@code{split-window-below} behaves as described above.
1586 1533
1587 If it is @code{nil}, then @code{split-window-above-each-other} 1534 If it is @code{nil}, then @code{split-window-below} adjusts point
1588adjusts point in each of the two windows to avoid scrolling. (This is 1535in each of the two windows to avoid scrolling. (This is useful on
1589useful on slow terminals.) It selects whichever window contains the 1536slow terminals.) It selects whichever window contains the screen line
1590screen line that point was previously on. Other functions are not 1537that point was previously on. Other functions are not affected by
1591affected by this variable. 1538this variable.
1592@end defopt 1539@end defopt
1593 1540
1594@deffn Command split-window-side-by-side &optional size 1541@deffn Command split-window-right &optional size
1595This function splits the selected window into two windows 1542This function splits the selected window into two windows
1596side-by-side, leaving the selected window on the left with @var{size} 1543side-by-side, leaving the selected window on the left with @var{size}
1597columns. If @var{size} is negative, the rightmost window gets 1544columns. If @var{size} is negative, the rightmost window gets
@@ -3689,7 +3636,7 @@ as @code{save-window-excursion}:
3689@group 3636@group
3690(let ((config (current-window-configuration))) 3637(let ((config (current-window-configuration)))
3691 (unwind-protect 3638 (unwind-protect
3692 (progn (split-window-vertically nil) 3639 (progn (split-window-below nil)
3693 @dots{}) 3640 @dots{})
3694 (set-window-configuration config))) 3641 (set-window-configuration config)))
3695@end group 3642@end group
diff --git a/etc/NEWS b/etc/NEWS
index bd2f6004d39..5e7e6cbb47e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1033,33 +1033,31 @@ directionality are not known in advance, without disrupting the layout
1033of the line. 1033of the line.
1034 1034
1035** Window changes 1035** Window changes
1036
1037+++ 1036+++
1038*** Window tree functions are accessible in Elisp. 1037*** Window tree functions are accessible in Elisp.
1039Functions are provided to return the parent, siblings or child windows 1038Functions are provided to return the parent, siblings or child windows
1040of any window including internal windows (windows not associated with a 1039of any window including internal windows (windows not associated with a
1041buffer) in the window tree. 1040buffer) in the window tree.
1042
1043+++ 1041+++
1044*** Window manipulation can deal with internal windows. 1042**** New function `window-valid-p' gives non-nil for live and internal
1043windows.
1044+++
1045**** Window manipulation can deal with internal windows.
1045Many window handling functions like `split-window', `delete-window', or 1046Many window handling functions like `split-window', `delete-window', or
1046`delete-other-windows' as well as the window resizing functions can now 1047`delete-other-windows' as well as the window resizing functions can now
1047act on any window including internal ones. 1048act on any window including internal ones.
1048
1049+++ 1049+++
1050*** window-total-height/-width vs window-body-height/-width. 1050*** window-total-height/-width vs window-body-height/-width.
1051The function `window-height' has been renamed to `window-total-height' 1051The function `window-height' has been renamed to `window-total-height'
1052and `window-width' has been renamed to `window-body-width'. The old 1052and `window-width' has been renamed to `window-body-width'. The old
1053names are provided as aliases. Two new functions `window-total-width' 1053names are provided as aliases. Two new functions `window-total-width'
1054and `window-body-height' are provided. 1054and `window-body-height' are provided.
1055
1056+++ 1055+++
1057*** Window parameters specific to window handling functions. 1056*** Window parameters specific to window handling functions.
1058For each window you can specify a parameter to override the default 1057For each window you can specify a parameter to override the default
1059behavior of a number of functions like `split-window', `delete-window' 1058behavior of a number of functions like `split-window', `delete-window'
1060and `delete-other-windows'. The variable `ignore-window-parameters' 1059and `delete-other-windows'. The variable `ignore-window-parameters'
1061allows to ignore processing such parameters. 1060allows to ignore processing such parameters.
1062
1063+++ 1061+++
1064*** New semantics of third argument of `split-window'. 1062*** New semantics of third argument of `split-window'.
1065The third argument of `split-window' has been renamed to SIDE and can be 1063The third argument of `split-window' has been renamed to SIDE and can be
@@ -1067,17 +1065,14 @@ set to any of the values 'below, 'right, 'above, or 'left to make the
1067new window appear on the corresponding side of the window that shall be 1065new window appear on the corresponding side of the window that shall be
1068split. Any other value of SIDE will cause `split-window' to split the 1066split. Any other value of SIDE will cause `split-window' to split the
1069window into two side-by-side windows as before. 1067window into two side-by-side windows as before.
1070
1071+++ 1068+++
1072*** Window resizing functions. 1069*** Window resizing functions.
1073A new standard function for resizing windows called `window-resize' has 1070A new standard function for resizing windows called `window-resize' has
1074been introduced. This and all other functions for resizing windows no 1071been introduced. This and all other functions for resizing windows no
1075longer delete any windows when they become too small. 1072longer delete any windows when they become too small.
1076
1077+++ 1073+++
1078*** Deleting the selected window now selects the most recently selected 1074*** Deleting the selected window now selects the most recently selected
1079live window on that frame instead. 1075live window on that frame instead.
1080
1081+++ 1076+++
1082*** `adjust-window-trailing-edge' adjustments. 1077*** `adjust-window-trailing-edge' adjustments.
1083`adjust-window-trailing-edge' can now deal with fixed-size windows and 1078`adjust-window-trailing-edge' can now deal with fixed-size windows and
@@ -1085,7 +1080,6 @@ is able to resize other windows if a window adjacent to the trailing
1085edge cannot be shrunk any more. This makes its behavior more similar to 1080edge cannot be shrunk any more. This makes its behavior more similar to
1086that of Emacs 21 without compromising, however, its inability to delete 1081that of Emacs 21 without compromising, however, its inability to delete
1087windows which was introduced in Emacs 22. 1082windows which was introduced in Emacs 22.
1088
1089+++ 1083+++
1090*** Window-local buffer lists. 1084*** Window-local buffer lists.
1091Windows now have local buffer lists. This means that removing a buffer 1085Windows now have local buffer lists. This means that removing a buffer
@@ -1093,17 +1087,16 @@ from display in a window will preferably show the buffer previously
1093shown in that window with its previous window-start and window-point 1087shown in that window with its previous window-start and window-point
1094positions. This also means that the same buffer may be automatically 1088positions. This also means that the same buffer may be automatically
1095shown twice even if it already appears in another window. 1089shown twice even if it already appears in another window.
1096
1097+++ 1090+++
1098*** `switch-to-buffer' has a new optional argument FORCE-SAME-WINDOW, 1091*** `switch-to-buffer' has a new optional argument FORCE-SAME-WINDOW,
1099which if non-nil requires the buffer to be displayed in the currently 1092which if non-nil requires the buffer to be displayed in the currently
1100selected window, signaling an error otherwise. If nil, another window 1093selected window, signaling an error otherwise. If nil, another window
1101can be used, e.g. if the selected one is strongly dedicated. 1094can be used, e.g. if the selected one is strongly dedicated.
1102 1095+++
1103*** `split-window-vertically' and `split-window-horizontally' renamed 1096*** `split-window-vertically' and `split-window-horizontally' renamed
1104to `split-window-below' and `split-window-right' respectively. 1097to `split-window-below' and `split-window-right' respectively.
1105The old names are kept as aliases. 1098The old names are kept as aliases.
1106 1099+++
1107*** Display actions 1100*** Display actions
1108 1101
1109**** The second arg to `display-buffer' and `pop-to-buffer' is now 1102**** The second arg to `display-buffer' and `pop-to-buffer' is now
@@ -1294,6 +1287,8 @@ functions. It's easiest to use these functions through
1294STARTTLS opportunistically or use plain SSL, depending on your needs. 1287STARTTLS opportunistically or use plain SSL, depending on your needs.
1295 1288
1296Only versions 2.8.x and higher or GnuTLS have been tested. 1289Only versions 2.8.x and higher or GnuTLS have been tested.
1290[FIXME: this statement needs clarifying, given that GnuTLS >= 2.6.6
1291is the test used by configure.]
1297 1292
1298*** gnutls-log-level 1293*** gnutls-log-level
1299Set `gnutls-log-level' higher than 0 to get debug output. 1 is for 1294Set `gnutls-log-level' higher than 0 to get debug output. 1 is for
diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in
index 6b451dd14e1..d5304258879 100644
--- a/lib/makefile.w32-in
+++ b/lib/makefile.w32-in
@@ -50,7 +50,9 @@ all: stamp_BLD $(ALL)
50 50
51### TAGS ### 51### TAGS ###
52 52
53TAGS: 53FRC:
54
55TAGS: FRC
54 ../lib-src/$(BLD)/etags.exe *.c *.h 56 ../lib-src/$(BLD)/etags.exe *.c *.h
55 57
56### DEPENDENCIES ### 58### DEPENDENCIES ###
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index eb276721dbc..e0716bea83f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,44 @@
12011-11-07 Mark Lillibridge <mark.lillibridge@hp.com> (tiny change)
2
3 * mail/rmail.el (rmail-get-new-mail, rmail-insert-inbox-text):
4 Ensure that mbox format messages end in two newlines (Bug#9974).
5
62011-11-06 Chong Yidong <cyd@gnu.org>
7
8 * window.el (window-combination-p): Function deleted; its
9 side-effect is not used in any existing code.
10 (window-combinations, window-combined-p): Call window-*-child
11 directly.
12
132011-11-05 Chong Yidong <cyd@gnu.org>
14
15 * window.el (window-valid-p): Rename from window-any-p.
16 (window-size-ignore, window-state-get): Callers changed.
17 (window-normalize-window): Rename from window-normalize-any-window.
18 New arg LIVE-ONLY, replacing window-normalize-live-window.
19 (window-normalize-live-window): Deleted.
20 (window-combination-p, window-combined-p, window-combinations)
21 (walk-window-subtree, window-atom-root, window-min-size)
22 (window-sizable, window-sizable-p, window-size-fixed-p)
23 (window-min-delta, window-max-delta, window-resizable)
24 (window-resizable-p, window-full-height-p, window-full-width-p)
25 (window-current-scroll-bars, window-point-1, set-window-point-1)
26 (window-at-side-p, window-in-direction, window-resize)
27 (adjust-window-trailing-edge, maximize-window, minimize-window)
28 (window-deletable-p, delete-window, delete-other-windows)
29 (record-window-buffer, unrecord-window-buffer)
30 (switch-to-prev-buffer, switch-to-next-buffer, window--delete)
31 (quit-window, split-window, window-state-put)
32 (set-window-text-height, fit-window-to-buffer)
33 (shrink-window-if-larger-than-buffer): Callers changed.
34
12011-11-04 Eli Zaretskii <eliz@gnu.org> 352011-11-04 Eli Zaretskii <eliz@gnu.org>
2 36
37 * mail/rmail.el (rmail-simplified-subject): Decode subject with
38 rfc2047-decode-string.
39 (rmail-mime-toggle-hidden): Declare to avoid byte-compilation
40 warnings.
41
3 * window.el (window-body-height, window-body-width): Mention in 42 * window.el (window-body-height, window-body-width): Mention in
4 the doc string that the return values are in frame's canonical 43 the doc string that the return values are in frame's canonical
5 units. (Bug#9949) 44 units. (Bug#9949)
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 603a615192a..4b3441a8cdc 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -194,6 +194,7 @@ please report it with \\[report-emacs-bug].")
194 194
195(declare-function mail-dont-reply-to "mail-utils" (destinations)) 195(declare-function mail-dont-reply-to "mail-utils" (destinations))
196(declare-function rmail-update-summary "rmailsum" (&rest ignore)) 196(declare-function rmail-update-summary "rmailsum" (&rest ignore))
197(declare-function rmail-mime-toggle-hidden "rmailmm" ())
197 198
198(defun rmail-probe (prog) 199(defun rmail-probe (prog)
199 "Determine what flavor of movemail PROG is. 200 "Determine what flavor of movemail PROG is.
@@ -1720,10 +1721,12 @@ not be a new one). It returns non-nil if it got any new messages."
1720 (setq all-files (cdr all-files))) 1721 (setq all-files (cdr all-files)))
1721 ;; Put them back in their original order. 1722 ;; Put them back in their original order.
1722 (setq files (nreverse files)) 1723 (setq files (nreverse files))
1723 ;; In case of brain damage caused by require-final-newline.
1724 (goto-char (point-max)) 1724 (goto-char (point-max))
1725 (skip-chars-backward " \t\n") 1725 ;; Make sure we end with a blank line unless there are
1726 (delete-region (point) (point-max)) 1726 ;; no messages, as required by mbox format (Bug#9974).
1727 (unless (bobp)
1728 (while (not (looking-back "\n\n"))
1729 (insert "\n")))
1727 (setq found (or 1730 (setq found (or
1728 (rmail-get-new-mail-1 file-name files delete-files) 1731 (rmail-get-new-mail-1 file-name files delete-files)
1729 found)))) 1732 found))))
@@ -2023,22 +2026,12 @@ Value is the size of the newly read mail after conversion."
2023 (rmail-unrmail-new-mail-maybe 2026 (rmail-unrmail-new-mail-maybe
2024 tofile 2027 tofile
2025 (nth 1 (insert-file-contents tofile)))) 2028 (nth 1 (insert-file-contents tofile))))
2026 ;; Determine if a pair of newline message separators need
2027 ;; to be added to the new collection of messages. This is
2028 ;; the case for all new message collections added to a
2029 ;; non-empty mail file.
2030 (unless (zerop size)
2031 (save-restriction
2032 (let ((start (point-min)))
2033 (widen)
2034 (unless (eq start (point-min))
2035 (goto-char start)
2036 (insert "\n\n")
2037 (setq size (+ 2 size))))))
2038 (goto-char (point-max)) 2029 (goto-char (point-max))
2039 (or (= (preceding-char) ?\n) 2030 ;; Make sure the read-in mbox data properly ends with a
2040 (zerop size) 2031 ;; blank line unless it is of size 0.
2041 (insert ?\n)) 2032 (unless (zerop size)
2033 (while (not (looking-back "\n\n"))
2034 (insert "\n")))
2042 (if (not (and rmail-preserve-inbox (string= file tofile))) 2035 (if (not (and rmail-preserve-inbox (string= file tofile)))
2043 (setq delete-files (cons tofile delete-files))))) 2036 (setq delete-files (cons tofile delete-files)))))
2044 (message "") 2037 (message "")
@@ -3262,6 +3255,7 @@ Interactively, empty argument means use same regexp used last time."
3262Simplifying the subject means stripping leading and trailing whitespace, 3255Simplifying the subject means stripping leading and trailing whitespace,
3263and typical reply prefixes such as Re:." 3256and typical reply prefixes such as Re:."
3264 (let ((subject (or (rmail-get-header "Subject" msgnum) ""))) 3257 (let ((subject (or (rmail-get-header "Subject" msgnum) "")))
3258 (setq subject (rfc2047-decode-string subject))
3265 (if (string-match "\\`[ \t]+" subject) 3259 (if (string-match "\\`[ \t]+" subject)
3266 (setq subject (substring subject (match-end 0)))) 3260 (setq subject (substring subject (match-end 0))))
3267 (if (string-match rmail-reply-regexp subject) 3261 (if (string-match rmail-reply-regexp subject)
diff --git a/lisp/window.el b/lisp/window.el
index d6ab5e0e6cc..1b51bde36bd 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -100,8 +100,10 @@ be any window."
100 (setq window (window-next-sibling window)))) 100 (setq window (window-next-sibling window))))
101 window) 101 window)
102 102
103(defsubst window-any-p (object) 103(defsubst window-valid-p (object)
104 "Return t if OBJECT denotes a live or internal window." 104 "Return t if OBJECT denotes a live window or internal window.
105Otherwise, return nil; this includes the case where OBJECT is a
106deleted window."
105 (and (windowp object) 107 (and (windowp object)
106 (or (window-buffer object) (window-child object)) 108 (or (window-buffer object) (window-child object))
107 t)) 109 t))
@@ -130,24 +132,21 @@ FRAME must be a live frame and defaults to the selected frame."
130 (error "%s is not a live frame" frame)) 132 (error "%s is not a live frame" frame))
131 (selected-frame))) 133 (selected-frame)))
132 134
133(defsubst window-normalize-any-window (window) 135(defsubst window-normalize-window (window &optional live-only)
134 "Return window specified by WINDOW. 136 "Return window specified by WINDOW.
135WINDOW must be a window that has not been deleted and defaults to 137If WINDOW is nil, return `selected-window'.
136the selected window." 138If WINDOW is a live window or internal window, return WINDOW;
137 (if window 139 if LIVE-ONLY is non-nil, return WINDOW for a live window only.
138 (if (window-any-p window) 140Otherwise, signal an error."
139 window 141 (cond ((null window)
140 (error "%s is not a window" window)) 142 (selected-window))
141 (selected-window))) 143 (live-only
142 144 (if (window-live-p window)
143(defsubst window-normalize-live-window (window) 145 window
144 "Return live window specified by WINDOW. 146 (error "%s is not a live window" window)))
145WINDOW must be a live window and defaults to the selected one." 147 ((if (window-valid-p window)
146 (if window 148 window
147 (if (and (windowp window) (window-buffer window)) 149 (error "%s is not a window" window)))))
148 window
149 (error "%s is not a live window" window))
150 (selected-window)))
151 150
152(defvar ignore-window-parameters nil 151(defvar ignore-window-parameters nil
153 "If non-nil, standard functions ignore window parameters. 152 "If non-nil, standard functions ignore window parameters.
@@ -196,36 +195,35 @@ narrower, explictly specify the SIZE argument of that function."
196 :version "24.1" 195 :version "24.1"
197 :group 'windows) 196 :group 'windows)
198 197
199(defun window-combination-p (&optional window horizontal)
200 "If WINDOW is a vertical combination return WINDOW's first child.
201WINDOW can be any window and defaults to the selected one.
202Optional argument HORIZONTAL non-nil means return WINDOW's first
203child if WINDOW is a horizontal combination."
204 (setq window (window-normalize-any-window window))
205 (if horizontal
206 (window-left-child window)
207 (window-top-child window)))
208
209(defsubst window-combined-p (&optional window horizontal) 198(defsubst window-combined-p (&optional window horizontal)
210 "Return non-nil if and only if WINDOW is vertically combined. 199 "Return non-nil if WINDOW has siblings in a given direction.
211WINDOW can be any window and defaults to the selected one. 200If WINDOW is omitted or nil, it defaults to the selected window.
212Optional argument HORIZONTAL non-nil means return non-nil if and 201
213only if WINDOW is horizontally combined." 202HORIZONTAL determines a direction for the window combination.
214 (setq window (window-normalize-any-window window)) 203If HORIZONTAL is omitted or nil, return non-nil if WINDOW is part
204of a vertical window combination.
205If HORIZONTAL is non-nil, return non-nil if WINDOW is part of a
206horizontal window combination."
207 (setq window (window-normalize-window window))
215 (let ((parent (window-parent window))) 208 (let ((parent (window-parent window)))
216 (and parent (window-combination-p parent horizontal)))) 209 (and parent
210 (if horizontal
211 (window-left-child parent)
212 (window-top-child parent)))))
217 213
218(defun window-combinations (&optional window horizontal) 214(defun window-combinations (&optional window horizontal)
219 "Return largest number of vertically arranged subwindows of WINDOW. 215 "Return largest number of vertically arranged subwindows of WINDOW.
220WINDOW can be any window and defaults to the selected one. 216If WINDOW is omitted or nil, it defaults to the selected window.
221Optional argument HORIZONTAL non-nil means to return the largest 217If HORIZONTAL is non-nil, return the largest number of
222number of horizontally arranged subwindows of WINDOW." 218horizontally arranged subwindows of WINDOW."
223 (setq window (window-normalize-any-window window)) 219 (setq window (window-normalize-window window))
224 (cond 220 (cond
225 ((window-live-p window) 221 ((window-live-p window)
226 ;; If WINDOW is live, return 1. 222 ;; If WINDOW is live, return 1.
227 1) 223 1)
228 ((window-combination-p window horizontal) 224 ((if horizontal
225 (window-left-child window)
226 (window-top-child window))
229 ;; If WINDOW is iso-combined, return the sum of the values for all 227 ;; If WINDOW is iso-combined, return the sum of the values for all
230 ;; subwindows of WINDOW. 228 ;; subwindows of WINDOW.
231 (let ((child (window-child window)) 229 (let ((child (window-child window))
@@ -289,7 +287,7 @@ on all live and internal subwindows of WINDOW.
289This function performs a pre-order, depth-first traversal of the 287This function performs a pre-order, depth-first traversal of the
290window tree rooted at WINDOW. If PROC changes that window tree, 288window tree rooted at WINDOW. If PROC changes that window tree,
291the result is unpredictable." 289the result is unpredictable."
292 (setq window (window-normalize-any-window window)) 290 (setq window (window-normalize-window window))
293 (walk-window-tree-1 proc window any t)) 291 (walk-window-tree-1 proc window any t))
294 292
295(defun windows-with-parameter (parameter &optional value frame any values) 293(defun windows-with-parameter (parameter &optional value frame any values)
@@ -335,7 +333,7 @@ too."
335 "Return root of atomic window WINDOW is a part of. 333 "Return root of atomic window WINDOW is a part of.
336WINDOW can be any window and defaults to the selected one. 334WINDOW can be any window and defaults to the selected one.
337Return nil if WINDOW is not part of a atomic window." 335Return nil if WINDOW is not part of a atomic window."
338 (setq window (window-normalize-any-window window)) 336 (setq window (window-normalize-window window))
339 (let (root) 337 (let (root)
340 (while (and window (window-parameter window 'window-atom)) 338 (while (and window (window-parameter window 'window-atom))
341 (setq root window) 339 (setq root window)
@@ -532,7 +530,7 @@ window).")
532 530
533(defsubst window-size-ignore (window ignore) 531(defsubst window-size-ignore (window ignore)
534 "Return non-nil if IGNORE says to ignore size restrictions for WINDOW." 532 "Return non-nil if IGNORE says to ignore size restrictions for WINDOW."
535 (if (window-any-p ignore) (eq window ignore) ignore)) 533 (if (window-valid-p ignore) (eq window ignore) ignore))
536 534
537(defun window-min-size (&optional window horizontal ignore) 535(defun window-min-size (&optional window horizontal ignore)
538 "Return the minimum number of lines of WINDOW. 536 "Return the minimum number of lines of WINDOW.
@@ -547,7 +545,7 @@ windows may get as small as `window-safe-min-height' lines and
547`window-safe-min-width' columns. IGNORE a window means ignore 545`window-safe-min-width' columns. IGNORE a window means ignore
548restrictions for that window only." 546restrictions for that window only."
549 (window-min-size-1 547 (window-min-size-1
550 (window-normalize-any-window window) horizontal ignore)) 548 (window-normalize-window window) horizontal ignore))
551 549
552(defun window-min-size-1 (window horizontal ignore) 550(defun window-min-size-1 (window horizontal ignore)
553 "Internal function of `window-min-size'." 551 "Internal function of `window-min-size'."
@@ -640,7 +638,7 @@ imposed by fixed size windows, `window-min-height' or
640windows may get as small as `window-safe-min-height' lines and 638windows may get as small as `window-safe-min-height' lines and
641`window-safe-min-width' columns. IGNORE any window means ignore 639`window-safe-min-width' columns. IGNORE any window means ignore
642restrictions for that window only." 640restrictions for that window only."
643 (setq window (window-normalize-any-window window)) 641 (setq window (window-normalize-window window))
644 (cond 642 (cond
645 ((< delta 0) 643 ((< delta 0)
646 (max (- (window-min-size window horizontal ignore) 644 (max (- (window-min-size window horizontal ignore)
@@ -658,7 +656,7 @@ restrictions for that window only."
658 "Return t if WINDOW can be resized by DELTA lines. 656 "Return t if WINDOW can be resized by DELTA lines.
659For the meaning of the arguments of this function see the 657For the meaning of the arguments of this function see the
660doc-string of `window-sizable'." 658doc-string of `window-sizable'."
661 (setq window (window-normalize-any-window window)) 659 (setq window (window-normalize-window window))
662 (if (> delta 0) 660 (if (> delta 0)
663 (>= (window-sizable window delta horizontal ignore) delta) 661 (>= (window-sizable window delta horizontal ignore) delta)
664 (<= (window-sizable window delta horizontal ignore) delta))) 662 (<= (window-sizable window delta horizontal ignore) delta)))
@@ -706,7 +704,7 @@ If this function returns nil, this does not necessarily mean that
706WINDOW can be resized in the desired direction. The functions 704WINDOW can be resized in the desired direction. The functions
707`window-resizable' and `window-resizable-p' will tell that." 705`window-resizable' and `window-resizable-p' will tell that."
708 (window-size-fixed-1 706 (window-size-fixed-1
709 (window-normalize-any-window window) horizontal)) 707 (window-normalize-window window) horizontal))
710 708
711(defun window-min-delta-1 (window delta &optional horizontal ignore trail noup) 709(defun window-min-delta-1 (window delta &optional horizontal ignore trail noup)
712 "Internal function for `window-min-delta'." 710 "Internal function for `window-min-delta'."
@@ -772,7 +770,7 @@ tree but try to enlarge windows within WINDOW's combination only.
772Optional argument NODOWN non-nil means don't check whether WINDOW 770Optional argument NODOWN non-nil means don't check whether WINDOW
773itself \(and its subwindows) can be shrunk; check only whether at 771itself \(and its subwindows) can be shrunk; check only whether at
774least one other windows can be enlarged appropriately." 772least one other windows can be enlarged appropriately."
775 (setq window (window-normalize-any-window window)) 773 (setq window (window-normalize-window window))
776 (let ((size (window-total-size window horizontal)) 774 (let ((size (window-total-size window horizontal))
777 (minimum (window-min-size window horizontal ignore))) 775 (minimum (window-min-size window horizontal ignore)))
778 (cond 776 (cond
@@ -854,7 +852,7 @@ WINDOW's combination.
854Optional argument NODOWN non-nil means do not check whether 852Optional argument NODOWN non-nil means do not check whether
855WINDOW itself \(and its subwindows) can be enlarged; check only 853WINDOW itself \(and its subwindows) can be enlarged; check only
856whether other windows can be shrunk appropriately." 854whether other windows can be shrunk appropriately."
857 (setq window (window-normalize-any-window window)) 855 (setq window (window-normalize-window window))
858 (if (and (not (window-size-ignore window ignore)) 856 (if (and (not (window-size-ignore window ignore))
859 (not nodown) (window-size-fixed-p window horizontal)) 857 (not nodown) (window-size-fixed-p window horizontal))
860 ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed 858 ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed
@@ -898,7 +896,7 @@ within WINDOW's combination.
898 896
899Optional argument NODOWN non-nil means don't check whether WINDOW 897Optional argument NODOWN non-nil means don't check whether WINDOW
900and its subwindows can be resized." 898and its subwindows can be resized."
901 (setq window (window-normalize-any-window window)) 899 (setq window (window-normalize-window window))
902 (cond 900 (cond
903 ((< delta 0) 901 ((< delta 0)
904 (max (- (window-min-delta window horizontal ignore trail noup nodown)) 902 (max (- (window-min-delta window horizontal ignore trail noup nodown))
@@ -912,7 +910,7 @@ and its subwindows can be resized."
912 "Return t if WINDOW can be resized vertically by DELTA lines. 910 "Return t if WINDOW can be resized vertically by DELTA lines.
913For the meaning of the arguments of this function see the 911For the meaning of the arguments of this function see the
914doc-string of `window-resizable'." 912doc-string of `window-resizable'."
915 (setq window (window-normalize-any-window window)) 913 (setq window (window-normalize-window window))
916 (if (> delta 0) 914 (if (> delta 0)
917 (>= (window-resizable window delta horizontal ignore trail noup nodown) 915 (>= (window-resizable window delta horizontal ignore trail noup nodown)
918 delta) 916 delta)
@@ -941,7 +939,7 @@ More precisely, return t if and only if the total height of
941WINDOW equals the total height of the root window of WINDOW's 939WINDOW equals the total height of the root window of WINDOW's
942frame. WINDOW can be any window and defaults to the selected 940frame. WINDOW can be any window and defaults to the selected
943one." 941one."
944 (setq window (window-normalize-any-window window)) 942 (setq window (window-normalize-window window))
945 (= (window-total-size window) 943 (= (window-total-size window)
946 (window-total-size (frame-root-window window)))) 944 (window-total-size (frame-root-window window))))
947 945
@@ -960,7 +958,7 @@ otherwise."
960More precisely, return t if and only if the total width of WINDOW 958More precisely, return t if and only if the total width of WINDOW
961equals the total width of the root window of WINDOW's frame. 959equals the total width of the root window of WINDOW's frame.
962WINDOW can be any window and defaults to the selected one." 960WINDOW can be any window and defaults to the selected one."
963 (setq window (window-normalize-any-window window)) 961 (setq window (window-normalize-window window))
964 (= (window-total-size window t) 962 (= (window-total-size window t)
965 (window-total-size (frame-root-window window) t))) 963 (window-total-size (frame-root-window window) t)))
966 964
@@ -1015,7 +1013,7 @@ or nil).
1015Unlike `window-scroll-bars', this function reports the scroll bar 1013Unlike `window-scroll-bars', this function reports the scroll bar
1016type actually used, once frame defaults and `scroll-bar-mode' are 1014type actually used, once frame defaults and `scroll-bar-mode' are
1017taken into account." 1015taken into account."
1018 (setq window (window-normalize-live-window window)) 1016 (setq window (window-normalize-window window t))
1019 (let ((vert (nth 2 (window-scroll-bars window))) 1017 (let ((vert (nth 2 (window-scroll-bars window)))
1020 (hor nil)) 1018 (hor nil))
1021 (when (or (eq vert t) (eq hor t)) 1019 (when (or (eq vert t) (eq hor t))
@@ -1079,7 +1077,7 @@ WINDOW can be any live window and defaults to the selected one.
1079This function is like `window-point' with one exception: If 1077This function is like `window-point' with one exception: If
1080WINDOW is selected, it returns the value of `point' of WINDOW's 1078WINDOW is selected, it returns the value of `point' of WINDOW's
1081buffer regardless of whether that buffer is current or not." 1079buffer regardless of whether that buffer is current or not."
1082 (setq window (window-normalize-live-window window)) 1080 (setq window (window-normalize-window window t))
1083 (if (eq window (selected-window)) 1081 (if (eq window (selected-window))
1084 (with-current-buffer (window-buffer window) 1082 (with-current-buffer (window-buffer window)
1085 (point)) 1083 (point))
@@ -1092,7 +1090,7 @@ WINDOW can be any live window and defaults to the selected one.
1092This function is like `set-window-point' with one exception: If 1090This function is like `set-window-point' with one exception: If
1093WINDOW is selected, it moves `point' of WINDOW's buffer to POS 1091WINDOW is selected, it moves `point' of WINDOW's buffer to POS
1094regardless of whether that buffer is current or not." 1092regardless of whether that buffer is current or not."
1095 (setq window (window-normalize-live-window window)) 1093 (setq window (window-normalize-window window t))
1096 (if (eq window (selected-window)) 1094 (if (eq window (selected-window))
1097 (with-current-buffer (window-buffer window) 1095 (with-current-buffer (window-buffer window)
1098 (goto-char pos)) 1096 (goto-char pos))
@@ -1103,7 +1101,7 @@ regardless of whether that buffer is current or not."
1103WINDOW can be any window and defaults to the selected one. SIDE 1101WINDOW can be any window and defaults to the selected one. SIDE
1104can be any of the symbols `left', `top', `right' or `bottom'. 1102can be any of the symbols `left', `top', `right' or `bottom'.
1105The default value nil is handled like `bottom'." 1103The default value nil is handled like `bottom'."
1106 (setq window (window-normalize-any-window window)) 1104 (setq window (window-normalize-window window))
1107 (let ((edge 1105 (let ((edge
1108 (cond 1106 (cond
1109 ((eq side 'left) 0) 1107 ((eq side 'left) 0)
@@ -1145,7 +1143,7 @@ DIRECTION must be one of `above', `below', `left' or `right'.
1145WINDOW must be a live window and defaults to the selected one. 1143WINDOW must be a live window and defaults to the selected one.
1146IGNORE, when non-nil means a window can be returned even if its 1144IGNORE, when non-nil means a window can be returned even if its
1147`no-other-window' parameter is non-nil." 1145`no-other-window' parameter is non-nil."
1148 (setq window (window-normalize-live-window window)) 1146 (setq window (window-normalize-window window t))
1149 (unless (memq direction '(above below left right)) 1147 (unless (memq direction '(above below left right))
1150 (error "Wrong direction %s" direction)) 1148 (error "Wrong direction %s" direction))
1151 (let* ((frame (window-frame window)) 1149 (let* ((frame (window-frame window))
@@ -1500,7 +1498,7 @@ This function resizes other windows proportionally and never
1500deletes any windows. If you want to move only the low (right) 1498deletes any windows. If you want to move only the low (right)
1501edge of WINDOW consider using `adjust-window-trailing-edge' 1499edge of WINDOW consider using `adjust-window-trailing-edge'
1502instead." 1500instead."
1503 (setq window (window-normalize-any-window window)) 1501 (setq window (window-normalize-window window))
1504 (let* ((frame (window-frame window)) 1502 (let* ((frame (window-frame window))
1505 sibling) 1503 sibling)
1506 (cond 1504 (cond
@@ -2019,7 +2017,7 @@ If DELTA is greater zero, then move the edge downwards or to the
2019right. If DELTA is less than zero, move the edge upwards or to 2017right. If DELTA is less than zero, move the edge upwards or to
2020the left. If the edge can't be moved by DELTA lines or columns, 2018the left. If the edge can't be moved by DELTA lines or columns,
2021move it as far as possible in the desired direction." 2019move it as far as possible in the desired direction."
2022 (setq window (window-normalize-any-window window)) 2020 (setq window (window-normalize-window window))
2023 (let ((frame (window-frame window)) 2021 (let ((frame (window-frame window))
2024 (right window) 2022 (right window)
2025 left this-delta min-delta max-delta failed) 2023 left this-delta min-delta max-delta failed)
@@ -2166,7 +2164,7 @@ Return nil."
2166Make WINDOW as large as possible without deleting any windows. 2164Make WINDOW as large as possible without deleting any windows.
2167WINDOW can be any window and defaults to the selected window." 2165WINDOW can be any window and defaults to the selected window."
2168 (interactive) 2166 (interactive)
2169 (setq window (window-normalize-any-window window)) 2167 (setq window (window-normalize-window window))
2170 (window-resize window (window-max-delta window)) 2168 (window-resize window (window-max-delta window))
2171 (window-resize window (window-max-delta window t) t)) 2169 (window-resize window (window-max-delta window t) t))
2172 2170
@@ -2175,7 +2173,7 @@ WINDOW can be any window and defaults to the selected window."
2175Make WINDOW as small as possible without deleting any windows. 2173Make WINDOW as small as possible without deleting any windows.
2176WINDOW can be any window and defaults to the selected window." 2174WINDOW can be any window and defaults to the selected window."
2177 (interactive) 2175 (interactive)
2178 (setq window (window-normalize-any-window window)) 2176 (setq window (window-normalize-window window))
2179 (window-resize window (- (window-min-delta window))) 2177 (window-resize window (- (window-min-delta window)))
2180 (window-resize window (- (window-min-delta window t)) t)) 2178 (window-resize window (- (window-min-delta window t)) t))
2181 2179
@@ -2331,7 +2329,7 @@ and no others."
2331 "Return t if WINDOW can be safely deleted from its frame. 2329 "Return t if WINDOW can be safely deleted from its frame.
2332Return `frame' if deleting WINDOW should also delete its 2330Return `frame' if deleting WINDOW should also delete its
2333frame." 2331frame."
2334 (setq window (window-normalize-any-window window)) 2332 (setq window (window-normalize-window window))
2335 2333
2336 (unless ignore-window-parameters 2334 (unless ignore-window-parameters
2337 ;; Handle atomicity. 2335 ;; Handle atomicity.
@@ -2381,7 +2379,7 @@ Otherwise, if WINDOW is part of an atomic window, call
2381argument. If WINDOW is the only window on its frame or the last 2379argument. If WINDOW is the only window on its frame or the last
2382non-side window, signal an error." 2380non-side window, signal an error."
2383 (interactive) 2381 (interactive)
2384 (setq window (window-normalize-any-window window)) 2382 (setq window (window-normalize-window window))
2385 (let* ((frame (window-frame window)) 2383 (let* ((frame (window-frame window))
2386 (function (window-parameter window 'delete-window)) 2384 (function (window-parameter window 'delete-window))
2387 (parent (window-parent window)) 2385 (parent (window-parent window))
@@ -2462,7 +2460,7 @@ WINDOW is a non-side window, make WINDOW the only non-side window
2462on the frame. Side windows are not deleted. If WINDOW is a side 2460on the frame. Side windows are not deleted. If WINDOW is a side
2463window signal an error." 2461window signal an error."
2464 (interactive) 2462 (interactive)
2465 (setq window (window-normalize-any-window window)) 2463 (setq window (window-normalize-window window))
2466 (let* ((frame (window-frame window)) 2464 (let* ((frame (window-frame window))
2467 (function (window-parameter window 'delete-other-windows)) 2465 (function (window-parameter window 'delete-other-windows))
2468 (window-side (window-parameter window 'window-side)) 2466 (window-side (window-parameter window 'window-side))
@@ -2544,7 +2542,7 @@ This may be a useful alternative binding for \\[delete-other-windows]
2544(defun record-window-buffer (&optional window) 2542(defun record-window-buffer (&optional window)
2545 "Record WINDOW's buffer. 2543 "Record WINDOW's buffer.
2546WINDOW must be a live window and defaults to the selected one." 2544WINDOW must be a live window and defaults to the selected one."
2547 (let* ((window (window-normalize-live-window window)) 2545 (let* ((window (window-normalize-window window t))
2548 (buffer (window-buffer window)) 2546 (buffer (window-buffer window))
2549 (entry (assq buffer (window-prev-buffers window)))) 2547 (entry (assq buffer (window-prev-buffers window))))
2550 ;; Reset WINDOW's next buffers. If needed, they are resurrected by 2548 ;; Reset WINDOW's next buffers. If needed, they are resurrected by
@@ -2580,7 +2578,7 @@ WINDOW must be a live window and defaults to the selected one."
2580WINDOW must be a live window and defaults to the selected one. 2578WINDOW must be a live window and defaults to the selected one.
2581BUFFER must be a live buffer and defaults to the buffer of 2579BUFFER must be a live buffer and defaults to the buffer of
2582WINDOW." 2580WINDOW."
2583 (let* ((window (window-normalize-live-window window)) 2581 (let* ((window (window-normalize-window window t))
2584 (buffer (or buffer (window-buffer window)))) 2582 (buffer (or buffer (window-buffer window))))
2585 (set-window-prev-buffers 2583 (set-window-prev-buffers
2586 window (assq-delete-all buffer (window-prev-buffers window))) 2584 window (assq-delete-all buffer (window-prev-buffers window)))
@@ -2613,7 +2611,7 @@ Optional argument BURY-OR-KILL non-nil means the buffer currently
2613shown in WINDOW is about to be buried or killed and consequently 2611shown in WINDOW is about to be buried or killed and consequently
2614shall not be switched to in future invocations of this command." 2612shall not be switched to in future invocations of this command."
2615 (interactive) 2613 (interactive)
2616 (let* ((window (window-normalize-live-window window)) 2614 (let* ((window (window-normalize-window window t))
2617 (old-buffer (window-buffer window)) 2615 (old-buffer (window-buffer window))
2618 ;; Save this since it's destroyed by `set-window-buffer'. 2616 ;; Save this since it's destroyed by `set-window-buffer'.
2619 (next-buffers (window-next-buffers window)) 2617 (next-buffers (window-next-buffers window))
@@ -2702,7 +2700,7 @@ shall not be switched to in future invocations of this command."
2702 "In WINDOW switch to next buffer. 2700 "In WINDOW switch to next buffer.
2703WINDOW must be a live window and defaults to the selected one." 2701WINDOW must be a live window and defaults to the selected one."
2704 (interactive) 2702 (interactive)
2705 (let* ((window (window-normalize-live-window window)) 2703 (let* ((window (window-normalize-window window t))
2706 (old-buffer (window-buffer window)) 2704 (old-buffer (window-buffer window))
2707 (next-buffers (window-next-buffers window)) 2705 (next-buffers (window-next-buffers window))
2708 new-buffer entry killed-buffers visible) 2706 new-buffer entry killed-buffers visible)
@@ -2825,7 +2823,7 @@ Optional argument DEDICATED-ONLY non-nil means to delete WINDOW
2825only if it's dedicated to its buffer. Optional argument KILL 2823only if it's dedicated to its buffer. Optional argument KILL
2826means the buffer shown in window will be killed. Return non-nil 2824means the buffer shown in window will be killed. Return non-nil
2827if WINDOW gets deleted or its frame is auto-hidden." 2825if WINDOW gets deleted or its frame is auto-hidden."
2828 (setq window (window-normalize-live-window window)) 2826 (setq window (window-normalize-window window t))
2829 (unless (and dedicated-only (not (window-dedicated-p window))) 2827 (unless (and dedicated-only (not (window-dedicated-p window)))
2830 (let* ((buffer (window-buffer window)) 2828 (let* ((buffer (window-buffer window))
2831 (deletable (window-deletable-p window))) 2829 (deletable (window-deletable-p window)))
@@ -2971,7 +2969,7 @@ WINDOW, \(3) restore the buffer previously displayed in WINDOW,
2971or \(4) make WINDOW display some other buffer than the present 2969or \(4) make WINDOW display some other buffer than the present
2972one. If non-nil, reset `quit-restore' parameter to nil." 2970one. If non-nil, reset `quit-restore' parameter to nil."
2973 (interactive "P") 2971 (interactive "P")
2974 (setq window (window-normalize-live-window window)) 2972 (setq window (window-normalize-window window t))
2975 (let* ((buffer (window-buffer window)) 2973 (let* ((buffer (window-buffer window))
2976 (quit-restore (window-parameter window 'quit-restore)) 2974 (quit-restore (window-parameter window 'quit-restore))
2977 (prev-buffer 2975 (prev-buffer
@@ -3103,7 +3101,7 @@ window, these properties as well as the buffer displayed in the
3103new window are inherited from the window selected on WINDOW's 3101new window are inherited from the window selected on WINDOW's
3104frame. The selected window is not changed by this function." 3102frame. The selected window is not changed by this function."
3105 (interactive "i") 3103 (interactive "i")
3106 (setq window (window-normalize-any-window window)) 3104 (setq window (window-normalize-window window))
3107 (let* ((side (cond 3105 (let* ((side (cond
3108 ((not side) 'below) 3106 ((not side) 'below)
3109 ((memq side '(below above right left)) side) 3107 ((memq side '(below above right left)) side)
@@ -3677,7 +3675,7 @@ to put the state recorded here into an arbitrary window. The
3677value can be also stored on disk and read back in a new session." 3675value can be also stored on disk and read back in a new session."
3678 (setq window 3676 (setq window
3679 (if window 3677 (if window
3680 (if (window-any-p window) 3678 (if (window-valid-p window)
3681 window 3679 window
3682 (error "%s is not a live or internal window" window)) 3680 (error "%s is not a live or internal window" window))
3683 (frame-root-window))) 3681 (frame-root-window)))
@@ -3847,7 +3845,7 @@ Optional argument IGNORE non-nil means ignore minimum window
3847sizes and fixed size restrictions. IGNORE equal `safe' means 3845sizes and fixed size restrictions. IGNORE equal `safe' means
3848subwindows can get as small as `window-safe-min-height' and 3846subwindows can get as small as `window-safe-min-height' and
3849`window-safe-min-width'." 3847`window-safe-min-width'."
3850 (setq window (window-normalize-live-window window)) 3848 (setq window (window-normalize-window window t))
3851 (let* ((frame (window-frame window)) 3849 (let* ((frame (window-frame window))
3852 (head (car state)) 3850 (head (car state))
3853 ;; We check here (1) whether the total sizes of root window of 3851 ;; We check here (1) whether the total sizes of root window of
@@ -5113,7 +5111,7 @@ Note that the current implementation of this function cannot
5113always set the height exactly, but attempts to be conservative, 5111always set the height exactly, but attempts to be conservative,
5114by allocating more lines than are actually needed in the case 5112by allocating more lines than are actually needed in the case
5115where some error may be present." 5113where some error may be present."
5116 (setq window (window-normalize-live-window window)) 5114 (setq window (window-normalize-window window t))
5117 (let ((delta (- height (window-text-height window)))) 5115 (let ((delta (- height (window-text-height window))))
5118 (unless (zerop delta) 5116 (unless (zerop delta)
5119 ;; Setting window-min-height to a value like 1 can lead to very 5117 ;; Setting window-min-height to a value like 1 can lead to very
@@ -5209,7 +5207,7 @@ WINDOW was scrolled."
5209 (interactive) 5207 (interactive)
5210 ;; Do all the work in WINDOW and its buffer and restore the selected 5208 ;; Do all the work in WINDOW and its buffer and restore the selected
5211 ;; window and the current buffer when we're done. 5209 ;; window and the current buffer when we're done.
5212 (setq window (window-normalize-live-window window)) 5210 (setq window (window-normalize-window window t))
5213 ;; Can't resize a full height or fixed-size window. 5211 ;; Can't resize a full height or fixed-size window.
5214 (unless (or (window-size-fixed-p window) 5212 (unless (or (window-size-fixed-p window)
5215 (window-full-height-p window)) 5213 (window-full-height-p window))
@@ -5315,7 +5313,7 @@ window, or if the window is the only window of its frame.
5315 5313
5316Return non-nil if the window was shrunk, nil otherwise." 5314Return non-nil if the window was shrunk, nil otherwise."
5317 (interactive) 5315 (interactive)
5318 (setq window (window-normalize-live-window window)) 5316 (setq window (window-normalize-window window t))
5319 ;; Make sure that WINDOW is vertically combined and `point-min' is 5317 ;; Make sure that WINDOW is vertically combined and `point-min' is
5320 ;; visible (for whatever reason that's needed). The remaining issues 5318 ;; visible (for whatever reason that's needed). The remaining issues
5321 ;; should be taken care of by `fit-window-to-buffer'. 5319 ;; should be taken care of by `fit-window-to-buffer'.
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 64b9577e362..fc612d64fa8 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,40 @@
12011-11-05 Christoph Scholtes <cschol2112@googlemail.com>
2
3 * inc/stdint.h (UINT64_MAX, UINT64_MIN, INT64_MIN, UINTMAX_MAX)
4 (UINTMAX_MIN, INTMAX_MAX, INTMAX_MIN, UINT32_MIN, UINT32_MAX)
5 (INT32_MIN, UINTMAX_MAX, UINTMAX_MIN, INTMAX_MAX, INTMAX_MIN)
6 (intmax_t, INT64_MAX): Add for MSVC.
7
8 * config.nt: (mode_t) [!__GNUC__]: Define mode_t for MSVC.
9
102011-11-05 Eli Zaretskii <eliz@gnu.org>
11
12 * config.nt (inline) [!__GNUC__]: Define to __inline for MSVC.
13
14 Support MSVC build with newer versions of Visual Studio.
15 * makefile.w32-in (clean-other-dirs-nmake)
16 (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake):
17 Update for current structure of doc/ subdirectories.
18
19 * gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables.
20
21 * INSTALL: Update for newer versions of MSVC.
22
232011-11-05 Fabrice Popineau <fabrice.popineau@supelec.fr> (tiny change)
24
25 Support MSVC build with newer versions of Visual Studio.
26 * nmake.defs (USE_CRT_DLL): Define to 1.
27 (libc, EMACS_EXTRA_C_FLAGS, SYS_LDFLAGS, ARCH_CFLAGS): Update values.
28 (D): New variable.
29
302011-11-04 Eli Zaretskii <eliz@gnu.org>
31
32 * runemacs.c (ensure_unicows_dll): New function, tries to load
33 UNICOWS.DLL on Windows 9X.
34 (WinMain): If ensure_unicows_dll fails to find UNICOWS.DLL,
35 display a dialog to the effect that Emacs cannot be started.
36 (Bug#8562)
37
12011-10-28 Eli Zaretskii <eliz@gnu.org> 382011-10-28 Eli Zaretskii <eliz@gnu.org>
2 39
3 * README.W32: Mention UNICOWS.DLL as prerequisite for running 40 * README.W32: Mention UNICOWS.DLL as prerequisite for running
diff --git a/nt/INSTALL b/nt/INSTALL
index 613610890ae..63285047a67 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -21,19 +21,32 @@
21 21
22 cd nt 22 cd nt
23 23
24 2. Run configure.bat. From the COMMAND.COM/CMD.EXE command prompt: 24 2. Run configure.bat.
25
26 2a.If you use MSVC, set up the build environment by running the
27 SetEnv.cmd batch file from the appropriate SDK directory. (Skip
28 this step if you are using MinGW.) For example:
29
30 "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /Debug
31
32 if you are goiung to compile a debug version, or
33
34 "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /Release
35
36 if you are going to compile an optimized version.
37
38 2b.From the COMMAND.COM/CMD.EXE command prompt type:
25 39
26 configure 40 configure
27 41
28 from a Unixy shell prompt: 42 From a Unixy shell prompt:
29 43
30 cmd /c configure.bat 44 cmd /c configure.bat
31 or 45 or
32 command.com /c configure.bat 46 command.com /c configure.bat
33 47
34 3. Run the Make utility suitable for your environment. If you build 48 3. Run the Make utility suitable for your environment. If you build
35 with the Microsoft's Visual C compiler (but see notes about using 49 with the Microsoft's Visual C compiler:
36 VC++ 8.0 and later below):
37 50
38 nmake 51 nmake
39 52
@@ -101,24 +114,21 @@
101* Supported development environments 114* Supported development environments
102 115
103 To compile Emacs, you will need either Microsoft Visual C++ 2.0, or 116 To compile Emacs, you will need either Microsoft Visual C++ 2.0, or
104 later up to 7.0, and nmake, or a Windows port of GCC 2.95 or later 117 later and nmake, or a Windows port of GCC 2.95 or later with MinGW
105 with MinGW and W32 API support and a port of GNU Make. You can use 118 and W32 API support and a port of GNU Make. You can use the Cygwin
106 the Cygwin ports of GCC, but Emacs requires the MinGW headers and 119 ports of GCC, but Emacs requires the MinGW headers and libraries to
107 libraries to build (latest versions of the Cygwin toolkit, at least 120 build (latest versions of the Cygwin toolkit, at least since v1.3.3,
108 since v1.3.3, include the MinGW headers and libraries as an integral 121 include the MinGW headers and libraries as an integral part).
109 part).
110
111 Note that building Emacs with Visual Studio 2005 (VC++ 8.0) and
112 later is not supported at this time, due to changes introduced by
113 Microsoft into the libraries shipped with the compiler.
114 122
115 The rest of this file assumes you have a working development 123 The rest of this file assumes you have a working development
116 environment. If you just installed such an environment, try 124 environment. If you just installed such an environment, try
117 building a trivial C "Hello world" program, and see if it works. If 125 building a trivial C "Hello world" program, and see if it works. If
118 it doesn't work, resolve that problem first! If you use Microsoft 126 it doesn't work, resolve that problem first! If you use Microsoft
119 Visual Studio .NET 2003, don't forget to run the VCVARS32.BAT batch 127 Visual Studio .NET 2003, don't forget to run the VCVARS32.BAT batch
120 file from the `Bin' subdirectory of the directory where you have 128 file from the `Bin' subdirectory of the directory where you have
121 installed VS.NET. 129 installed VS.NET. With other versions of MSVC, run the SetEnv.cmd
130 batch file from the `Bin' subdirectory of the directory where you
131 have the SDK installed.
122 132
123 If you use the MinGW port of GCC and GNU Make to build Emacs, there 133 If you use the MinGW port of GCC and GNU Make to build Emacs, there
124 are some compatibility issues wrt Make and the shell that is run by 134 are some compatibility issues wrt Make and the shell that is run by
diff --git a/nt/config.nt b/nt/config.nt
index 87c5f5cc8aa..3a06a9f5b7a 100644
--- a/nt/config.nt
+++ b/nt/config.nt
@@ -328,9 +328,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
328 328
329/* Define to `__inline__' or `__inline' if that's what the C compiler 329/* Define to `__inline__' or `__inline' if that's what the C compiler
330 calls it, or to nothing if 'inline' is not supported under any name. */ 330 calls it, or to nothing if 'inline' is not supported under any name. */
331#ifdef __GNUC__
331#ifndef __cplusplus 332#ifndef __cplusplus
332#undef inline 333#undef inline
333#endif 334#endif
335#else /* MSVC */
336#define inline __inline
337#endif
334 338
335/* Define to the equivalent of the C99 'restrict' keyword, or to 339/* Define to the equivalent of the C99 'restrict' keyword, or to
336 nothing if this is not supported. Do not define if restrict is 340 nothing if this is not supported. Do not define if restrict is
@@ -341,6 +345,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
341# define restrict 345# define restrict
342#endif 346#endif
343 347
348/* `mode_t' is not defined for MSVC. Define. */
349#ifdef _MSC_VER
350typedef unsigned short mode_t;
351#endif
352
344/* A va_copy replacement for MSVC. */ 353/* A va_copy replacement for MSVC. */
345#ifdef _MSC_VER 354#ifdef _MSC_VER
346# ifdef _WIN64 355# ifdef _WIN64
diff --git a/nt/gmake.defs b/nt/gmake.defs
index bbb560264c5..46d4acf76dd 100644
--- a/nt/gmake.defs
+++ b/nt/gmake.defs
@@ -193,6 +193,11 @@ OLE32 = -lole32
193UNISCRIBE = -lusp10 193UNISCRIBE = -lusp10
194UUID = -luuid 194UUID = -luuid
195 195
196# Used by src/makefile.w32-in, since Nmake barfs on $(func SOMETHING)
197OBJ0_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
198OBJ1_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
199OBJ2_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2))
200
196ifdef NOOPT 201ifdef NOOPT
197DEBUG_CFLAGS = -DEMACSDEBUG 202DEBUG_CFLAGS = -DEMACSDEBUG
198else 203else
diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h
index 4af0346af2c..5242a45df44 100644
--- a/nt/inc/stdint.h
+++ b/nt/inc/stdint.h
@@ -27,20 +27,34 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27/* Minimum definitions to allow compilation with tool chains where 27/* Minimum definitions to allow compilation with tool chains where
28 stdint.h is not available, e.g. Microsoft Visual Studio. */ 28 stdint.h is not available, e.g. Microsoft Visual Studio. */
29 29
30typedef unsigned int uint32_t; 30#ifdef _WIN64
31#define INT32_MAX 2147483647 31typedef __int64 intptr_t;
32#define UINT64_MAX 18446744073709551616
33#define UINT64_MIN 0
32/* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */ 34/* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */
33#define INT64_MAX 9223372036854775807i64 35#define INT64_MAX 9223372036854775807i64
34 36#define INT64_MIN (~INT64_MAX)
35#ifdef _WIN64
36 typedef __int64 intptr_t;
37#define INTPTR_MAX INT64_MAX 37#define INTPTR_MAX INT64_MAX
38#define UINTMAX_MAX UINT64_MAX
39#define UINTMAX_MIN UINT64_MIN
40#define INTMAX_MAX INT64_MAX
41#define INTMAX_MIN INT64_MIN
38#else 42#else
39 typedef int intptr_t; 43typedef int intptr_t;
44typedef unsigned int uint32_t;
45#define UINT32_MAX 4294967296
46#define UINT32_MIN 0
47#define INT32_MAX 2147483647
48#define INT32_MIN (~INT32_MAX)
40#define INTPTR_MAX INT32_MAX 49#define INTPTR_MAX INT32_MAX
50#define UINTMAX_MAX UINT32_MAX
51#define UINTMAX_MIN UINT32_MIN
52#define INTMAX_MAX INT32_MAX
53#define INTMAX_MIN INT32_MIN
41#endif 54#endif
42 55
43#define uintmax_t unsigned __int64 56#define uintmax_t unsigned __int64
57#define intmax_t __int64
44#define PTRDIFF_MAX INTPTR_MAX 58#define PTRDIFF_MAX INTPTR_MAX
45 59
46#endif /* !__GNUC__ */ 60#endif /* !__GNUC__ */
diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in
index 05631855f6a..194f0759bbf 100644
--- a/nt/makefile.w32-in
+++ b/nt/makefile.w32-in
@@ -313,15 +313,15 @@ clean-other-dirs-nmake:
313 $(MAKE) $(MFLAGS) clean 313 $(MAKE) $(MFLAGS) clean
314 cd ..\doc\lispintro 314 cd ..\doc\lispintro
315 $(MAKE) $(MFLAGS) clean 315 $(MAKE) $(MFLAGS) clean
316 cd ..\doc\lispref 316 cd ..\lispref
317 $(MAKE) $(MFLAGS) clean 317 $(MAKE) $(MFLAGS) clean
318 cd ..\leim 318 cd ..\..\leim
319 $(MAKE) $(MFLAGS) clean 319 $(MAKE) $(MFLAGS) clean
320 cd ..\doc\emacs 320 cd ..\doc\emacs
321 $(MAKE) $(MFLAGS) clean 321 $(MAKE) $(MFLAGS) clean
322 cd ..\doc\misc 322 cd ..\misc
323 $(MAKE) $(MFLAGS) clean 323 $(MAKE) $(MFLAGS) clean
324 cd ..\nt 324 cd ..\..\nt
325 325
326clean-other-dirs-gmake: 326clean-other-dirs-gmake:
327 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean 327 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
@@ -381,13 +381,13 @@ distclean-other-dirs-nmake:
381 $(MAKE) $(MFLAGS) distclean 381 $(MAKE) $(MFLAGS) distclean
382 cd ..\doc\emacs 382 cd ..\doc\emacs
383 $(MAKE) $(MFLAGS) distclean 383 $(MAKE) $(MFLAGS) distclean
384 cd ..\doc\misc 384 cd ..\misc
385 $(MAKE) $(MFLAGS) distclean 385 $(MAKE) $(MFLAGS) distclean
386 cd ..\doc\lispintro 386 cd ..\lispintro
387 $(MAKE) $(MFLAGS) distclean 387 $(MAKE) $(MFLAGS) distclean
388 cd ..\doc\lispref 388 cd ..\lispref
389 $(MAKE) $(MFLAGS) distclean 389 $(MAKE) $(MFLAGS) distclean
390 cd ..\nt 390 cd ..\..\nt
391 391
392distclean-other-dirs-gmake: 392distclean-other-dirs-gmake:
393 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean 393 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
@@ -415,13 +415,13 @@ maintainer-clean-other-dirs-nmake:
415 $(MAKE) $(MFLAGS) maintainer-clean 415 $(MAKE) $(MFLAGS) maintainer-clean
416 cd ..\doc\emacs 416 cd ..\doc\emacs
417 $(MAKE) $(MFLAGS) maintainer-clean 417 $(MAKE) $(MFLAGS) maintainer-clean
418 cd ..\doc\misc 418 cd ..\misc
419 $(MAKE) $(MFLAGS) maintainer-clean 419 $(MAKE) $(MFLAGS) maintainer-clean
420 cd ..\doc\lispintro 420 cd ..\lispintro
421 $(MAKE) $(MFLAGS) maintainer-clean 421 $(MAKE) $(MFLAGS) maintainer-clean
422 cd ..\doc\lispref 422 cd ..\lispref
423 $(MAKE) $(MFLAGS) maintainer-clean 423 $(MAKE) $(MFLAGS) maintainer-clean
424 cd ..\nt 424 cd ..\..\nt
425 425
426maintainer-clean-other-dirs-gmake: 426maintainer-clean-other-dirs-gmake:
427 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean 427 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
diff --git a/nt/nmake.defs b/nt/nmake.defs
index 6c0922d78b9..4a7d93d40dd 100644
--- a/nt/nmake.defs
+++ b/nt/nmake.defs
@@ -109,7 +109,15 @@ RC = rc
109RC_OUT = -Fo 109RC_OUT = -Fo
110RC_INCLUDE = -i 110RC_INCLUDE = -i
111 111
112libc = libc.lib 112USE_CRT_DLL = 1
113
114!ifdef USE_CRT_DLL
115libc = msvcrt$(D).lib
116EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
117!else
118libc = libcmt$(D).lib
119EMACS_EXTRA_C_FLAGS= -D_MT
120!endif
113baselibs = 121baselibs =
114O = obj 122O = obj
115A = lib 123A = lib
@@ -146,9 +154,13 @@ CFLAGS = -I. $(ARCH_CFLAGS) \
146 $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS) 154 $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
147ESC_CFLAGS = -I. $(ARCH_CFLAGS) \ 155ESC_CFLAGS = -I. $(ARCH_CFLAGS) \
148 $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS) 156 $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
149EMACS_EXTRA_C_FLAGS =
150 157
151SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj 158#SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
159!ifdef NOOPT
160SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -debug -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
161!else
162SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
163!endif
152 164
153# see comments in allocate_heap in w32heap.c before changing any of the 165# see comments in allocate_heap in w32heap.c before changing any of the
154# -stack, -heap, or -base settings. 166# -stack, -heap, or -base settings.
@@ -184,16 +196,20 @@ DEL_TREE = rm -r
184!ifdef NODEBUG 196!ifdef NODEBUG
185DEBUG_FLAG = 197DEBUG_FLAG =
186DEBUG_LINK = 198DEBUG_LINK =
199D =
187!else 200!else
188DEBUG_FLAG = -Zi 201DEBUG_FLAG = -Zi
189DEBUG_LINK = -debug:full 202DEBUG_LINK = -debug
203D = d
190!endif 204!endif
191 205
192!if "$(ARCH)" == "i386" 206!if "$(ARCH)" == "i386"
193!ifdef NOOPT 207!ifdef NOOPT
194ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG) 208#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
209ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Od -Gd $(DEBUG_FLAG)
195!else 210!else
196ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG) 211#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
212ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Oi -Ot -Oy- -Ob2 -GF -Gy -Gd $(DEBUG_FLAG)
197!endif 213!endif
198ARCH_LDFLAGS = $(SYS_LDFLAGS) 214ARCH_LDFLAGS = $(SYS_LDFLAGS)
199 215
diff --git a/nt/runemacs.c b/nt/runemacs.c
index 07e24f745f8..47b8f54bb02 100644
--- a/nt/runemacs.c
+++ b/nt/runemacs.c
@@ -45,6 +45,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#include <malloc.h> 45#include <malloc.h>
46 46
47static void set_user_model_id (void); 47static void set_user_model_id (void);
48static int ensure_unicows_dll (void);
48 49
49int WINAPI 50int WINAPI
50WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) 51WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
@@ -59,6 +60,9 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
59 char *p; 60 char *p;
60 char modname[MAX_PATH]; 61 char modname[MAX_PATH];
61 62
63 if (!ensure_unicows_dll ())
64 goto error;
65
62 set_user_model_id (); 66 set_user_model_id ();
63 67
64 if (!GetModuleFileName (NULL, modname, MAX_PATH)) 68 if (!GetModuleFileName (NULL, modname, MAX_PATH))
@@ -203,3 +207,43 @@ set_user_model_id (void)
203 } 207 }
204} 208}
205 209
210static int
211ensure_unicows_dll (void)
212{
213 OSVERSIONINFO os_ver;
214 HMODULE h;
215
216 ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
217 os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
218 if (!GetVersionEx (&os_ver))
219 return 0;
220
221 if (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
222 {
223 h = LoadLibrary ("Unicows.dll");
224 if (!h)
225 {
226 int button;
227
228 button = MessageBox (NULL,
229 "Emacs cannot load the UNICOWS.DLL library.\n"
230 "This library is essential for using Emacs\n"
231 "on this system. You need to install it.\n\n"
232 "However, you can still use Emacs by invoking\n"
233 "it with the '-nw' command-line option.\n\n"
234 "Emacs will exit when you click OK.",
235 "Emacs cannot load UNICOWS.DLL",
236 MB_ICONERROR | MB_TASKMODAL
237 | MB_SETFOREGROUND | MB_OK);
238 switch (button)
239 {
240 case IDOK:
241 default:
242 return 0;
243 }
244 }
245 FreeLibrary (h);
246 return 1;
247 }
248 return 1;
249}
diff --git a/src/ChangeLog b/src/ChangeLog
index ccfcb48daf0..3711292ad35 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,160 @@
12011-11-07 Paul Eggert <eggert@cs.ucla.edu>
2
3 * alloc.c (DEADP): New macro, for porting to GNU/Hurd (Bug#9926).
4 This is also needed for porting to any host where GC_MARK_STACK is
5 not GC_MAKE_GCPROS_NOOPS.
6 (which_symbols): Use it.
7
82011-11-07 Kenichi Handa <handa@m17n.org>
9
10 * coding.c (coding_set_destination): Check coding->src_pos only
11 when coding->src_object is a buffer (bug#9910).
12
13 * process.c (send_process): Set the member src_multibyte of coding
14 to 0 (bug#9911) when sending a unibyte text.
15
16 * callproc.c (Fcall_process): Set the member src_multibyte of
17 process_coding to 0 (bug#9912).
18
192011-11-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
20
21 * xmenu.c (cleanup_widget_value_tree): New function.
22 (xmenu_show, xdialog_show): Use it in record_unwind_protect instead of
23 calling free_menubar_widget_value_tree directly (Bug#9830).
24
252011-11-06 Paul Eggert <eggert@cs.ucla.edu>
26
27 Fix some portability problems with 'inline'.
28 * dispextern.h (window_box, window_box_height, window_text_bottom_y)
29 (window_box_width, window_box_left, window_box_left_offset)
30 (window_box_right, window_box_right_offset): Declare extern.
31 Otherwise, these inline functions do not conform to C99 and
32 are miscompiled by Microsoft compilers. Reported by Eli Zaretskii in
33 <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00084.html>.
34 * intervals.c (adjust_intervals_for_insertion)
35 (adjust_intervals_for_deletion): Now extern, because otherwise the
36 extern inline functions 'offset_intervals' couldn't refer to it.
37 (static_offset_intervals): Remove.
38 (offset_intervals): Rewrite using the old contents of
39 static_offset_intervals. The old version didn't conform to C99
40 because an extern inline function contained a reference to an
41 identifier with static linkage.
42
432011-11-06 Andreas Schwab <schwab@linux-m68k.org>
44
45 * keyboard.c (interrupt_signal): Don't call kill-emacs while in
46 GC.
47
482011-11-06 Eli Zaretskii <eliz@gnu.org>
49
50 * xdisp.c (init_iterator, reseat_to_string): Don't set the
51 iterator's bidi_p flag if Vpurify_flag is non-nil. (Bug#9963)
52 (Fcurrent_bidi_paragraph_direction): If Vpurify_flag is non-nil,
53 return Qleft_to_right.
54
552011-11-06 Chong Yidong <cyd@gnu.org>
56
57 * window.c (Fwindow_live_p, Fwindow_frame, Fframe_root_window)
58 (Fminibuffer_window, Fwindow_buffer, Fwindow_splits)
59 (Fset_window_splits, Fwindow_nest, Fset_window_nest)
60 (Fwindow_use_time, Fwindow_total_size, Fwindow_normal_size)
61 (Fwindow_new_normal, Fwindow_left_column, Fwindow_top_line)
62 (Fwindow_margins, Fwindow_fringes, Fwindow_scroll_bars)
63 (Fwindow_vscroll): Doc fix.
64 (Fwindow_top_child, Fwindow_left_child): Eliminate a nil default
65 argument, since it makes no sense to pass a live window and for
66 consistency with window-child.
67
682011-11-05 Christoph Scholtes <cschol2112@googlemail.com>
69
70 * makefile.w32-in ($(TEMACS), (gl-stamp)): Use $(THISDIR) to
71 support MSVC.
72
732011-11-05 Jason Rumney <jasonr@gnu.org>
74
75 * w32font.c (font_matches_spec): Filter out non-Japanese kana fonts.
76 (add_font_entity_to_list): Filter out non-Japanese Shift-JIS
77 fonts (Bug#6029).
78 (add_font_entity_to_list): Fix logic errors in mixed boolean and
79 bitwise arithmetic preventing use of unicode-sip and non-truetype
80 opentype fonts.
81
822011-11-05 Eli Zaretskii <eliz@gnu.org>
83
84 * s/ms-w32.h (fstat, stat, utime): Move redirections to
85 "emacs"-only part.
86
87 * w32fns.c (x_create_tip_frame, Fx_create_frame): Rearrange
88 initialization code to keep similarity to xfns.c after changes
89 from 2011-11-05.
90
912011-11-05 Jan Djärv <jan.h.d@swipnet.se>
92
93 * nsfns.m: Declare image_cache_refcount if GLYPH_DEBUG.
94 (unwind_create_frame): New function (Bug#9943).
95 (Fx_create_frame): Restructure code to be more similar to the one in
96 xfns.c. Call record_unwind_protect with unwind_create_frame (Bug#9943).
97 Initialize image_cache_refcount if GLYPH_DEBUG (Bug#9943).
98 Move terminal->reference_count++ just before making the frame official
99 (Bug#9943).
100
101 * nsterm.m (x_free_frame_resources): New function.
102 (x_destroy_window): Move code to x_free_frame_resources.
103
104 * xfns.c (unwind_create_frame): Fix comment.
105 (Fx_create_frame, x_create_tip_frame): Move
106 terminal->reference_count++ just before making the frame
107 official. Move initialization of image_cache_refcount and
108 dpyinfo_refcount before calling init_frame_faces (Bug#9943).
109
1102011-11-05 Eli Zaretskii <eliz@gnu.org>
111
112 Support MSVC build with newer versions of Visual Studio.
113 * makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as
114 Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on
115 nt/gmake.defs.
116
117 * lisp.h (ENUM_BF): New macro, for enumerated types in bitfields,
118 which are not supported by MSVC.
119 (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay)
120 (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in
121 bitfields.
122 (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated
123 types in bitfields.
124 (DEFUN) [_MSC_VER]: Define in a different way for MSVC.
125
126 * w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version.
127
1282011-11-05 Fabrice Popineau <fabrice.popineau@supelec.fr> (tiny change)
129
130 Support MSVC build with newer versions of Visual Studio.
131 * w32.c: Don't include w32api.h for MSVC.
132 (init_environment) [_MSC_VER]: Call sys_access, not _access.
133
134 * s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC.
135 [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h.
136 (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins.
137 (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the
138 e_* cousins.
139 (alloca) [_MSC_VER]: Define to _alloca.
140
141 * lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC.
142
143 * regex.c <re_char> [_MSC_VER]: A separate definition for MSVC.
144
1452011-11-04 Eli Zaretskii <eliz@gnu.org>
146
147 * xdisp.c (note_mouse_highlight): If either of
148 previous/next-single-property-change returns nil, treat that as
149 the beginning or the end of the buffer. (Bug#9955)
150
1512011-11-04 Jan Djärv <jan.h.d@swipnet.se>
152
153 * gtkutil.c (xg_make_tool_item): Add callbacks if one of wimage or
154 label is not null (Bug#9951).
155 (xg_tool_item_stale_p): Handle the fact that wimage and/or wlbl
156 may be NULL.
157
12011-11-04 Eli Zaretskii <eliz@gnu.org> 1582011-11-04 Eli Zaretskii <eliz@gnu.org>
2 159
3 * window.c (Fwindow_body_size): Mention in the doc string that the 160 * window.c (Fwindow_body_size): Mention in the doc string that the
@@ -2736,6 +2893,9 @@
2736 2893
27372011-07-08 Jason Rumney <jasonr@gnu.org> 28942011-07-08 Jason Rumney <jasonr@gnu.org>
2738 2895
2896 * w32term.c (x_make_frame_visible): Use SH_SHOWNORMAL rather than
2897 SH_SHOW for hidden windows (Bug#5482).
2898
2739 * w32fns.c (w32_wnd_proc) [WM_TIMER, WM_SET_CURSOR]: Avoid using 2899 * w32fns.c (w32_wnd_proc) [WM_TIMER, WM_SET_CURSOR]: Avoid using
2740 frame struct members of non-existent frames (Bug#6284). 2900 frame struct members of non-existent frames (Bug#6284).
2741 2901
diff --git a/src/alloc.c b/src/alloc.c
index 210dd7d1687..985e4b71426 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -315,6 +315,7 @@ static POINTER_TYPE *lisp_malloc (size_t, enum mem_type);
315 on free lists recognizable in O(1). */ 315 on free lists recognizable in O(1). */
316 316
317static Lisp_Object Vdead; 317static Lisp_Object Vdead;
318#define DEADP(x) EQ (x, Vdead)
318 319
319#ifdef GC_MALLOC_CHECK 320#ifdef GC_MALLOC_CHECK
320 321
@@ -411,6 +412,10 @@ static void check_gcpros (void);
411 412
412#endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ 413#endif /* GC_MARK_STACK || GC_MALLOC_CHECK */
413 414
415#ifndef DEADP
416# define DEADP(x) 0
417#endif
418
414/* Recording what needs to be marked for gc. */ 419/* Recording what needs to be marked for gc. */
415 420
416struct gcpro *gcprolist; 421struct gcpro *gcprolist;
@@ -6261,7 +6266,7 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
6261 int gc_count = inhibit_garbage_collection (); 6266 int gc_count = inhibit_garbage_collection ();
6262 Lisp_Object found = Qnil; 6267 Lisp_Object found = Qnil;
6263 6268
6264 if (!EQ (obj, Vdead)) 6269 if (! DEADP (obj))
6265 { 6270 {
6266 for (sblk = symbol_block; sblk; sblk = sblk->next) 6271 for (sblk = symbol_block; sblk; sblk = sblk->next)
6267 { 6272 {
diff --git a/src/callproc.c b/src/callproc.c
index 97531f73848..0859aaef2e6 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -748,6 +748,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
748 val = raw_text_coding_system (val); 748 val = raw_text_coding_system (val);
749 setup_coding_system (val, &process_coding); 749 setup_coding_system (val, &process_coding);
750 } 750 }
751 process_coding.src_multibyte = 0;
751 752
752 immediate_quit = 1; 753 immediate_quit = 1;
753 QUIT; 754 QUIT;
diff --git a/src/coding.c b/src/coding.c
index 5fd59d394d9..79908e9b29b 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1043,7 +1043,7 @@ coding_set_destination (struct coding_system *coding)
1043{ 1043{
1044 if (BUFFERP (coding->dst_object)) 1044 if (BUFFERP (coding->dst_object))
1045 { 1045 {
1046 if (coding->src_pos < 0) 1046 if (BUFFERP (coding->src_object) && coding->src_pos < 0)
1047 { 1047 {
1048 coding->destination = BEG_ADDR + coding->dst_pos_byte - BEG_BYTE; 1048 coding->destination = BEG_ADDR + coding->dst_pos_byte - BEG_BYTE;
1049 coding->dst_bytes = (GAP_END_ADDR 1049 coding->dst_bytes = (GAP_END_ADDR
diff --git a/src/dispextern.h b/src/dispextern.h
index 006ceb31a5a..d36cdd167ff 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3034,14 +3034,14 @@ int resize_mini_window (struct window *, int);
3034void set_vertical_scroll_bar (struct window *); 3034void set_vertical_scroll_bar (struct window *);
3035#endif 3035#endif
3036int try_window (Lisp_Object, struct text_pos, int); 3036int try_window (Lisp_Object, struct text_pos, int);
3037void window_box (struct window *, int, int *, int *, int *, int *); 3037extern void window_box (struct window *, int, int *, int *, int *, int *);
3038int window_box_height (struct window *); 3038extern int window_box_height (struct window *);
3039int window_text_bottom_y (struct window *); 3039extern int window_text_bottom_y (struct window *);
3040int window_box_width (struct window *, int); 3040extern int window_box_width (struct window *, int);
3041int window_box_left (struct window *, int); 3041extern int window_box_left (struct window *, int);
3042int window_box_left_offset (struct window *, int); 3042extern int window_box_left_offset (struct window *, int);
3043int window_box_right (struct window *, int); 3043extern int window_box_right (struct window *, int);
3044int window_box_right_offset (struct window *, int); 3044extern int window_box_right_offset (struct window *, int);
3045int estimate_mode_line_height (struct frame *, enum face_id); 3045int estimate_mode_line_height (struct frame *, enum face_id);
3046void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, 3046void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
3047 NativeRectangle *, int); 3047 NativeRectangle *, int);
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 26959d57d4b..af697c72673 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4237,7 +4237,7 @@ xg_make_tool_item (FRAME_PTR f,
4237 gtk_container_add (GTK_CONTAINER (weventbox), wb); 4237 gtk_container_add (GTK_CONTAINER (weventbox), wb);
4238 gtk_container_add (GTK_CONTAINER (ti), weventbox); 4238 gtk_container_add (GTK_CONTAINER (ti), weventbox);
4239 4239
4240 if (wimage) 4240 if (wimage || label)
4241 { 4241 {
4242 intptr_t ii = i; 4242 intptr_t ii = i;
4243 gpointer gi = (gpointer) ii; 4243 gpointer gi = (gpointer) ii;
@@ -4302,21 +4302,21 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4302 GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage); 4302 GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage);
4303 4303
4304 /* Check if the tool icon matches. */ 4304 /* Check if the tool icon matches. */
4305 if (stock_name) 4305 if (stock_name && wimage)
4306 { 4306 {
4307 old = g_object_get_data (G_OBJECT (wimage), 4307 old = g_object_get_data (G_OBJECT (wimage),
4308 XG_TOOL_BAR_STOCK_NAME); 4308 XG_TOOL_BAR_STOCK_NAME);
4309 if (!old || strcmp (old, stock_name)) 4309 if (!old || strcmp (old, stock_name))
4310 return 1; 4310 return 1;
4311 } 4311 }
4312 else if (icon_name) 4312 else if (icon_name && wimage)
4313 { 4313 {
4314 old = g_object_get_data (G_OBJECT (wimage), 4314 old = g_object_get_data (G_OBJECT (wimage),
4315 XG_TOOL_BAR_ICON_NAME); 4315 XG_TOOL_BAR_ICON_NAME);
4316 if (!old || strcmp (old, icon_name)) 4316 if (!old || strcmp (old, icon_name))
4317 return 1; 4317 return 1;
4318 } 4318 }
4319 else 4319 else if (wimage)
4320 { 4320 {
4321 gpointer gold_img = g_object_get_data (G_OBJECT (wimage), 4321 gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
4322 XG_TOOL_BAR_IMAGE_DATA); 4322 XG_TOOL_BAR_IMAGE_DATA);
@@ -4331,7 +4331,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4331 return 1; 4331 return 1;
4332 4332
4333 /* Ensure label is correct. */ 4333 /* Ensure label is correct. */
4334 if (label) 4334 if (label && wlbl)
4335 gtk_label_set_text (GTK_LABEL (wlbl), label); 4335 gtk_label_set_text (GTK_LABEL (wlbl), label);
4336 return 0; 4336 return 0;
4337} 4337}
diff --git a/src/intervals.c b/src/intervals.c
index 1f3f8cf793e..be1bdfb9056 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -52,6 +52,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
52 52
53#define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set)) 53#define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set))
54 54
55extern INTERVAL adjust_intervals_for_insertion (INTERVAL,
56 EMACS_INT, EMACS_INT);
57extern void adjust_intervals_for_deletion (struct buffer *,
58 EMACS_INT, EMACS_INT);
59
55static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object); 60static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object);
56static INTERVAL merge_interval_right (INTERVAL); 61static INTERVAL merge_interval_right (INTERVAL);
57static INTERVAL reproduce_tree (INTERVAL, INTERVAL); 62static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
@@ -798,7 +803,7 @@ update_interval (register INTERVAL i, EMACS_INT pos)
798 and check the hungry bits of both. Then add the length going back up 803 and check the hungry bits of both. Then add the length going back up
799 to the root. */ 804 to the root. */
800 805
801static INTERVAL 806INTERVAL
802adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position, 807adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
803 EMACS_INT length) 808 EMACS_INT length)
804{ 809{
@@ -859,7 +864,7 @@ adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
859 interval. Another possibility would be to create a new interval for 864 interval. Another possibility would be to create a new interval for
860 this text, and make it have the merged properties of both ends. */ 865 this text, and make it have the merged properties of both ends. */
861 866
862static INTERVAL 867INTERVAL
863adjust_intervals_for_insertion (INTERVAL tree, 868adjust_intervals_for_insertion (INTERVAL tree,
864 EMACS_INT position, EMACS_INT length) 869 EMACS_INT position, EMACS_INT length)
865{ 870{
@@ -1369,7 +1374,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
1369 text. The deletion is effected at position START (which is a 1374 text. The deletion is effected at position START (which is a
1370 buffer position, i.e. origin 1). */ 1375 buffer position, i.e. origin 1). */
1371 1376
1372static void 1377void
1373adjust_intervals_for_deletion (struct buffer *buffer, 1378adjust_intervals_for_deletion (struct buffer *buffer,
1374 EMACS_INT start, EMACS_INT length) 1379 EMACS_INT start, EMACS_INT length)
1375{ 1380{
@@ -1425,9 +1430,8 @@ adjust_intervals_for_deletion (struct buffer *buffer,
1425 compiler that does not allow calling a static function (here, 1430 compiler that does not allow calling a static function (here,
1426 adjust_intervals_for_deletion) from a non-static inline function. */ 1431 adjust_intervals_for_deletion) from a non-static inline function. */
1427 1432
1428static inline void 1433inline void
1429static_offset_intervals (struct buffer *buffer, EMACS_INT start, 1434offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
1430 EMACS_INT length)
1431{ 1435{
1432 if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) 1436 if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0)
1433 return; 1437 return;
@@ -1440,12 +1444,6 @@ static_offset_intervals (struct buffer *buffer, EMACS_INT start,
1440 adjust_intervals_for_deletion (buffer, start, -length); 1444 adjust_intervals_for_deletion (buffer, start, -length);
1441 } 1445 }
1442} 1446}
1443
1444inline void
1445offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
1446{
1447 static_offset_intervals (buffer, start, length);
1448}
1449 1447
1450/* Merge interval I with its lexicographic successor. The resulting 1448/* Merge interval I with its lexicographic successor. The resulting
1451 interval is returned, and has the properties of the original 1449 interval is returned, and has the properties of the original
diff --git a/src/keyboard.c b/src/keyboard.c
index bda8a1d82f3..a9350fc32f3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10872,8 +10872,12 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10872 if (!terminal) 10872 if (!terminal)
10873 { 10873 {
10874 /* If there are no frames there, let's pretend that we are a 10874 /* If there are no frames there, let's pretend that we are a
10875 well-behaving UN*X program and quit. */ 10875 well-behaving UN*X program and quit. We cannot do that while
10876 Fkill_emacs (Qnil); 10876 GC is in progress, though. */
10877 if (!gc_in_progress)
10878 Fkill_emacs (Qnil);
10879 else
10880 Vquit_flag = Qt;
10877 } 10881 }
10878 else 10882 else
10879 { 10883 {
diff --git a/src/lisp.h b/src/lisp.h
index c0ddb7f2b02..fd53bf13731 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -168,6 +168,9 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
168# if HAVE_ATTRIBUTE_ALIGNED 168# if HAVE_ATTRIBUTE_ALIGNED
169# define DECL_ALIGN(type, var) \ 169# define DECL_ALIGN(type, var) \
170 type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var 170 type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
171# elif defined(_MSC_VER)
172# define DECL_ALIGN(type, var) \
173 type __declspec(align(1 << GCTYPEBITS)) var
171# else 174# else
172 /* What directives do other compilers use? */ 175 /* What directives do other compilers use? */
173# endif 176# endif
@@ -225,6 +228,15 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
225# endif 228# endif
226#endif 229#endif
227 230
231/* Stolen from GDB. The only known compiler that doesn't support
232 enums in bitfields is MSVC. */
233#ifdef _MSC_VER
234#define ENUM_BF(TYPE) unsigned int
235#else
236#define ENUM_BF(TYPE) enum TYPE
237#endif
238
239
228enum Lisp_Type 240enum Lisp_Type
229 { 241 {
230 /* Integer. XINT (obj) is the integer value. */ 242 /* Integer. XINT (obj) is the integer value. */
@@ -315,12 +327,12 @@ union Lisp_Object
315 /* Use explict signed, the signedness of a bit-field of type 327 /* Use explict signed, the signedness of a bit-field of type
316 int is implementation defined. */ 328 int is implementation defined. */
317 signed EMACS_INT val : VALBITS; 329 signed EMACS_INT val : VALBITS;
318 enum Lisp_Type type : GCTYPEBITS; 330 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
319 } s; 331 } s;
320 struct 332 struct
321 { 333 {
322 EMACS_UINT val : VALBITS; 334 EMACS_UINT val : VALBITS;
323 enum Lisp_Type type : GCTYPEBITS; 335 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
324 } u; 336 } u;
325 } 337 }
326Lisp_Object; 338Lisp_Object;
@@ -336,14 +348,14 @@ union Lisp_Object
336 348
337 struct 349 struct
338 { 350 {
339 enum Lisp_Type type : GCTYPEBITS; 351 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
340 /* Use explict signed, the signedness of a bit-field of type 352 /* Use explict signed, the signedness of a bit-field of type
341 int is implementation defined. */ 353 int is implementation defined. */
342 signed EMACS_INT val : VALBITS; 354 signed EMACS_INT val : VALBITS;
343 } s; 355 } s;
344 struct 356 struct
345 { 357 {
346 enum Lisp_Type type : GCTYPEBITS; 358 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
347 EMACS_UINT val : VALBITS; 359 EMACS_UINT val : VALBITS;
348 } u; 360 } u;
349 } 361 }
@@ -1100,7 +1112,7 @@ struct Lisp_Symbol
1100 1 : it's a varalias, the value is really in the `alias' symbol. 1112 1 : it's a varalias, the value is really in the `alias' symbol.
1101 2 : it's a localized var, the value is in the `blv' object. 1113 2 : it's a localized var, the value is in the `blv' object.
1102 3 : it's a forwarding variable, the value is in `forward'. */ 1114 3 : it's a forwarding variable, the value is in `forward'. */
1103 enum symbol_redirect redirect : 3; 1115 ENUM_BF (symbol_redirect) redirect : 3;
1104 1116
1105 /* Non-zero means symbol is constant, i.e. changing its value 1117 /* Non-zero means symbol is constant, i.e. changing its value
1106 should signal an error. If the value is 3, then the var 1118 should signal an error. If the value is 3, then the var
@@ -1313,7 +1325,7 @@ struct Lisp_Hash_Table
1313 1325
1314struct Lisp_Misc_Any /* Supertype of all Misc types. */ 1326struct Lisp_Misc_Any /* Supertype of all Misc types. */
1315{ 1327{
1316 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */ 1328 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */
1317 unsigned gcmarkbit : 1; 1329 unsigned gcmarkbit : 1;
1318 int spacer : 15; 1330 int spacer : 15;
1319 /* Make it as long as "Lisp_Free without padding". */ 1331 /* Make it as long as "Lisp_Free without padding". */
@@ -1322,7 +1334,7 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */
1322 1334
1323struct Lisp_Marker 1335struct Lisp_Marker
1324{ 1336{
1325 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Marker */ 1337 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */
1326 unsigned gcmarkbit : 1; 1338 unsigned gcmarkbit : 1;
1327 int spacer : 13; 1339 int spacer : 13;
1328 /* This flag is temporarily used in the functions 1340 /* This flag is temporarily used in the functions
@@ -1472,7 +1484,7 @@ struct Lisp_Overlay
1472 I.e. 9words plus 2 bits, 3words of which are for external linked lists. 1484 I.e. 9words plus 2 bits, 3words of which are for external linked lists.
1473*/ 1485*/
1474 { 1486 {
1475 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Overlay */ 1487 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
1476 unsigned gcmarkbit : 1; 1488 unsigned gcmarkbit : 1;
1477 int spacer : 15; 1489 int spacer : 15;
1478 struct Lisp_Overlay *next; 1490 struct Lisp_Overlay *next;
@@ -1491,7 +1503,7 @@ struct Lisp_Kboard_Objfwd
1491 This type of object is used in the arg to record_unwind_protect. */ 1503 This type of object is used in the arg to record_unwind_protect. */
1492struct Lisp_Save_Value 1504struct Lisp_Save_Value
1493 { 1505 {
1494 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Save_Value */ 1506 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
1495 unsigned gcmarkbit : 1; 1507 unsigned gcmarkbit : 1;
1496 int spacer : 14; 1508 int spacer : 14;
1497 /* If DOGC is set, POINTER is the address of a memory 1509 /* If DOGC is set, POINTER is the address of a memory
@@ -1505,7 +1517,7 @@ struct Lisp_Save_Value
1505/* A miscellaneous object, when it's on the free list. */ 1517/* A miscellaneous object, when it's on the free list. */
1506struct Lisp_Free 1518struct Lisp_Free
1507 { 1519 {
1508 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Free */ 1520 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */
1509 unsigned gcmarkbit : 1; 1521 unsigned gcmarkbit : 1;
1510 int spacer : 15; 1522 int spacer : 15;
1511 union Lisp_Misc *chain; 1523 union Lisp_Misc *chain;
@@ -1900,13 +1912,23 @@ typedef struct {
1900 1912
1901/* This version of DEFUN declares a function prototype with the right 1913/* This version of DEFUN declares a function prototype with the right
1902 arguments, so we can catch errors with maxargs at compile-time. */ 1914 arguments, so we can catch errors with maxargs at compile-time. */
1903#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 1915#ifdef _MSC_VER
1904 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ 1916#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
1905 static DECL_ALIGN (struct Lisp_Subr, sname) = \ 1917 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
1906 { PVEC_SUBR, \ 1918 static DECL_ALIGN (struct Lisp_Subr, sname) = \
1907 { .a ## maxargs = fnname }, \ 1919 { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
1908 minargs, maxargs, lname, intspec, 0}; \ 1920 { (Lisp_Object (__cdecl *)(void))fnname }, \
1909 Lisp_Object fnname 1921 minargs, maxargs, lname, intspec, 0}; \
1922 Lisp_Object fnname
1923#else /* not _MSC_VER */
1924#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
1925 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
1926 static DECL_ALIGN (struct Lisp_Subr, sname) = \
1927 { PVEC_SUBR, \
1928 { .a ## maxargs = fnname }, \
1929 minargs, maxargs, lname, intspec, 0}; \
1930 Lisp_Object fnname
1931#endif
1910 1932
1911/* Note that the weird token-substitution semantics of ANSI C makes 1933/* Note that the weird token-substitution semantics of ANSI C makes
1912 this work for MANY and UNEVALLED. */ 1934 this work for MANY and UNEVALLED. */
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 53cb5f857ab..e97f7f3aca4 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -177,7 +177,7 @@ temacs: stamp_BLD $(TEMACS)
177$(TEMACS): $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \ 177$(TEMACS): $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
178 ../nt/$(BLD)/addsection.exe $(GNULIB) 178 ../nt/$(BLD)/addsection.exe $(GNULIB)
179 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) 179 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
180 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21 180 "$(THISDIR)/../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
181 181
182# These omit firstfile.${O}, but there's no documentation in there 182# These omit firstfile.${O}, but there's no documentation in there
183# anyways. 183# anyways.
@@ -232,7 +232,7 @@ globals.h: gl-stamp
232 232
233gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES) 233gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES)
234 - $(DEL) gl-tmp 234 - $(DEL) gl-tmp
235 "../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp 235 "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
236 cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h" 236 cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h"
237 - $(DEL) gl-tmp 237 - $(DEL) gl-tmp
238 echo timestamp > $@ 238 echo timestamp > $@
@@ -348,11 +348,11 @@ TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2)
348TAGS-gmake: 348TAGS-gmake:
349 ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \ 349 ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
350 --regex=@../nt/emacs-src.tags \ 350 --regex=@../nt/emacs-src.tags \
351 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0)) 351 $(OBJ0_c)
352 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \ 352 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
353 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1)) 353 $(OBJ1_c)
354 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \ 354 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
355 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \ 355 $(OBJ2_c) \
356 $(CURDIR)/*.h $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h 356 $(CURDIR)/*.h $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
357 357
358TAGS-nmake: 358TAGS-nmake:
diff --git a/src/nsfns.m b/src/nsfns.m
index a09011d8461..23362433a39 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -101,6 +101,10 @@ extern BOOL ns_in_resize;
101static Lisp_Object as_script, *as_result; 101static Lisp_Object as_script, *as_result;
102static int as_status; 102static int as_status;
103 103
104#if GLYPH_DEBUG
105static ptrdiff_t image_cache_refcount;
106#endif
107
104/* ========================================================================== 108/* ==========================================================================
105 109
106 Internal utility functions 110 Internal utility functions
@@ -1038,6 +1042,41 @@ frame_parm_handler ns_frame_parm_handlers[] =
1038}; 1042};
1039 1043
1040 1044
1045/* Handler for signals raised during x_create_frame.
1046 FRAME is the frame which is partially constructed. */
1047
1048static Lisp_Object
1049unwind_create_frame (Lisp_Object frame)
1050{
1051 struct frame *f = XFRAME (frame);
1052
1053 /* If frame is already dead, nothing to do. This can happen if the
1054 display is disconnected after the frame has become official, but
1055 before x_create_frame removes the unwind protect. */
1056 if (!FRAME_LIVE_P (f))
1057 return Qnil;
1058
1059 /* If frame is ``official'', nothing to do. */
1060 if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame))
1061 {
1062#if GLYPH_DEBUG && XASSERTS
1063 struct ns_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
1064#endif
1065
1066 x_free_frame_resources (f);
1067 free_glyphs (f);
1068
1069#if GLYPH_DEBUG
1070 /* Check that reference counts are indeed correct. */
1071 xassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
1072#endif
1073 return Qt;
1074 }
1075
1076 return Qnil;
1077}
1078
1079
1041 1080
1042/* ========================================================================== 1081/* ==========================================================================
1043 1082
@@ -1047,46 +1086,50 @@ frame_parm_handler ns_frame_parm_handlers[] =
1047 1086
1048DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 1087DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1049 1, 1, 0, 1088 1, 1, 0,
1050 doc: /* Make a new Nextstep window, called a \"frame\" in Emacs terms. 1089 doc: /* Make a new Nextstep window, called a "frame" in Emacs terms.
1051Return an Emacs frame object. 1090Return an Emacs frame object.
1052PARMS is an alist of frame parameters. 1091PARMS is an alist of frame parameters.
1053If the parameters specify that the frame should not have a minibuffer, 1092If the parameters specify that the frame should not have a minibuffer,
1054and do not specify a specific minibuffer window to use, 1093and do not specify a specific minibuffer window to use,
1055then `default-minibuffer-frame' must be a frame whose minibuffer can 1094then `default-minibuffer-frame' must be a frame whose minibuffer can
1056be shared by the new frame. */) 1095be shared by the new frame.
1096
1097This function is an internal primitive--use `make-frame' instead. */)
1057 (Lisp_Object parms) 1098 (Lisp_Object parms)
1058{ 1099{
1059 static int desc_ctr = 1;
1060 struct frame *f; 1100 struct frame *f;
1061 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1062 Lisp_Object frame, tem; 1101 Lisp_Object frame, tem;
1063 Lisp_Object name; 1102 Lisp_Object name;
1064 int minibuffer_only = 0; 1103 int minibuffer_only = 0;
1104 int window_prompting = 0;
1105 int width, height;
1065 int count = specpdl_ptr - specpdl; 1106 int count = specpdl_ptr - specpdl;
1107 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1066 Lisp_Object display; 1108 Lisp_Object display;
1067 struct ns_display_info *dpyinfo = NULL; 1109 struct ns_display_info *dpyinfo = NULL;
1068 Lisp_Object parent; 1110 Lisp_Object parent;
1069 struct kboard *kb; 1111 struct kboard *kb;
1070 Lisp_Object tfont, tfontsize; 1112 Lisp_Object tfont, tfontsize;
1071 int window_prompting = 0; 1113 static int desc_ctr = 1;
1072 int width, height;
1073 1114
1074 check_ns (); 1115 check_ns ();
1075 1116
1076 /* Seems a little strange, but other terms do it. Perhaps the code below 1117 /* x_get_arg modifies parms. */
1077 is modifying something? */
1078 parms = Fcopy_alist (parms); 1118 parms = Fcopy_alist (parms);
1079 1119
1120 /* Use this general default value to start with
1121 until we know if this frame has a specified name. */
1122 Vx_resource_name = Vinvocation_name;
1123
1080 display = x_get_arg (dpyinfo, parms, Qterminal, 0, 0, RES_TYPE_STRING); 1124 display = x_get_arg (dpyinfo, parms, Qterminal, 0, 0, RES_TYPE_STRING);
1081 if (EQ (display, Qunbound)) 1125 if (EQ (display, Qunbound))
1082 display = Qnil; 1126 display = Qnil;
1083 dpyinfo = check_ns_display_info (display); 1127 dpyinfo = check_ns_display_info (display);
1128 kb = dpyinfo->terminal->kboard;
1084 1129
1085 if (!dpyinfo->terminal->name) 1130 if (!dpyinfo->terminal->name)
1086 error ("Terminal is not live, can't create new frames on it"); 1131 error ("Terminal is not live, can't create new frames on it");
1087 1132
1088 kb = dpyinfo->terminal->kboard;
1089
1090 name = x_get_arg (dpyinfo, parms, Qname, 0, 0, RES_TYPE_STRING); 1133 name = x_get_arg (dpyinfo, parms, Qname, 0, 0, RES_TYPE_STRING);
1091 if (!STRINGP (name) 1134 if (!STRINGP (name)
1092 && ! EQ (name, Qunbound) 1135 && ! EQ (name, Qunbound)
@@ -1095,8 +1138,6 @@ be shared by the new frame. */)
1095 1138
1096 if (STRINGP (name)) 1139 if (STRINGP (name))
1097 Vx_resource_name = name; 1140 Vx_resource_name = name;
1098 else
1099 Vx_resource_name = Vinvocation_name;
1100 1141
1101 parent = x_get_arg (dpyinfo, parms, Qparent_id, 0, 0, RES_TYPE_NUMBER); 1142 parent = x_get_arg (dpyinfo, parms, Qparent_id, 0, 0, RES_TYPE_NUMBER);
1102 if (EQ (parent, Qunbound)) 1143 if (EQ (parent, Qunbound))
@@ -1104,57 +1145,36 @@ be shared by the new frame. */)
1104 if (! NILP (parent)) 1145 if (! NILP (parent))
1105 CHECK_NUMBER (parent); 1146 CHECK_NUMBER (parent);
1106 1147
1148 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */
1149 /* No need to protect DISPLAY because that's not used after passing
1150 it to make_frame_without_minibuffer. */
1107 frame = Qnil; 1151 frame = Qnil;
1108 GCPRO4 (parms, parent, name, frame); 1152 GCPRO4 (parms, parent, name, frame);
1109
1110 tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer", 1153 tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer",
1111 RES_TYPE_SYMBOL); 1154 RES_TYPE_SYMBOL);
1112 if (EQ (tem, Qnone) || NILP (tem)) 1155 if (EQ (tem, Qnone) || NILP (tem))
1113 {
1114 f = make_frame_without_minibuffer (Qnil, kb, display); 1156 f = make_frame_without_minibuffer (Qnil, kb, display);
1115 }
1116 else if (EQ (tem, Qonly)) 1157 else if (EQ (tem, Qonly))
1117 { 1158 {
1118 f = make_minibuffer_frame (); 1159 f = make_minibuffer_frame ();
1119 minibuffer_only = 1; 1160 minibuffer_only = 1;
1120 } 1161 }
1121 else if (WINDOWP (tem)) 1162 else if (WINDOWP (tem))
1122 {
1123 f = make_frame_without_minibuffer (tem, kb, display); 1163 f = make_frame_without_minibuffer (tem, kb, display);
1124 }
1125 else 1164 else
1126 {
1127 f = make_frame (1); 1165 f = make_frame (1);
1128 }
1129
1130 /* Set the name; the functions to which we pass f expect the name to
1131 be set. */
1132 if (EQ (name, Qunbound) || NILP (name) || (XTYPE (name) != Lisp_String))
1133 {
1134 f->name = build_string ([ns_app_name UTF8String]);
1135 f->explicit_name =0;
1136 }
1137 else
1138 {
1139 f->name = name;
1140 f->explicit_name = 1;
1141 specbind (Qx_resource_name, name);
1142 }
1143 1166
1144 XSETFRAME (frame, f); 1167 XSETFRAME (frame, f);
1145 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; 1168 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
1146 1169
1147 f->terminal = dpyinfo->terminal; 1170 f->terminal = dpyinfo->terminal;
1148 f->terminal->reference_count++;
1149 1171
1150 f->output_method = output_ns; 1172 f->output_method = output_ns;
1151 f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns)); 1173 f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
1152 memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns))); 1174 memset (f->output_data.ns, 0, sizeof *(f->output_data.ns));
1153 1175
1154 FRAME_FONTSET (f) = -1; 1176 FRAME_FONTSET (f) = -1;
1155 1177
1156 /* record_unwind_protect (unwind_create_frame, frame); safety; maybe later? */
1157
1158 f->icon_name = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", 1178 f->icon_name = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
1159 RES_TYPE_STRING); 1179 RES_TYPE_STRING);
1160 if (! STRINGP (f->icon_name)) 1180 if (! STRINGP (f->icon_name))
@@ -1162,6 +1182,9 @@ be shared by the new frame. */)
1162 1182
1163 FRAME_NS_DISPLAY_INFO (f) = dpyinfo; 1183 FRAME_NS_DISPLAY_INFO (f) = dpyinfo;
1164 1184
1185 /* With FRAME_NS_DISPLAY_INFO set up, this unwind-protect is safe. */
1186 record_unwind_protect (unwind_create_frame, frame);
1187
1165 f->output_data.ns->window_desc = desc_ctr++; 1188 f->output_data.ns->window_desc = desc_ctr++;
1166 if (!NILP (parent)) 1189 if (!NILP (parent))
1167 { 1190 {
@@ -1174,6 +1197,20 @@ be shared by the new frame. */)
1174 f->output_data.ns->explicit_parent = 0; 1197 f->output_data.ns->explicit_parent = 0;
1175 } 1198 }
1176 1199
1200 /* Set the name; the functions to which we pass f expect the name to
1201 be set. */
1202 if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name))
1203 {
1204 f->name = build_string ([ns_app_name UTF8String]);
1205 f->explicit_name = 0;
1206 }
1207 else
1208 {
1209 f->name = name;
1210 f->explicit_name = 1;
1211 specbind (Qx_resource_name, name);
1212 }
1213
1177 f->resx = dpyinfo->resx; 1214 f->resx = dpyinfo->resx;
1178 f->resy = dpyinfo->resy; 1215 f->resy = dpyinfo->resy;
1179 1216
@@ -1223,11 +1260,15 @@ be shared by the new frame. */)
1223 "leftFringe", "LeftFringe", RES_TYPE_NUMBER); 1260 "leftFringe", "LeftFringe", RES_TYPE_NUMBER);
1224 x_default_parameter (f, parms, Qright_fringe, Qnil, 1261 x_default_parameter (f, parms, Qright_fringe, Qnil,
1225 "rightFringe", "RightFringe", RES_TYPE_NUMBER); 1262 "rightFringe", "RightFringe", RES_TYPE_NUMBER);
1226 /* end PENDING */
1227 1263
1228 init_frame_faces (f); 1264#if GLYPH_DEBUG
1265 image_cache_refcount =
1266 FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
1267#endif
1229 1268
1230 /* The X resources controlling the menu-bar and tool-bar are 1269 init_frame_faces (f);
1270
1271 /* The resources controlling the menu-bar and tool-bar are
1231 processed specially at startup, and reflected in the mode 1272 processed specially at startup, and reflected in the mode
1232 variables; ignore them here. */ 1273 variables; ignore them here. */
1233 x_default_parameter (f, parms, Qmenu_bar_lines, 1274 x_default_parameter (f, parms, Qmenu_bar_lines,
@@ -1244,38 +1285,6 @@ be shared by the new frame. */)
1244 x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title", 1285 x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
1245 RES_TYPE_STRING); 1286 RES_TYPE_STRING);
1246 1287
1247/* TODO: other terms seem to get away w/o this complexity.. */
1248 if (NILP (Fassq (Qwidth, parms)))
1249 {
1250 Lisp_Object value
1251 = x_get_arg (dpyinfo, parms, Qwidth, "width", "Width",
1252 RES_TYPE_NUMBER);
1253 if (! EQ (value, Qunbound))
1254 parms = Fcons (Fcons (Qwidth, value), parms);
1255 }
1256 if (NILP (Fassq (Qheight, parms)))
1257 {
1258 Lisp_Object value
1259 = x_get_arg (dpyinfo, parms, Qheight, "height", "Height",
1260 RES_TYPE_NUMBER);
1261 if (! EQ (value, Qunbound))
1262 parms = Fcons (Fcons (Qheight, value), parms);
1263 }
1264 if (NILP (Fassq (Qleft, parms)))
1265 {
1266 Lisp_Object value
1267 = x_get_arg (dpyinfo, parms, Qleft, "left", "Left", RES_TYPE_NUMBER);
1268 if (! EQ (value, Qunbound))
1269 parms = Fcons (Fcons (Qleft, value), parms);
1270 }
1271 if (NILP (Fassq (Qtop, parms)))
1272 {
1273 Lisp_Object value
1274 = x_get_arg (dpyinfo, parms, Qtop, "top", "Top", RES_TYPE_NUMBER);
1275 if (! EQ (value, Qunbound))
1276 parms = Fcons (Fcons (Qtop, value), parms);
1277 }
1278
1279 window_prompting = x_figure_window_size (f, parms, 1); 1288 window_prompting = x_figure_window_size (f, parms, 1);
1280 1289
1281 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); 1290 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
@@ -1297,23 +1306,27 @@ be shared by the new frame. */)
1297 1306
1298 x_icon (f, parms); 1307 x_icon (f, parms);
1299 1308
1309 /* ns_display_info does not have a reference_count. */
1310 f->terminal->reference_count++;
1311
1300 /* It is now ok to make the frame official even if we get an error below. 1312 /* It is now ok to make the frame official even if we get an error below.
1301 The frame needs to be on Vframe_list or making it visible won't work. */ 1313 The frame needs to be on Vframe_list or making it visible won't work. */
1302 Vframe_list = Fcons (frame, Vframe_list); 1314 Vframe_list = Fcons (frame, Vframe_list);
1303 /*FRAME_NS_DISPLAY_INFO (f)->reference_count++; */ 1315
1304 1316 x_default_parameter (f, parms, Qicon_type, Qnil,
1305 x_default_parameter (f, parms, Qicon_type, Qnil, "bitmapIcon", "BitmapIcon", 1317 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL);
1306 RES_TYPE_SYMBOL); 1318
1307 x_default_parameter (f, parms, Qauto_raise, Qnil, "autoRaise", "AutoRaiseLower", 1319 x_default_parameter (f, parms, Qauto_raise, Qnil,
1308 RES_TYPE_BOOLEAN); 1320 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
1309 x_default_parameter (f, parms, Qauto_lower, Qnil, "autoLower", "AutoLower", 1321 x_default_parameter (f, parms, Qauto_lower, Qnil,
1310 RES_TYPE_BOOLEAN); 1322 "autoLower", "AutoLower", RES_TYPE_BOOLEAN);
1311 x_default_parameter (f, parms, Qcursor_type, Qbox, "cursorType", "CursorType", 1323 x_default_parameter (f, parms, Qcursor_type, Qbox,
1312 RES_TYPE_SYMBOL); 1324 "cursorType", "CursorType", RES_TYPE_SYMBOL);
1313 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, "scrollBarWidth", 1325 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
1314 "ScrollBarWidth", RES_TYPE_NUMBER); 1326 "scrollBarWidth", "ScrollBarWidth",
1315 x_default_parameter (f, parms, Qalpha, Qnil, "alpha", "Alpha", 1327 RES_TYPE_NUMBER);
1316 RES_TYPE_NUMBER); 1328 x_default_parameter (f, parms, Qalpha, Qnil,
1329 "alpha", "Alpha", RES_TYPE_NUMBER);
1317 1330
1318 width = FRAME_COLS (f); 1331 width = FRAME_COLS (f);
1319 height = FRAME_LINES (f); 1332 height = FRAME_LINES (f);
@@ -1324,20 +1337,24 @@ be shared by the new frame. */)
1324 1337
1325 if (! f->output_data.ns->explicit_parent) 1338 if (! f->output_data.ns->explicit_parent)
1326 { 1339 {
1327 tem = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL); 1340 Lisp_Object visibility;
1328 if (EQ (tem, Qunbound)) 1341
1329 tem = Qt; 1342 visibility = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0,
1330 x_set_visibility (f, tem, Qnil); 1343 RES_TYPE_SYMBOL);
1331 if (EQ (tem, Qicon)) 1344 if (EQ (visibility, Qunbound))
1345 visibility = Qt;
1346
1347 if (EQ (visibility, Qicon))
1332 x_iconify_frame (f); 1348 x_iconify_frame (f);
1333 else if (! NILP (tem)) 1349 else if (! NILP (visibility))
1334 { 1350 {
1335 x_make_frame_visible (f); 1351 x_make_frame_visible (f);
1336 f->async_visible = 1;
1337 [[FRAME_NS_VIEW (f) window] makeKeyWindow]; 1352 [[FRAME_NS_VIEW (f) window] makeKeyWindow];
1338 } 1353 }
1339 else 1354 else
1340 f->async_visible = 0; 1355 {
1356 /* Must have been Qnil. */
1357 }
1341 } 1358 }
1342 1359
1343 if (FRAME_HAS_MINIBUF_P (f) 1360 if (FRAME_HAS_MINIBUF_P (f)
@@ -1352,6 +1369,9 @@ be shared by the new frame. */)
1352 f->param_alist = Fcons (XCAR (tem), f->param_alist); 1369 f->param_alist = Fcons (XCAR (tem), f->param_alist);
1353 1370
1354 UNGCPRO; 1371 UNGCPRO;
1372
1373 /* Make sure windows on this frame appear in calls to next-window
1374 and similar functions. */
1355 Vwindow_list = Qnil; 1375 Vwindow_list = Qnil;
1356 1376
1357 return unbind_to (count, frame); 1377 return unbind_to (count, frame);
diff --git a/src/nsterm.m b/src/nsterm.m
index a2ae5e69512..3d3723fc28c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -164,7 +164,7 @@ static Lisp_Object last_mouse_motion_frame;
164static EmacsScroller *last_mouse_scroll_bar = nil; 164static EmacsScroller *last_mouse_scroll_bar = nil;
165static struct frame *ns_updating_frame; 165static struct frame *ns_updating_frame;
166static NSView *focus_view = NULL; 166static NSView *focus_view = NULL;
167static int ns_window_num =0; 167static int ns_window_num = 0;
168static NSRect uRect; 168static NSRect uRect;
169static BOOL gsaved = NO; 169static BOOL gsaved = NO;
170BOOL ns_in_resize = NO; 170BOOL ns_in_resize = NO;
@@ -1123,12 +1123,10 @@ x_iconify_frame (struct frame *f)
1123 [[view window] miniaturize: NSApp]; 1123 [[view window] miniaturize: NSApp];
1124} 1124}
1125 1125
1126/* Free X resources of frame F. */
1126 1127
1127void 1128void
1128x_destroy_window (struct frame *f) 1129x_free_frame_resources (struct frame *f)
1129/* --------------------------------------------------------------------------
1130 External: Delete the window
1131 -------------------------------------------------------------------------- */
1132{ 1130{
1133 NSView *view = FRAME_NS_VIEW (f); 1131 NSView *view = FRAME_NS_VIEW (f);
1134 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); 1132 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
@@ -1163,10 +1161,21 @@ x_destroy_window (struct frame *f)
1163 [[view window] close]; 1161 [[view window] close];
1164 [view release]; 1162 [view release];
1165 1163
1166 ns_window_num--;
1167 UNBLOCK_INPUT; 1164 UNBLOCK_INPUT;
1168} 1165}
1169 1166
1167void
1168x_destroy_window (struct frame *f)
1169/* --------------------------------------------------------------------------
1170 External: Delete the window
1171 -------------------------------------------------------------------------- */
1172{
1173 NSTRACE (x_destroy_window);
1174 check_ns ();
1175 x_free_frame_resources (f);
1176 ns_window_num--;
1177}
1178
1170 1179
1171void 1180void
1172x_set_offset (struct frame *f, int xoff, int yoff, int change_grav) 1181x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
diff --git a/src/process.c b/src/process.c
index c316139a713..301274676d6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5387,6 +5387,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5387 } 5387 }
5388 else 5388 else
5389 { 5389 {
5390 coding->src_multibyte = 0;
5390 /* For sending a unibyte text, character code conversion should 5391 /* For sending a unibyte text, character code conversion should
5391 not take place but EOL conversion should. So, setup raw-text 5392 not take place but EOL conversion should. So, setup raw-text
5392 or one of the subsidiary if we have not yet done it. */ 5393 or one of the subsidiary if we have not yet done it. */
diff --git a/src/regex.c b/src/regex.c
index 8033ab9edaa..ccbad58abb3 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -530,7 +530,11 @@ init_syntax_once (void)
530#define MIN(a, b) ((a) < (b) ? (a) : (b)) 530#define MIN(a, b) ((a) < (b) ? (a) : (b))
531 531
532/* Type of source-pattern and string chars. */ 532/* Type of source-pattern and string chars. */
533#ifdef _MSC_VER
534typedef unsigned char re_char;
535#else
533typedef const unsigned char re_char; 536typedef const unsigned char re_char;
537#endif
534 538
535typedef char boolean; 539typedef char boolean;
536#define false 0 540#define false 0
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 813c3cef115..fb0882860d1 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -86,6 +86,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
86#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) 86#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
87 87
88#include <sys/types.h> 88#include <sys/types.h>
89
90#ifdef _MSC_VER
91typedef unsigned long sigset_t;
92typedef int ssize_t;
93#endif
94
89struct sigaction { 95struct sigaction {
90 int sa_flags; 96 int sa_flags;
91 void (*sa_handler)(int); 97 void (*sa_handler)(int);
@@ -181,6 +187,17 @@ struct sigaction {
181 187
182#ifdef emacs 188#ifdef emacs
183 189
190#ifdef _MSC_VER
191#include <sys/timeb.h>
192#include <sys/stat.h>
193#include <signal.h>
194
195/* MSVC gets link-time errors without these redirections. */
196#define fstat(a, b) sys_fstat(a, b)
197#define stat(a, b) sys_stat(a, b)
198#define utime sys_utime
199#endif
200
184/* Calls that are emulated or shadowed. */ 201/* Calls that are emulated or shadowed. */
185#undef access 202#undef access
186#define access sys_access 203#define access sys_access
@@ -267,6 +284,7 @@ typedef int pid_t;
267 284
268#if !defined (_MSC_VER) || (_MSC_VER < 1400) 285#if !defined (_MSC_VER) || (_MSC_VER < 1400)
269#define tzname _tzname 286#define tzname _tzname
287#undef utime
270#define utime _utime 288#define utime _utime
271#endif 289#endif
272 290
@@ -317,13 +335,17 @@ extern char *get_emacs_configuration_options (void);
317#define _WINSOCK_H 335#define _WINSOCK_H
318 336
319/* Defines size_t and alloca (). */ 337/* Defines size_t and alloca (). */
320#ifdef USE_CRT_DLL 338#if (defined(_MSC_VER) && defined(emacs)) || defined(USE_CRT_DLL)
321#define malloc e_malloc 339#define malloc e_malloc
322#define free e_free 340#define free e_free
323#define realloc e_realloc 341#define realloc e_realloc
324#define calloc e_calloc 342#define calloc e_calloc
325#endif 343#endif
344#ifdef _MSC_VER
345#define alloca _alloca
346#else
326#include <malloc.h> 347#include <malloc.h>
348#endif
327 349
328#include <sys/stat.h> 350#include <sys/stat.h>
329 351
diff --git a/src/w32.c b/src/w32.c
index 42546fc8d49..f17e987f437 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -94,7 +94,9 @@ typedef struct _MEMORY_STATUS_EX {
94 94
95#include <tlhelp32.h> 95#include <tlhelp32.h>
96#include <psapi.h> 96#include <psapi.h>
97#ifndef _MSC_VER
97#include <w32api.h> 98#include <w32api.h>
99#endif
98#if !defined (__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15) 100#if !defined (__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15)
99/* This either is not in psapi.h or guarded by higher value of 101/* This either is not in psapi.h or guarded by higher value of
100 _WIN32_WINNT than what we use. w32api supplied with MinGW 3.15 102 _WIN32_WINNT than what we use. w32api supplied with MinGW 3.15
@@ -1547,7 +1549,12 @@ init_environment (char ** argv)
1547 read-only filesystem, like CD-ROM or a write-protected floppy. 1549 read-only filesystem, like CD-ROM or a write-protected floppy.
1548 The only way to be really sure is to actually create a file and 1550 The only way to be really sure is to actually create a file and
1549 see if it succeeds. But I think that's too much to ask. */ 1551 see if it succeeds. But I think that's too much to ask. */
1552#ifdef _MSC_VER
1553 /* MSVC's _access crashes with D_OK. */
1554 if (tmp && sys_access (tmp, D_OK) == 0)
1555#else
1550 if (tmp && _access (tmp, D_OK) == 0) 1556 if (tmp && _access (tmp, D_OK) == 0)
1557#endif
1551 { 1558 {
1552 char * var = alloca (strlen (tmp) + 8); 1559 char * var = alloca (strlen (tmp) + 8);
1553 sprintf (var, "TMPDIR=%s", tmp); 1560 sprintf (var, "TMPDIR=%s", tmp);
diff --git a/src/w32fns.c b/src/w32fns.c
index f7ba1c59e7b..6f32442514a 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -140,8 +140,8 @@ struct MONITOR_INFO
140 DWORD dwFlags; 140 DWORD dwFlags;
141}; 141};
142 142
143/* Reportedly, VS 6 does not have this in its headers. */ 143/* Reportedly, MSVC does not have this in its headers. */
144#if defined (_MSC_VER) && _MSC_VER < 1300 144#ifdef _MSC_VER
145DECLARE_HANDLE(HMONITOR); 145DECLARE_HANDLE(HMONITOR);
146#endif 146#endif
147 147
@@ -3977,7 +3977,7 @@ x_make_gc (struct frame *f)
3977 3977
3978 3978
3979/* Handler for signals raised during x_create_frame and 3979/* Handler for signals raised during x_create_frame and
3980 x_create_top_frame. FRAME is the frame which is partially 3980 x_create_tip_frame. FRAME is the frame which is partially
3981 constructed. */ 3981 constructed. */
3982 3982
3983static Lisp_Object 3983static Lisp_Object
@@ -4135,7 +4135,6 @@ This function is an internal primitive--use `make-frame' instead. */)
4135 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL); 4135 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
4136 4136
4137 f->terminal = dpyinfo->terminal; 4137 f->terminal = dpyinfo->terminal;
4138 f->terminal->reference_count++;
4139 4138
4140 f->output_method = output_w32; 4139 f->output_method = output_w32;
4141 f->output_data.w32 = 4140 f->output_data.w32 =
@@ -4154,7 +4153,8 @@ This function is an internal primitive--use `make-frame' instead. */)
4154 /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */ 4153 /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */
4155 record_unwind_protect (unwind_create_frame, frame); 4154 record_unwind_protect (unwind_create_frame, frame);
4156#if GLYPH_DEBUG 4155#if GLYPH_DEBUG
4157 image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; 4156 image_cache_refcount =
4157 FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
4158 dpyinfo_refcount = dpyinfo->reference_count; 4158 dpyinfo_refcount = dpyinfo->reference_count;
4159#endif /* GLYPH_DEBUG */ 4159#endif /* GLYPH_DEBUG */
4160 4160
@@ -4287,6 +4287,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4287 x_make_gc (f); 4287 x_make_gc (f);
4288 4288
4289 /* Now consider the frame official. */ 4289 /* Now consider the frame official. */
4290 f->terminal->reference_count++;
4290 FRAME_W32_DISPLAY_INFO (f)->reference_count++; 4291 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
4291 Vframe_list = Fcons (frame, Vframe_list); 4292 Vframe_list = Fcons (frame, Vframe_list);
4292 4293
@@ -5229,7 +5230,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5229 from this point on, x_destroy_window might screw up reference 5230 from this point on, x_destroy_window might screw up reference
5230 counts etc. */ 5231 counts etc. */
5231 f->terminal = dpyinfo->terminal; 5232 f->terminal = dpyinfo->terminal;
5232 f->terminal->reference_count++;
5233 f->output_method = output_w32; 5233 f->output_method = output_w32;
5234 f->output_data.w32 = 5234 f->output_data.w32 =
5235 (struct w32_output *) xmalloc (sizeof (struct w32_output)); 5235 (struct w32_output *) xmalloc (sizeof (struct w32_output));
@@ -5239,7 +5239,8 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5239 f->icon_name = Qnil; 5239 f->icon_name = Qnil;
5240 5240
5241#if GLYPH_DEBUG 5241#if GLYPH_DEBUG
5242 image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; 5242 image_cache_refcount =
5243 FRAME_IMAGE_CACHE ? FRAME_IMAGE_CACHE (f)->refcount : 0;
5243 dpyinfo_refcount = dpyinfo->reference_count; 5244 dpyinfo_refcount = dpyinfo->reference_count;
5244#endif /* GLYPH_DEBUG */ 5245#endif /* GLYPH_DEBUG */
5245 FRAME_KBOARD (f) = kb; 5246 FRAME_KBOARD (f) = kb;
@@ -5380,15 +5381,16 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5380 5381
5381 UNGCPRO; 5382 UNGCPRO;
5382 5383
5384 /* Now that the frame is official, it counts as a reference to
5385 its display. */
5386 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
5387 f->terminal->reference_count++;
5388
5383 /* It is now ok to make the frame official even if we get an error 5389 /* It is now ok to make the frame official even if we get an error
5384 below. And the frame needs to be on Vframe_list or making it 5390 below. And the frame needs to be on Vframe_list or making it
5385 visible won't work. */ 5391 visible won't work. */
5386 Vframe_list = Fcons (frame, Vframe_list); 5392 Vframe_list = Fcons (frame, Vframe_list);
5387 5393
5388 /* Now that the frame is official, it counts as a reference to
5389 its display. */
5390 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
5391
5392 /* Setting attributes of faces of the tooltip frame from resources 5394 /* Setting attributes of faces of the tooltip frame from resources
5393 and similar will increment face_change_count, which leads to the 5395 and similar will increment face_change_count, which leads to the
5394 clearing of all current matrices. Since this isn't necessary 5396 clearing of all current matrices. Since this isn't necessary
diff --git a/src/w32font.c b/src/w32font.c
index 6c1b4d0bc20..26bf4207de5 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1292,6 +1292,15 @@ font_matches_spec (DWORD type, NEWTEXTMETRICEX *font,
1292 = font_supported_scripts (&font->ntmFontSig); 1292 = font_supported_scripts (&font->ntmFontSig);
1293 if (! memq_no_quit (val, support)) 1293 if (! memq_no_quit (val, support))
1294 return 0; 1294 return 0;
1295
1296 /* Avoid using non-Japanese fonts for Japanese, even
1297 if they claim they are capable, due to known
1298 breakage in Vista and Windows 7 fonts
1299 (bug#6029). */
1300 if (EQ (val, Qkana)
1301 && (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET
1302 || !(font->ntmFontSig.fsCsb[0] & CSB_JAPANESE)))
1303 return 0;
1295 } 1304 }
1296 else 1305 else
1297 { 1306 {
@@ -1507,7 +1516,7 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
1507 /* For uniscribe backend, consider only truetype or opentype fonts 1516 /* For uniscribe backend, consider only truetype or opentype fonts
1508 that have some unicode coverage. */ 1517 that have some unicode coverage. */
1509 if (match_data->opentype_only 1518 if (match_data->opentype_only
1510 && ((!physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE 1519 && ((!(physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE)
1511 && !(font_type & TRUETYPE_FONTTYPE)) 1520 && !(font_type & TRUETYPE_FONTTYPE))
1512 || !is_unicode)) 1521 || !is_unicode))
1513 return 1; 1522 return 1;
@@ -1568,8 +1577,8 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
1568 the bits for CJK ranges that include those characters. */ 1577 the bits for CJK ranges that include those characters. */
1569 else if (EQ (spec_charset, Qunicode_sip)) 1578 else if (EQ (spec_charset, Qunicode_sip))
1570 { 1579 {
1571 if (!physical_font->ntmFontSig.fsUsb[1] & 0x02000000 1580 if (!(physical_font->ntmFontSig.fsUsb[1] & 0x02000000)
1572 || !physical_font->ntmFontSig.fsUsb[1] & 0x28000000) 1581 || !(physical_font->ntmFontSig.fsUsb[1] & 0x28000000))
1573 return 1; 1582 return 1;
1574 } 1583 }
1575 1584
@@ -1577,8 +1586,16 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
1577 1586
1578 /* If registry was specified, ensure it is reported as the same. */ 1587 /* If registry was specified, ensure it is reported as the same. */
1579 if (!NILP (spec_charset)) 1588 if (!NILP (spec_charset))
1580 ASET (entity, FONT_REGISTRY_INDEX, spec_charset); 1589 {
1581 1590 /* Avoid using non-Japanese fonts for Japanese, even if they
1591 claim they are capable, due to known breakage in Vista
1592 and Windows 7 fonts (bug#6029). */
1593 if (logical_font->elfLogFont.lfCharSet == SHIFTJIS_CHARSET
1594 && !(physical_font->ntmFontSig.fsCsb[0] & CSB_JAPANESE))
1595 return 1;
1596 else
1597 ASET (entity, FONT_REGISTRY_INDEX, spec_charset);
1598 }
1582 /* Otherwise if using the uniscribe backend, report ANSI and DEFAULT 1599 /* Otherwise if using the uniscribe backend, report ANSI and DEFAULT
1583 fonts as unicode and skip other charsets. */ 1600 fonts as unicode and skip other charsets. */
1584 else if (match_data->opentype_only) 1601 else if (match_data->opentype_only)
diff --git a/src/w32term.c b/src/w32term.c
index 39f1e245e18..f876cff0363 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5690,15 +5690,15 @@ x_make_frame_visible (struct frame *f)
5690 5690
5691 f->output_data.w32->asked_for_visible = 1; 5691 f->output_data.w32->asked_for_visible = 1;
5692 5692
5693 /* The first of these seems to give more expected behavior, but 5693 /* According to a report in emacs-devel 2008-06-03, SW_SHOWNORMAL
5694 was added as a commented out line in Sept 1997, with the 5694 causes unexpected behaviour when unminimizing frames that were
5695 second version remaining uncommented. There may have been 5695 previously maximised. But only SW_SHOWNORMAL works properly for
5696 some problem with it that led to it not being enabled, 5696 frames that were truely hidden (using make-frame-invisible), so
5697 so the old version remains commented out below in case we 5697 we need it to avoid Bug#5482. It seems that async_iconified
5698 decide we need to go back to it [23.0.60 2008-06-09]. */ 5698 is only set for minimised windows that are still visible, so
5699 use that to determine the appropriate flag to pass ShowWindow. */
5699 my_show_window (f, FRAME_W32_WINDOW (f), 5700 my_show_window (f, FRAME_W32_WINDOW (f),
5700 f->async_iconified ? SW_RESTORE : SW_SHOW); 5701 f->async_iconified ? SW_RESTORE : SW_SHOWNORMAL);
5701 /* my_show_window (f, FRAME_W32_WINDOW (f), SW_SHOWNORMAL); */
5702 } 5702 }
5703 5703
5704 /* Synchronize to ensure Emacs knows the frame is visible 5704 /* Synchronize to ensure Emacs knows the frame is visible
diff --git a/src/window.c b/src/window.c
index 496a4e6c6ea..5cc77fb8f02 100644
--- a/src/window.c
+++ b/src/window.c
@@ -161,7 +161,8 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
161 161
162DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, 162DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
163 doc: /* Return t if OBJECT is a live window and nil otherwise. 163 doc: /* Return t if OBJECT is a live window and nil otherwise.
164A live window is a window that displays a buffer. */) 164A live window is a window that displays a buffer.
165Internal windows and deleted windows are not live. */)
165 (Lisp_Object object) 166 (Lisp_Object object)
166{ 167{
167 return WINDOW_LIVE_P (object) ? Qt : Qnil; 168 return WINDOW_LIVE_P (object) ? Qt : Qnil;
@@ -170,7 +171,7 @@ A live window is a window that displays a buffer. */)
170/* Frames and windows. */ 171/* Frames and windows. */
171DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, 172DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
172 doc: /* Return the frame that window WINDOW is on. 173 doc: /* Return the frame that window WINDOW is on.
173WINDOW can be any window and defaults to the selected one. */) 174If WINDOW is omitted or nil, it defaults to the selected window. */)
174 (Lisp_Object window) 175 (Lisp_Object window)
175{ 176{
176 return decode_any_window (window)->frame; 177 return decode_any_window (window)->frame;
@@ -179,9 +180,8 @@ WINDOW can be any window and defaults to the selected one. */)
179DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, 180DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
180 doc: /* Return the root window of FRAME-OR-WINDOW. 181 doc: /* Return the root window of FRAME-OR-WINDOW.
181If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. 182If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
182Else if FRAME-OR-WINDOW denotes any window, return the root window of 183With a frame argument, return that frame's root window.
183that window's frame. If FRAME-OR-WINDOW denotes a live frame, return 184With a window argument, return the root window of that window's frame. */)
184the root window of that frame. */)
185 (Lisp_Object frame_or_window) 185 (Lisp_Object frame_or_window)
186{ 186{
187 Lisp_Object window; 187 Lisp_Object window;
@@ -200,9 +200,8 @@ the root window of that frame. */)
200} 200}
201 201
202DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0, 202DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
203 doc: /* Return the window used now for minibuffers. 203 doc: /* Return the minibuffer window for frame FRAME.
204If the optional argument FRAME is specified, return the minibuffer window 204If FRAME is omitted or nil, it defaults to the selected frame. */)
205used by that frame. */)
206 (Lisp_Object frame) 205 (Lisp_Object frame)
207{ 206{
208 if (NILP (frame)) 207 if (NILP (frame))
@@ -214,7 +213,7 @@ used by that frame. */)
214DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 213DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p,
215 Swindow_minibuffer_p, 0, 1, 0, 214 Swindow_minibuffer_p, 0, 1, 0,
216 doc: /* Return non-nil if WINDOW is a minibuffer window. 215 doc: /* Return non-nil if WINDOW is a minibuffer window.
217WINDOW can be any window and defaults to the selected one. */) 216If WINDOW is omitted or nil, it defaults to the selected window. */)
218 (Lisp_Object window) 217 (Lisp_Object window)
219{ 218{
220 return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil; 219 return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil;
@@ -411,44 +410,48 @@ buffer of the selected window before each command. */)
411} 410}
412 411
413DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, 412DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
414 doc: /* Return the buffer that WINDOW is displaying. 413 doc: /* Return the buffer displayed in window WINDOW.
415WINDOW can be any window and defaults to the selected one. 414If WINDOW is omitted or nil, it defaults to the selected window.
416If WINDOW is an internal window return nil. */) 415Return nil for an internal window or a deleted window. */)
417 (Lisp_Object window) 416 (Lisp_Object window)
418{ 417{
419 return decode_any_window (window)->buffer; 418 return decode_any_window (window)->buffer;
420} 419}
421 420
422DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, 421DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
423 doc: /* Return WINDOW's parent window. 422 doc: /* Return the parent window of window WINDOW.
424WINDOW can be any window and defaults to the selected one. 423If WINDOW is omitted or nil, it defaults to the selected window.
425Return nil if WINDOW has no parent. */) 424Return nil for a window with no parent (e.g. a root window). */)
426 (Lisp_Object window) 425 (Lisp_Object window)
427{ 426{
428 return decode_any_window (window)->parent; 427 return decode_any_window (window)->parent;
429} 428}
430 429
431DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0, 430DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
432 doc: /* Return WINDOW's topmost child window. 431 doc: /* Return the topmost child window of window WINDOW.
433WINDOW can be any window and defaults to the selected one. 432Return nil if WINDOW is a live window (live windows have no children).
434Return nil if WINDOW is not a vertical combination. */) 433Return nil if WINDOW is an internal window whose children form a
434horizontal combination. */)
435 (Lisp_Object window) 435 (Lisp_Object window)
436{ 436{
437 CHECK_WINDOW (window);
437 return decode_any_window (window)->vchild; 438 return decode_any_window (window)->vchild;
438} 439}
439 440
440DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, 441DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
441 doc: /* Return WINDOW's leftmost child window. 442 doc: /* Return the leftmost child window of window WINDOW.
442WINDOW can be any window and defaults to the selected one. 443Return nil if WINDOW is a live window (live windows have no children).
443Return nil if WINDOW is not a horizontal combination. */) 444Return nil if WINDOW is an internal window whose children form a
445vertical combination. */)
444 (Lisp_Object window) 446 (Lisp_Object window)
445{ 447{
448 CHECK_WINDOW (window);
446 return decode_any_window (window)->hchild; 449 return decode_any_window (window)->hchild;
447} 450}
448 451
449DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, 452DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
450 doc: /* Return WINDOW's next sibling window. 453 doc: /* Return the next sibling window of window WINDOW.
451WINDOW can be any window and defaults to the selected one. 454If WINDOW is omitted or nil, it defaults to the selected window.
452Return nil if WINDOW has no next sibling. */) 455Return nil if WINDOW has no next sibling. */)
453 (Lisp_Object window) 456 (Lisp_Object window)
454{ 457{
@@ -456,8 +459,8 @@ Return nil if WINDOW has no next sibling. */)
456} 459}
457 460
458DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, 461DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
459 doc: /* Return WINDOW's previous sibling window. 462 doc: /* Return the previous sibling window of window WINDOW.
460WINDOW can be any window and defaults to the selected one. 463If WINDOW is omitted or nil, it defaults to the selected window.
461Return nil if WINDOW has no previous sibling. */) 464Return nil if WINDOW has no previous sibling. */)
462 (Lisp_Object window) 465 (Lisp_Object window)
463{ 466{
@@ -465,8 +468,8 @@ Return nil if WINDOW has no previous sibling. */)
465} 468}
466 469
467DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0, 470DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0,
468 doc: /* Return splits status for WINDOW. 471 doc: /* Return splits status for the window WINDOW.
469WINDOW can be any window and defaults to the selected one. 472If WINDOW is omitted or nil, it defaults to the selected window.
470 473
471If the value returned by this function is nil and WINDOW is resized, the 474If the value returned by this function is nil and WINDOW is resized, the
472corresponding space is preferably taken from (or given to) WINDOW's 475corresponding space is preferably taken from (or given to) WINDOW's
@@ -481,9 +484,8 @@ WINDOW may resize all windows in the same combination. */)
481} 484}
482 485
483DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0, 486DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0,
484 doc: /* Set splits status of WINDOW to STATUS. 487 doc: /* Set splits status of window WINDOW to STATUS.
485WINDOW can be any window and defaults to the selected one. Return 488If WINDOW is omitted or nil, it defaults to the selected window.
486STATUS.
487 489
488If STATUS is nil and WINDOW is later resized, the corresponding space is 490If STATUS is nil and WINDOW is later resized, the corresponding space is
489preferably taken from (or given to) WINDOW's right sibling. When WINDOW 491preferably taken from (or given to) WINDOW's right sibling. When WINDOW
@@ -501,8 +503,8 @@ windows in the same combination. */)
501} 503}
502 504
503DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0, 505DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0,
504 doc: /* Return nest status of WINDOW. 506 doc: /* Return nest status of window WINDOW.
505WINDOW can be any window and defaults to the selected one. 507If WINDOW is omitted or nil, it defaults to the selected window.
506 508
507If the return value is nil, subwindows of WINDOW can be recombined with 509If the return value is nil, subwindows of WINDOW can be recombined with
508WINDOW's siblings. A return value of non-nil means that subwindows of 510WINDOW's siblings. A return value of non-nil means that subwindows of
@@ -513,9 +515,8 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */)
513} 515}
514 516
515DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0, 517DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0,
516 doc: /* Set nest status of WINDOW to STATUS. 518 doc: /* Set nest status of window WINDOW to STATUS; return STATUS.
517WINDOW can be any window and defaults to the selected one. Return 519If WINDOW is omitted or nil, it defaults to the selected window.
518STATUS.
519 520
520If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's 521If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's
521siblings. STATUS non-nil means that subwindows of WINDOW are never 522siblings. STATUS non-nil means that subwindows of WINDOW are never
@@ -530,22 +531,24 @@ siblings. STATUS non-nil means that subwindows of WINDOW are never
530} 531}
531 532
532DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 533DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
533 doc: /* Return WINDOW's use time. 534 doc: /* Return the use time of window WINDOW.
534WINDOW defaults to the selected window. The window with the highest use 535If WINDOW is omitted or nil, it defaults to the selected window.
535time is the most recently selected one. The window with the lowest use 536The window with the highest use time is the most recently selected
536time is the least recently selected one. */) 537one. The window with the lowest use time is the least recently
538selected one. */)
537 (Lisp_Object window) 539 (Lisp_Object window)
538{ 540{
539 return decode_window (window)->use_time; 541 return decode_window (window)->use_time;
540} 542}
541 543
542DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, 544DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0,
543 doc: /* Return the total number of lines of WINDOW. 545 doc: /* Return the total number of lines of window WINDOW.
544WINDOW can be any window and defaults to the selected one. The return 546If WINDOW is omitted or nil, it defaults to the selected window.
545value includes WINDOW's mode line and header line, if any. If WINDOW 547
546is internal, the return value is the sum of the total number of lines 548The return value includes WINDOW's mode line and header line, if any.
547of WINDOW's child windows if these are vertically combined and the 549If WINDOW is internal, the return value is the sum of the total number
548height of WINDOW's first child otherwise. 550of lines of WINDOW's child windows if these are vertically combined
551and the height of WINDOW's first child otherwise.
549 552
550Optional argument HORIZONTAL non-nil means return the total number of 553Optional argument HORIZONTAL non-nil means return the total number of
551columns of WINDOW. In this case the return value includes any vertical 554columns of WINDOW. In this case the return value includes any vertical
@@ -562,17 +565,17 @@ first child otherwise. */)
562} 565}
563 566
564DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 567DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
565 doc: /* Return new total size of WINDOW. 568 doc: /* Return the new total size of window WINDOW.
566WINDOW defaults to the selected window. */) 569If WINDOW is omitted or nil, it defaults to the selected window. */)
567 (Lisp_Object window) 570 (Lisp_Object window)
568{ 571{
569 return decode_any_window (window)->new_total; 572 return decode_any_window (window)->new_total;
570} 573}
571 574
572DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, 575DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
573 doc: /* Return normal height of WINDOW. 576 doc: /* Return the normal height of window WINDOW.
574WINDOW can be any window and defaults to the selected one. Optional 577If WINDOW is omitted or nil, it defaults to the selected window.
575argument HORIZONTAL non-nil means return normal width of WINDOW. */) 578If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
576 (Lisp_Object window, Lisp_Object horizontal) 579 (Lisp_Object window, Lisp_Object horizontal)
577{ 580{
578 if (NILP (horizontal)) 581 if (NILP (horizontal))
@@ -582,24 +585,24 @@ argument HORIZONTAL non-nil means return normal width of WINDOW. */)
582} 585}
583 586
584DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, 587DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
585 doc: /* Return new normal size of WINDOW. 588 doc: /* Return new normal size of window WINDOW.
586WINDOW can be any window and defaults to the selected one. */) 589If WINDOW is omitted or nil, it defaults to the selected window. */)
587 (Lisp_Object window) 590 (Lisp_Object window)
588{ 591{
589 return decode_any_window (window)->new_normal; 592 return decode_any_window (window)->new_normal;
590} 593}
591 594
592DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 595DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
593 doc: /* Return left column of WINDOW. 596 doc: /* Return left column of window WINDOW.
594WINDOW can be any window and defaults to the selected one. */) 597If WINDOW is omitted or nil, it defaults to the selected window. */)
595 (Lisp_Object window) 598 (Lisp_Object window)
596{ 599{
597 return decode_any_window (window)->left_col; 600 return decode_any_window (window)->left_col;
598} 601}
599 602
600DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 603DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
601 doc: /* Return top line of WINDOW. 604 doc: /* Return top line of window WINDOW.
602WINDOW can be any window and defaults to the selected one. */) 605If WINDOW is omitted or nil, it defaults to the selected window. */)
603 (Lisp_Object window) 606 (Lisp_Object window)
604{ 607{
605 return decode_any_window (window)->top_line; 608 return decode_any_window (window)->top_line;
@@ -2313,7 +2316,7 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
2313DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, 2316DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
2314 doc: /* Return a list of windows on FRAME, starting with WINDOW. 2317 doc: /* Return a list of windows on FRAME, starting with WINDOW.
2315FRAME nil or omitted means use the selected frame. 2318FRAME nil or omitted means use the selected frame.
2316WINDOW nil or omitted means use the selected window. 2319WINDOW nil or omitted means use the window selected within FRAME.
2317MINIBUF t means include the minibuffer window, even if it isn't active. 2320MINIBUF t means include the minibuffer window, even if it isn't active.
2318MINIBUF nil or omitted means include the minibuffer window only 2321MINIBUF nil or omitted means include the minibuffer window only
2319if it's active. 2322if it's active.
@@ -6007,7 +6010,7 @@ means no margin. */)
6007DEFUN ("window-margins", Fwindow_margins, Swindow_margins, 6010DEFUN ("window-margins", Fwindow_margins, Swindow_margins,
6008 0, 1, 0, 6011 0, 1, 0,
6009 doc: /* Get width of marginal areas of window WINDOW. 6012 doc: /* Get width of marginal areas of window WINDOW.
6010If WINDOW is omitted or nil, use the currently selected window. 6013If WINDOW is omitted or nil, it defaults to the selected window.
6011Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). 6014Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).
6012If a marginal area does not exist, its width will be returned 6015If a marginal area does not exist, its width will be returned
6013as nil. */) 6016as nil. */)
@@ -6071,7 +6074,7 @@ display marginal areas and the text area. */)
6071DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, 6074DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes,
6072 0, 1, 0, 6075 0, 1, 0,
6073 doc: /* Get width of fringes of window WINDOW. 6076 doc: /* Get width of fringes of window WINDOW.
6074If WINDOW is omitted or nil, use the currently selected window. 6077If WINDOW is omitted or nil, it defaults to the selected window.
6075Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) 6078Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
6076 (Lisp_Object window) 6079 (Lisp_Object window)
6077{ 6080{
@@ -6140,7 +6143,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6140DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, 6143DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars,
6141 0, 1, 0, 6144 0, 1, 0,
6142 doc: /* Get width and type of scroll bars of window WINDOW. 6145 doc: /* Get width and type of scroll bars of window WINDOW.
6143If WINDOW is omitted or nil, use the currently selected window. 6146If WINDOW is omitted or nil, it defaults to the selected window.
6144Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). 6147Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE).
6145If WIDTH is nil or TYPE is t, the window is using the frame's corresponding 6148If WIDTH is nil or TYPE is t, the window is using the frame's corresponding
6146value. */) 6149value. */)
@@ -6163,7 +6166,7 @@ value. */)
6163 6166
6164DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0, 6167DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
6165 doc: /* Return the amount by which WINDOW is scrolled vertically. 6168 doc: /* Return the amount by which WINDOW is scrolled vertically.
6166Use the selected window if WINDOW is nil or omitted. 6169If WINDOW is omitted or nil, it defaults to the selected window.
6167Normally, value is a multiple of the canonical character height of WINDOW; 6170Normally, value is a multiple of the canonical character height of WINDOW;
6168optional second arg PIXELS-P means value is measured in pixels. */) 6171optional second arg PIXELS-P means value is measured in pixels. */)
6169 (Lisp_Object window, Lisp_Object pixels_p) 6172 (Lisp_Object window, Lisp_Object pixels_p)
diff --git a/src/xdisp.c b/src/xdisp.c
index 6414ab00fd8..5d6d919af67 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2768,9 +2768,13 @@ init_iterator (struct it *it, struct window *w,
2768 /* Do we need to reorder bidirectional text? Not if this is a 2768 /* Do we need to reorder bidirectional text? Not if this is a
2769 unibyte buffer: by definition, none of the single-byte 2769 unibyte buffer: by definition, none of the single-byte
2770 characters are strong R2L, so no reordering is needed. And 2770 characters are strong R2L, so no reordering is needed. And
2771 bidi.c doesn't support unibyte buffers anyway. */ 2771 bidi.c doesn't support unibyte buffers anyway. Also, don't
2772 reorder while we are loading loadup.el, since the tables of
2773 character properties needed for reordering are not yet
2774 available. */
2772 it->bidi_p = 2775 it->bidi_p =
2773 !NILP (BVAR (current_buffer, bidi_display_reordering)) 2776 NILP (Vpurify_flag)
2777 && !NILP (BVAR (current_buffer, bidi_display_reordering))
2774 && it->multibyte_p; 2778 && it->multibyte_p;
2775 2779
2776 /* If we are to reorder bidirectional text, init the bidi 2780 /* If we are to reorder bidirectional text, init the bidi
@@ -6171,8 +6175,12 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6171 it->multibyte_p = multibyte > 0; 6175 it->multibyte_p = multibyte > 0;
6172 6176
6173 /* Bidirectional reordering of strings is controlled by the default 6177 /* Bidirectional reordering of strings is controlled by the default
6174 value of bidi-display-reordering. */ 6178 value of bidi-display-reordering. Don't try to reorder while
6175 it->bidi_p = !NILP (BVAR (&buffer_defaults, bidi_display_reordering)); 6179 loading loadup.el, as the necessary character property tables are
6180 not yet available. */
6181 it->bidi_p =
6182 NILP (Vpurify_flag)
6183 && !NILP (BVAR (&buffer_defaults, bidi_display_reordering));
6176 6184
6177 if (s == NULL) 6185 if (s == NULL)
6178 { 6186 {
@@ -19565,7 +19573,10 @@ See also `bidi-paragraph-direction'. */)
19565 } 19573 }
19566 19574
19567 if (NILP (BVAR (buf, bidi_display_reordering)) 19575 if (NILP (BVAR (buf, bidi_display_reordering))
19568 || NILP (BVAR (buf, enable_multibyte_characters))) 19576 || NILP (BVAR (buf, enable_multibyte_characters))
19577 /* When we are loading loadup.el, the character property tables
19578 needed for bidi iteration are not yet available. */
19579 || !NILP (Vpurify_flag))
19569 return Qleft_to_right; 19580 return Qleft_to_right;
19570 else if (!NILP (BVAR (buf, bidi_paragraph_direction))) 19581 else if (!NILP (BVAR (buf, bidi_paragraph_direction)))
19571 return BVAR (buf, bidi_paragraph_direction); 19582 return BVAR (buf, bidi_paragraph_direction);
@@ -27390,8 +27401,12 @@ note_mouse_highlight (struct frame *f, int x, int y)
27390 } 27401 }
27391 27402
27392 mouse_face_from_buffer_pos (window, hlinfo, pos, 27403 mouse_face_from_buffer_pos (window, hlinfo, pos,
27393 XFASTINT (before), 27404 NILP (before)
27394 XFASTINT (after), 27405 ? 1
27406 : XFASTINT (before),
27407 NILP (after)
27408 ? BUF_Z (XBUFFER (buffer))
27409 : XFASTINT (after),
27395 before_string, after_string, 27410 before_string, after_string,
27396 disp_string); 27411 disp_string);
27397 cursor = No_Cursor; 27412 cursor = No_Cursor;
diff --git a/src/xfns.c b/src/xfns.c
index ac030582ffe..49c4c774cae 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2914,7 +2914,7 @@ x_free_gcs (struct frame *f)
2914 2914
2915 2915
2916/* Handler for signals raised during x_create_frame and 2916/* Handler for signals raised during x_create_frame and
2917 x_create_top_frame. FRAME is the frame which is partially 2917 x_create_tip_frame. FRAME is the frame which is partially
2918 constructed. */ 2918 constructed. */
2919 2919
2920static Lisp_Object 2920static Lisp_Object
@@ -3138,7 +3138,6 @@ This function is an internal primitive--use `make-frame' instead. */)
3138 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; 3138 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
3139 3139
3140 f->terminal = dpyinfo->terminal; 3140 f->terminal = dpyinfo->terminal;
3141 f->terminal->reference_count++;
3142 3141
3143 f->output_method = output_x_window; 3142 f->output_method = output_x_window;
3144 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); 3143 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
@@ -3308,6 +3307,12 @@ This function is an internal primitive--use `make-frame' instead. */)
3308 "scrollBarBackground", 3307 "scrollBarBackground",
3309 "ScrollBarBackground", 0); 3308 "ScrollBarBackground", 0);
3310 3309
3310#if GLYPH_DEBUG
3311 image_cache_refcount =
3312 FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
3313 dpyinfo_refcount = dpyinfo->reference_count;
3314#endif /* GLYPH_DEBUG */
3315
3311 /* Init faces before x_default_parameter is called for scroll-bar 3316 /* Init faces before x_default_parameter is called for scroll-bar
3312 parameters because that function calls x_set_scroll_bar_width, 3317 parameters because that function calls x_set_scroll_bar_width,
3313 which calls change_frame_size, which calls Fset_window_buffer, 3318 which calls change_frame_size, which calls Fset_window_buffer,
@@ -3316,11 +3321,6 @@ This function is an internal primitive--use `make-frame' instead. */)
3316 happen. */ 3321 happen. */
3317 init_frame_faces (f); 3322 init_frame_faces (f);
3318 3323
3319#if GLYPH_DEBUG
3320 image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
3321 dpyinfo_refcount = dpyinfo->reference_count;
3322#endif /* GLYPH_DEBUG */
3323
3324 /* The X resources controlling the menu-bar and tool-bar are 3324 /* The X resources controlling the menu-bar and tool-bar are
3325 processed specially at startup, and reflected in the mode 3325 processed specially at startup, and reflected in the mode
3326 variables; ignore them here. */ 3326 variables; ignore them here. */
@@ -3364,6 +3364,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3364 x_make_gc (f); 3364 x_make_gc (f);
3365 3365
3366 /* Now consider the frame official. */ 3366 /* Now consider the frame official. */
3367 f->terminal->reference_count++;
3367 FRAME_X_DISPLAY_INFO (f)->reference_count++; 3368 FRAME_X_DISPLAY_INFO (f)->reference_count++;
3368 Vframe_list = Fcons (frame, Vframe_list); 3369 Vframe_list = Fcons (frame, Vframe_list);
3369 3370
@@ -4594,7 +4595,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4594 record_unwind_protect (unwind_create_tip_frame, frame); 4595 record_unwind_protect (unwind_create_tip_frame, frame);
4595 4596
4596 f->terminal = dpyinfo->terminal; 4597 f->terminal = dpyinfo->terminal;
4597 f->terminal->reference_count++;
4598 4598
4599 /* By setting the output method, we're essentially saying that 4599 /* By setting the output method, we're essentially saying that
4600 the frame is live, as per FRAME_LIVE_P. If we get a signal 4600 the frame is live, as per FRAME_LIVE_P. If we get a signal
@@ -4716,6 +4716,12 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4716 x_default_parameter (f, parms, Qborder_color, build_string ("black"), 4716 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
4717 "borderColor", "BorderColor", RES_TYPE_STRING); 4717 "borderColor", "BorderColor", RES_TYPE_STRING);
4718 4718
4719#if GLYPH_DEBUG
4720 image_cache_refcount =
4721 FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
4722 dpyinfo_refcount = dpyinfo->reference_count;
4723#endif /* GLYPH_DEBUG */
4724
4719 /* Init faces before x_default_parameter is called for scroll-bar 4725 /* Init faces before x_default_parameter is called for scroll-bar
4720 parameters because that function calls x_set_scroll_bar_width, 4726 parameters because that function calls x_set_scroll_bar_width,
4721 which calls change_frame_size, which calls Fset_window_buffer, 4727 which calls change_frame_size, which calls Fset_window_buffer,
@@ -4724,11 +4730,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4724 happen. */ 4730 happen. */
4725 init_frame_faces (f); 4731 init_frame_faces (f);
4726 4732
4727#if GLYPH_DEBUG
4728 image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
4729 dpyinfo_refcount = dpyinfo->reference_count;
4730#endif /* GLYPH_DEBUG */
4731
4732 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; 4733 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
4733 4734
4734 x_figure_window_size (f, parms, 0); 4735 x_figure_window_size (f, parms, 0);
@@ -4834,14 +4835,16 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4834 4835
4835 UNGCPRO; 4836 UNGCPRO;
4836 4837
4838 /* Now that the frame will be official, it counts as a reference to
4839 its display and terminal. */
4840 FRAME_X_DISPLAY_INFO (f)->reference_count++;
4841 f->terminal->reference_count++;
4842
4837 /* It is now ok to make the frame official even if we get an error 4843 /* It is now ok to make the frame official even if we get an error
4838 below. And the frame needs to be on Vframe_list or making it 4844 below. And the frame needs to be on Vframe_list or making it
4839 visible won't work. */ 4845 visible won't work. */
4840 Vframe_list = Fcons (frame, Vframe_list); 4846 Vframe_list = Fcons (frame, Vframe_list);
4841 4847
4842 /* Now that the frame is official, it counts as a reference to
4843 its display. */
4844 FRAME_X_DISPLAY_INFO (f)->reference_count++;
4845 4848
4846 /* Setting attributes of faces of the tooltip frame from resources 4849 /* Setting attributes of faces of the tooltip frame from resources
4847 and similar will increment face_change_count, which leads to the 4850 and similar will increment face_change_count, which leads to the
diff --git a/src/xmenu.c b/src/xmenu.c
index 7fcd2ad3724..0dd652b566d 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1604,6 +1604,17 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1604 1604
1605#endif /* not USE_GTK */ 1605#endif /* not USE_GTK */
1606 1606
1607static Lisp_Object
1608cleanup_widget_value_tree (Lisp_Object arg)
1609{
1610 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1611 widget_value *wv = p->pointer;
1612
1613 free_menubar_widget_value_tree (wv);
1614
1615 return Qnil;
1616}
1617
1607Lisp_Object 1618Lisp_Object
1608xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 1619xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1609 Lisp_Object title, const char **error_name, Time timestamp) 1620 Lisp_Object title, const char **error_name, Time timestamp)
@@ -1618,6 +1629,8 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1618 1629
1619 int first_pane; 1630 int first_pane;
1620 1631
1632 int specpdl_count = SPECPDL_INDEX ();
1633
1621 if (! FRAME_X_P (f)) 1634 if (! FRAME_X_P (f))
1622 abort (); 1635 abort ();
1623 1636
@@ -1812,11 +1825,15 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1812 /* No selection has been chosen yet. */ 1825 /* No selection has been chosen yet. */
1813 menu_item_selection = 0; 1826 menu_item_selection = 0;
1814 1827
1828 /* Make sure to free the widget_value objects we used to specify the
1829 contents even with longjmp. */
1830 record_unwind_protect (cleanup_widget_value_tree,
1831 make_save_value (first_wv, 0));
1832
1815 /* Actually create and show the menu until popped down. */ 1833 /* Actually create and show the menu until popped down. */
1816 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp); 1834 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp);
1817 1835
1818 /* Free the widget_value objects we used to specify the contents. */ 1836 unbind_to (specpdl_count, Qnil);
1819 free_menubar_widget_value_tree (first_wv);
1820 1837
1821 /* Find the selected item, and its pane, to return 1838 /* Find the selected item, and its pane, to return
1822 the proper value. */ 1839 the proper value. */
@@ -2003,6 +2020,8 @@ xdialog_show (FRAME_PTR f,
2003 /* 1 means we've seen the boundary between left-hand elts and right-hand. */ 2020 /* 1 means we've seen the boundary between left-hand elts and right-hand. */
2004 int boundary_seen = 0; 2021 int boundary_seen = 0;
2005 2022
2023 int specpdl_count = SPECPDL_INDEX ();
2024
2006 if (! FRAME_X_P (f)) 2025 if (! FRAME_X_P (f))
2007 abort (); 2026 abort ();
2008 2027
@@ -2116,11 +2135,15 @@ xdialog_show (FRAME_PTR f,
2116 /* No selection has been chosen yet. */ 2135 /* No selection has been chosen yet. */
2117 menu_item_selection = 0; 2136 menu_item_selection = 0;
2118 2137
2138 /* Make sure to free the widget_value objects we used to specify the
2139 contents even with longjmp. */
2140 record_unwind_protect (cleanup_widget_value_tree,
2141 make_save_value (first_wv, 0));
2142
2119 /* Actually create and show the dialog. */ 2143 /* Actually create and show the dialog. */
2120 create_and_show_dialog (f, first_wv); 2144 create_and_show_dialog (f, first_wv);
2121 2145
2122 /* Free the widget_value objects we used to specify the contents. */ 2146 unbind_to (specpdl_count, Qnil);
2123 free_menubar_widget_value_tree (first_wv);
2124 2147
2125 /* Find the selected item, and its pane, to return 2148 /* Find the selected item, and its pane, to return
2126 the proper value. */ 2149 the proper value. */