aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa <[email protected]>2011-11-07 11:00:43 +0900
committerKenichi Handa <[email protected]>2011-11-07 11:00:43 +0900
commit0d92c7bfab134043c37c5712b56329bf644fda37 (patch)
treea85be6fb21d1c4becc13e1ca199caedc331f6e15
parenta0241d014e3d762bc7818d6cd8fd7c90bab3c538 (diff)
parenta64bfdfa5a90731b804c057f2bcc74a8ba02937c (diff)
merge trunk
-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/ChangeLog16
-rw-r--r--doc/lispref/windows.texi459
-rw-r--r--etc/NEWS21
-rw-r--r--lib/makefile.w32-in4
-rw-r--r--lisp/ChangeLog40
-rw-r--r--lisp/mail/rmail.el2
-rw-r--r--lisp/window.el170
-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/ChangeLog147
-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/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.c158
-rw-r--r--src/xdisp.c29
-rw-r--r--src/xfns.c35
-rw-r--r--src/xmenu.c31
41 files changed, 1306 insertions, 820 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d8f5758af..68f5042d7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-11-05 Eli Zaretskii <[email protected]>
+
+ * lib/makefile.w32-in (FRC): New dummy target.
+ (TAGS): Depend on FRC.
+
+2011-11-04 Glenn Morris <[email protected]>
+
+ * configure.in: Increase minimum GnuTLS version to 2.6.6. (Bug#9929)
+ Do not include GnuTLS version info in final summary message.
+
2011-10-31 Eli Zaretskii <[email protected]>
* config.bat: Use config.in and Makefile.in from src/ and lib/, if
diff --git a/autogen/configure b/autogen/configure
index 88a63c8b4f..eb7c9428f3 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -11692,23 +11692,23 @@ fi
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls >= 2.6.0" >&5
-$as_echo_n "checking for gnutls >= 2.6.0... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls >= 2.6.6" >&5
+$as_echo_n "checking for gnutls >= 2.6.6... " >&6; }
- if $PKG_CONFIG --exists "gnutls >= 2.6.0" 2>&5; then
+ if $PKG_CONFIG --exists "gnutls >= 2.6.6" 2>&5; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
succeeded=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_CFLAGS" >&5
$as_echo_n "checking LIBGNUTLS_CFLAGS... " >&6; }
- LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 2.6.0"|sed -e 's,///*,/,g'`
+ LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 2.6.6"|sed -e 's,///*,/,g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_CFLAGS" >&5
$as_echo "$LIBGNUTLS_CFLAGS" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_LIBS" >&5
$as_echo_n "checking LIBGNUTLS_LIBS... " >&6; }
- LIBGNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 2.6.0"|sed -e 's,///*,/,g'`
+ LIBGNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 2.6.6"|sed -e 's,///*,/,g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_LIBS" >&5
$as_echo "$LIBGNUTLS_LIBS" >&6; }
else
@@ -11718,7 +11718,7 @@ $as_echo "no" >&6; }
LIBGNUTLS_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
- LIBGNUTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnutls >= 2.6.0"`
+ LIBGNUTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnutls >= 2.6.6"`
fi
@@ -22425,7 +22425,7 @@ echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
-echo " Does Emacs use -lgnutls (2.6.x or higher)? ${HAVE_GNUTLS}"
+echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
diff --git a/configure.in b/configure.in
index 54fba2553b..5067aac3d1 100644
--- a/configure.in
+++ b/configure.in
@@ -2063,7 +2063,7 @@ AC_SUBST(LIBSELINUX_LIBS)
HAVE_GNUTLS=no
HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=no
if test "${with_gnutls}" = "yes" ; then
- PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.0], HAVE_GNUTLS=yes, HAVE_GNUTLS=no)
+ PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no)
if test "${HAVE_GNUTLS}" = "yes"; then
AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
fi
@@ -3720,7 +3720,7 @@ echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
-echo " Does Emacs use -lgnutls (2.6.x or higher)? ${HAVE_GNUTLS}"
+echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 9a501d3837..a808a96b44 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,20 @@
+2011-11-06 Chong Yidong <[email protected]>
+
+ * windows.texi (Basic Window): Add xref to Cursor Display.
+ (Split Window): Document negative arg for splitting commands.
+ (Other Window): Document mouse-1 in text area of window.
+ (Change Window): Don't mention window attributes, since they
+ aren't defined. C-x 1 can't be used with minibuffer windows.
+ Windows are no longer auto-deleted.
+ (Window Choice): Add xref to Choosing Window in Lisp manual.
+ (Window Convenience): Note that windmove disables shift-selection.
+ Move M-x compare-windows here from Other Window node.
+
+ * custom.texi (Mouse Buttons):
+ * search.texi (Isearch Scroll):
+ * windows.texi (Split Window): Use new names split-window-below
+ and split-window-right.
+
2011-10-26 Juanma Barranquero <[email protected]>
* emacs.texi (Top): Fix typo.
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index d87c22ec28..fd680576b4 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
redefine the second mouse button to split the current window:
@example
-(global-set-key [mouse-2] 'split-window-vertically)
+(global-set-key [mouse-2] 'split-window-below)
@end example
The symbols for drag events are similar, but have the prefix
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index a8bd1cdf18..0b68373d47 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
won't let you scroll the current match out of visibility, however.
The @code{isearch-allow-scroll} feature also affects some other
-commands, such as @kbd{C-x 2} (@code{split-window-vertically}) and
-@kbd{C-x ^} (@code{enlarge-window}), which don't exactly scroll but do
-affect where the text appears on the screen. It applies to any
-command whose name has a non-@code{nil} @code{isearch-scroll}
-property. So you can control which commands are affected by changing
-these properties.
+commands, such as @kbd{C-x 2} (@code{split-window-below}) and @kbd{C-x
+^} (@code{enlarge-window}), which don't exactly scroll but do affect
+where the text appears on the screen. It applies to any command whose
+name has a non-@code{nil} @code{isearch-scroll} property. So you can
+control which commands are affected by changing these properties.
For example, to make @kbd{C-h l} usable within an incremental search
in 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 600d0b0781..ad2040c904 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -34,24 +34,22 @@ has its own value of point.
@cindex selected window
At any time, one Emacs window is the @dfn{selected window}; the
-buffer this window is displaying is the current buffer. The terminal's
-cursor shows the location of point in this window. Each other window
-has a location of point as well. On text-only terminals, there is no
-way to show where those locations are, since the terminal has only one
-cursor. On a graphical display, the location of point in a
-non-selected window is indicated by a hollow box; the cursor in the
-selected window is blinking or solid.
-
- Commands to move point affect the value of point for the selected Emacs
-window only. They do not change the value of point in other Emacs
-windows, even those showing the same buffer. The same is true for commands
-such as @kbd{C-x b} to switch buffers in the selected window;
-they do not affect other windows at all. However, there are other commands
-such as @kbd{C-x 4 b} that select a different window and switch buffers in
-it. Also, all commands that display information in a window, including
+buffer this window is displaying is the current buffer. Each window
+has its own value of point. On graphical displays, the point is
+indicated by a solid blinking cursor in the selected window, and by a
+hollow box in non-selected windows. On text-only terminals, the
+cursor is drawn only in the selected window. @xref{Cursor Display}.
+
+ Commands to move point affect the value of point for the selected
+Emacs window only. They do not change the value of point in other
+Emacs windows, even those showing the same buffer. The same is true
+for buffer-switching commands such as @kbd{C-x b}; they do not affect
+other windows at all. However, there are other commands such as
+@kbd{C-x 4 b} that select a different window and switch buffers in it.
+Also, all commands that display information in a window, including
(for example) @kbd{C-h f} (@code{describe-function}) and @kbd{C-x C-b}
-(@code{list-buffers}), work by switching buffers in a nonselected window
-without affecting the selected window.
+(@code{list-buffers}), work by switching buffers in a nonselected
+window without affecting the selected window.
When multiple windows show the same buffer, they can have different
regions, because they can have different values of point. However,
@@ -61,7 +59,7 @@ only one mark position.
Each window has its own mode line, which displays the buffer name,
modification status and major and minor modes of the buffer that is
displayed in the window. The selected window's mode line appears in a
-different color. @xref{Mode Line}, for full details on the mode line.
+different color. @xref{Mode Line}, for details.
@node Split Window
@section Splitting Windows
@@ -69,91 +67,87 @@ different color. @xref{Mode Line}, for full details on the mode line.
@table @kbd
@item C-x 2
Split the selected window into two windows, one above the other
-(@code{split-window-vertically}).
+(@code{split-window-below}).
@item C-x 3
-Split the selected window into two windows positioned side by side
-(@code{split-window-horizontally}).
+Split the selected window into two windows, positioned side by side
+(@code{split-window-right}).
@item C-Mouse-2
In the mode line or scroll bar of a window, split that window.
@end table
@kindex C-x 2
-@findex split-window-vertically
- The command @kbd{C-x 2} (@code{split-window-vertically}) breaks the
-selected window into two windows, one above the other. Both windows start
-out displaying the same buffer, with the same value of point. By default
-the two windows each get half the height of the window that was split; a
-numeric argument specifies how many lines to give to the top window.
+@findex split-window-below
+ @kbd{C-x 2} (@code{split-window-below}) splits the selected window
+into two windows, one above the other. After splitting, the selected
+window is the upper one, and the newly split-off window is below.
+Both windows have the same value of point as before, and display the
+same portion of the buffer (or as close to it as possible). If
+necessary, the windows are scrolled to keep point on-screen. By
+default, the two windows each get half the height of the original
+window. A positive numeric argument specifies how many lines to give
+to the top window; a negative numeric argument specifies how many
+lines to give to the bottom window.
-@kindex C-x 3
-@findex split-window-horizontally
- @kbd{C-x 3} (@code{split-window-horizontally}) breaks the selected
-window into two side-by-side windows. A numeric argument specifies how
-many columns to give the one on the left. If you are not using
-scrollbars, a vertical line separates the two windows.
-You can customize its color with the face @code{vertical-border}.
-Windows that are not the full width of the screen have mode lines, but
-they are truncated. On terminals where Emacs does not support
-highlighting, truncated mode lines sometimes do not appear in inverse
-video.
+@vindex split-window-keep-point
+ If you change the variable @code{split-window-keep-point} to
+@code{nil}, @kbd{C-x 2} instead adjusts the portion of the buffer
+displayed by the two windows, as well as the value of point in each
+window, in order to keep the text on the screen as close as possible
+to what it was before; furthermore, if point was in the lower half of
+the original window, the bottom window is selected instead of the
+upper one.
-@kindex C-Mouse-2 @r{(scroll bar)}
- You can split a window horizontally or vertically by clicking
-@kbd{C-Mouse-2} in the mode line or the scroll bar. The line of
-splitting goes through the place where you click: if you click on the
-mode line, the new scroll bar goes above the spot; if you click in the
-scroll bar, the mode line of the split window is side by side with
-your click.
+@kindex C-x 3
+@findex split-window-right
+ @kbd{C-x 3} (@code{split-window-right}) splits the selected window
+into two side-by-side windows. The left window is the selected one;
+the right window displays the same portion of the same buffer, and has
+the same value of point. A positive numeric argument specifies how
+many columns to give the left window; a negative numeric argument
+specifies how many columns to give the right window.
@vindex truncate-partial-width-windows
- When a window occupies less than the full width of the frame, it may
-become too narrow for most of the text lines in its buffer. If most of
-its lines are continued (@pxref{Continuation Lines}), the buffer may
-become difficult to read. Therefore, Emacs automatically truncates
-lines if the window width becomes narrower than 50 columns. This
-truncation occurs regardless of the value of the variable
-@code{truncate-lines} (@pxref{Line Truncation}); it is instead
-controlled by the variable @code{truncate-partial-width-windows}. If
-the value of @code{truncate-partial-width-windows} is a positive integer
-(the default is 50), that specifies the minimum width for a
-partial-width window before automatic line truncation occurs; if the
-value is @code{nil}, automatic line truncation is disabled; and for any
-other non-@code{nil} value, Emacs truncates lines in every partial-width
-window regardless of its width.
-
- Horizontal scrolling is often used in side-by-side windows.
-@xref{Horizontal Scrolling}.
+ When you split a window with @kbd{C-x 3}, each resulting window
+occupies less than the full width of the frame. If it becomes too
+narrow, the buffer may be difficult to read if continuation lines are
+in use (@pxref{Continuation Lines}). Therefore, Emacs automatically
+switches to line truncation if the window width becomes narrower than
+50 columns. This truncation occurs regardless of the value of the
+variable @code{truncate-lines} (@pxref{Line Truncation}); it is
+instead controlled by the variable
+@code{truncate-partial-width-windows}. If the value of this variable
+is a positive integer (the default is 50), that specifies the minimum
+width for a partial-width window before automatic line truncation
+occurs; if the value is @code{nil}, automatic line truncation is
+disabled; and for any other non-@code{nil} value, Emacs truncates
+lines in every partial-width window regardless of its width.
+
+ On text terminals, side-by-side windows are separated by a vertical
+divider which is drawn using the @code{vertical-border} face.
-@vindex split-window-keep-point
- If @code{split-window-keep-point} is non-@code{nil}, the default,
-both of the windows resulting from @kbd{C-x 2} inherit the value of
-point from the window that was split. This means that scrolling is
-inevitable. If this variable is @code{nil}, then @kbd{C-x 2} tries to
-avoid scrolling the text currently visible on the screen, by putting
-point in each window at a position already visible in the window. It
-also selects whichever window contains the screen line that the cursor
-was previously on. Some users prefer that mode on slow terminals.
+@kindex C-Mouse-2 @r{(scroll bar)}
+ You can also split a window horizontally or vertically by clicking
+@kbd{C-Mouse-2} in the mode line or the scroll bar. If you click on
+the mode line, that puts the vertical divider where you click; if you
+click in the scroll bar, that puts the new mode-line where you click.
@node Other Window
@section Using Other Windows
@table @kbd
@item C-x o
-Select another window (@code{other-window}). That is @kbd{o}, not zero.
+Select another window (@code{other-window}).
@item C-M-v
Scroll the next window (@code{scroll-other-window}).
-@item M-x compare-windows
-Find next place where the text in the selected window does not match
-the text in the next window.
@item Mouse-1
-@kbd{Mouse-1}, in a window's mode line, selects that window
-but does not move point in it (@code{mouse-select-window}).
+@kbd{Mouse-1}, in the text area of a window, selects the window and
+moves point to the position clicked. Clicking in the mode line
+selects the window without moving point in it.
@end table
@kindex C-x o
@findex other-window
- To select a different window, click with @kbd{Mouse-1} on its mode
-line. With the keyboard, you can switch windows by typing @kbd{C-x o}
+With the keyboard, you can switch windows by typing @kbd{C-x o}
(@code{other-window}). That is an @kbd{o}, for ``other,'' not a zero.
When there are more than two windows, this command moves through all the
windows in a cyclic order, generally top to bottom and left to right.
@@ -172,17 +166,13 @@ finish supplying the minibuffer argument that is requested.
window only, but there is one command to scroll the next window.
@kbd{C-M-v} (@code{scroll-other-window}) scrolls the window that
@kbd{C-x o} would select. It takes arguments, positive and negative,
-like @kbd{C-v}. (In the minibuffer, @kbd{C-M-v} scrolls the window
-that contains the minibuffer help display, if any, rather than the
-next window in the standard cyclic order.)
-
- The command @kbd{M-x compare-windows} lets you compare two files or
-buffers visible in two windows, by moving through them to the next
-mismatch. @xref{Comparing Files}, for details.
+like @kbd{C-v}. (In the minibuffer, @kbd{C-M-v} scrolls the help
+window associated with the minibuffer, if any, rather than the next
+window in the standard cyclic order; @pxref{Minibuffer Edit}.)
@vindex mouse-autoselect-window
If you set @code{mouse-autoselect-window} to a non-@code{nil} value,
-moving the mouse into a different window selects that window. This
+moving the mouse over a different window selects that window. This
feature is off by default.
@node Pop Up Window
@@ -236,8 +226,7 @@ window (@code{find-file-read-only-other-window}). @xref{Visiting}.
@table @kbd
@item C-x 0
-Delete the selected window (@code{delete-window}). The last character
-in this key sequence is a zero.
+Delete the selected window (@code{delete-window}).
@item C-x 1
Delete all windows in the selected frame except the selected window
(@code{delete-other-windows}).
@@ -260,14 +249,12 @@ Make all windows the same height (@code{balance-windows}).
@kindex C-x 0
@findex delete-window
- To delete a window, type @kbd{C-x 0} (@code{delete-window}). (That is
-a zero.) The space occupied by the deleted window is given to an
-adjacent window (but not the minibuffer window, even if that is active
-at the time). Once a window is deleted, its attributes are forgotten;
-only restoring a window configuration can bring it back. Deleting the
+ To delete the selected window, type @kbd{C-x 0}
+(@code{delete-window}). (That is a zero.) Once a window is deleted,
+the space that it occupied is given to an adjacent window (but not the
+minibuffer window, even if that is active at the time). Deleting the
window has no effect on the buffer it used to display; the buffer
-continues to exist, and you can select it in any window with @kbd{C-x
-b}.
+continues to exist, and you can still switch to with @kbd{C-x b}.
@findex kill-buffer-and-window
@kindex C-x 4 0
@@ -277,31 +264,35 @@ selected window.
@kindex C-x 1
@findex delete-other-windows
- @kbd{C-x 1} (@code{delete-other-windows}) is more powerful in a
-different way; it deletes all the windows except the selected one (and
-the minibuffer); the selected window expands to use the whole frame
-except for the echo area.
+ @kbd{C-x 1} (@code{delete-other-windows}) deletes all the windows,
+@emph{except} the selected one; the selected window expands to use the
+whole frame. (This command cannot be used while the minibuffer window
+is active; attempting to do so signals an error.)
@kindex C-x ^
@findex enlarge-window
@kindex C-x @}
-@findex enlarge-window-horizontally
@vindex window-min-height
+ The command @kbd{C-x ^} (@code{enlarge-window}) makes the selected
+window one line taller, taking space from a vertically adjacent window
+without changing the height of the frame. With a positive numeric
+argument, this command increases the window height by that many lines;
+with a negative argument, it reduces the height by that many lines.
+If there are no vertically adjacent windows (i.e. the window is at the
+full frame height), that signals an error. The command also signals
+an error if you attempt to reduce the height of any window below a
+certain minimum number of lines, specified by the variable
+@code{window-min-height} (the default is 4).
+
+@findex enlarge-window-horizontally
+@findex shrink-window-horizontally
@vindex window-min-width
- To readjust the division of space among vertically adjacent windows,
-use @kbd{C-x ^} (@code{enlarge-window}). It makes the currently
-selected window one line bigger, or as many lines as is specified
-with a numeric argument. With a negative argument, it makes the
-selected window smaller. @kbd{C-x @}}
-(@code{enlarge-window-horizontally}) makes the selected window wider by
-the specified number of columns. @kbd{C-x @{}
-(@code{shrink-window-horizontally}) makes the selected window narrower
-by the specified number of columns.
-
- When you make a window bigger, the space comes from its peers. If
-this makes any window too small, it is deleted and its space is given
-to an adjacent window. The minimum size is specified by the variables
-@code{window-min-height} and @code{window-min-width}.
+ Similarly, @kbd{C-x @}} (@code{enlarge-window-horizontally}) makes
+the selected window wider, and @kbd{C-x @{}
+(@code{shrink-window-horizontally}) makes it narrower. These commands
+signal an error if you attempt to reduce the width of any window below
+a certain minimum number of columns, specified by the variable
+@code{window-min-width} (the default is 10).
@kindex C-x -
@findex shrink-window-if-larger-than-buffer
@@ -322,7 +313,7 @@ heights and to delete windows. @xref{Mode Line Mouse}.
@section Displaying a Buffer in a Window
It is a common Emacs operation to display or ``pop up'' some buffer
-in response to a user command. There are several different ways by
+in response to a user command. There are several different ways in
which commands do this.
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
@findex display-buffer
Some commands try to display ``intelligently'', trying not to take
-over the selected window, e.g. by splitting the selected window and
-displaying the desired buffer in the child window. Such commands,
-which include the various help commands (@pxref{Help}), work by
-calling @code{display-buffer} internally. @xref{Window Choice}, for
-details.
+over the selected window, e.g. by splitting off a new window and
+displaying the desired buffer there. Such commands, which include the
+various help commands (@pxref{Help}), work by calling
+@code{display-buffer} internally. @xref{Window Choice}, for details.
Other commands do the same as @code{display-buffer}, and
additionally select the displaying window so that you can begin
editing its buffer. The command @kbd{C-x `} (@code{next-error}) is
one example (@pxref{Compilation Mode}). Such commands work by calling
-@code{pop-to-buffer} internally. @xref{Switching Buffers,,Switching
-to a Buffer in a Window, elisp, The Emacs Lisp Reference Manual}.
+the function @code{pop-to-buffer} internally. @xref{Switching
+Buffers,,Switching to a Buffer in a Window, elisp, The Emacs Lisp
+Reference Manual}.
Commands with names ending in @code{-other-window} behave like
@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.
@findex display-buffer
The @code{display-buffer} command (as well as commands that call it
-internally) chooses a window to display using the following steps:
+internally) chooses a window to display by following the steps given
+below. @xref{Choosing Window,,Choosing a Window for Display, elisp,
+The Emacs Lisp Reference Manual}, for details about how to alter this
+sequence of steps.
@itemize
@vindex same-window-buffer-names
@@ -433,36 +427,38 @@ and display the buffer there.
@cindex mode, Winner
@cindex undoing window configuration changes
@cindex window configuration changes, undoing
- @kbd{M-x winner-mode} is a global minor mode that records the
-changes in the window configuration (i.e. how the frames are
-partitioned into windows), so that you can ``undo'' them. To undo,
-use @kbd{C-c left} (@code{winner-undo}). If you change your mind
-while undoing, you can redo the changes you had undone using @kbd{C-c
-right} (@code{M-x winner-redo}). Another way to enable Winner mode is
-by customizing the variable @code{winner-mode}.
+ Winner mode is a global minor mode that records the changes in the
+window configuration (i.e. how the frames are partitioned into
+windows), so that you can ``undo'' them. You can toggle Winner mode
+with @kbd{M-x winner-mode}, or by customizing the variable
+@code{winner-mode}. When the mode is enabled, @kbd{C-c left}
+(@code{winner-undo}) undoes the last window configuration change. If
+you change your mind while undoing, you can redo the changes you had
+undone using @kbd{C-c right} (@code{M-x winner-redo}).
+
+ Follow mode (@kbd{M-x follow-mode}) synchronizes several windows on
+the same buffer so that they always display adjacent sections of that
+buffer. @xref{Follow Mode}.
@cindex Windmove package
@cindex directional window selection
@findex windmove-right
@findex windmove-default-keybindings
- The Windmove commands move directionally between neighboring windows in
-a frame. @kbd{M-x windmove-right} selects the window immediately to the
-right of the currently selected one, and similarly for the ``left,'' ``up,''
-and ``down'' counterparts. @kbd{M-x windmove-default-keybindings} binds
-these commands to @kbd{S-right} etc. (Not all terminals support shifted
-arrow keys, however.)
+ The Windmove package defines commands for moving directionally
+between neighboring windows in a frame. @kbd{M-x windmove-right}
+selects the window immediately to the right of the currently selected
+one, and similarly for the ``left,'' ``up,'' and ``down''
+counterparts. @kbd{M-x windmove-default-keybindings} binds these
+commands to @kbd{S-right} etc.; doing so disables shift selection for
+those keys (@pxref{Shift Selection}).
- Follow minor mode (@kbd{M-x follow-mode}) synchronizes several
-windows on the same buffer so that they always display adjacent
-sections of that buffer. @xref{Follow Mode}.
+ The command @kbd{M-x compare-windows} lets you compare the text
+shown in different windows. @xref{Comparing Files}.
@vindex scroll-all-mode
@cindex scrolling windows together
@cindex Scroll-all mode
@cindex mode, Scroll-all
- @kbd{M-x scroll-all-mode} provides commands to scroll all visible
-windows together. You can also turn it on by customizing the variable
-@code{scroll-all-mode}. The commands provided are @kbd{M-x
-scroll-all-scroll-down-all}, @kbd{M-x scroll-all-page-down-all} and
-their corresponding ``up'' equivalents. To make this mode useful,
-you should bind these commands to appropriate keys.
+ Scroll All mode (@kbd{M-x scroll-all-mode}) is a global minor mode
+that causes scrolling commands and point motion commands to apply to
+every single window.
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 1e86e07998..1a692c6b36 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,19 @@
+2011-11-06 Chong Yidong <[email protected]>
+
+ * windows.texi (Basic Windows): Clarify various definitions.
+ Treat window-normalize-* as internal; don't document them.
+ (Windows and Frames): Various clarifications, e.g. non-live
+ windows also belong to frames. Fix window-list description.
+ Simplify window nesting example.
+ (Splitting Windows, Window Configurations): Use
+ split-window-below.
+
+2011-11-04 Eli Zaretskii <[email protected]>
+
+ * windows.texi (Window Sizes): Mention in the doc string that the
+ return values of `window-body-height' and `window-body-width' are
+ in frame's canonical units. (Bug#9949)
+
2011-10-30 Martin Rudalics <[email protected]>
* windows.texi (Windows and Frames): Remove "iso-" infix from
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 37679aa4a0..8b466e0221 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -50,216 +50,188 @@ is displayed in windows.
@section Basic Concepts of Emacs Windows
@cindex window
-A @dfn{window} in Emacs is the physical area of the screen in which a
-buffer is displayed, see @ref{Buffers}. The term is also used to refer
-to a Lisp object that represents that screen area in Emacs Lisp. It
-should be clear from the context which is meant.
+A @dfn{window} is a area of the screen which is used to display a
+buffer (@pxref{Buffers}). In Emacs Lisp, windows are represented by a
+special Lisp object type.
@cindex multiple windows
- Emacs groups windows into frames; see @ref{Frames}. Each frame always
-contains at least one window, but you can subdivide it into multiple,
-non-overlapping Emacs windows. Users create multiple windows so they
-can look at several buffers at once. Lisp libraries use multiple
-windows for a variety of reasons, but most often to display related
-information. In Rmail, for example, you can move through a summary
-buffer in one window while the other window shows messages one at a time
-as they are reached.
+ Windows are grouped into frames (@pxref{Frames}). Each frame
+contains at least one window; the user can subdivide it into multiple,
+non-overlapping windows to view several buffers at once. Lisp
+programs can use multiple windows for a variety of purposes. In
+Rmail, for example, you can view a summary of message titles in one
+window, and the contents of the selected message in another window.
@cindex terminal screen
@cindex screen of terminal
- The meaning of ``window'' in Emacs is similar to what it means in the
-context of general-purpose window systems such as X, but not identical.
-The X Window System places X windows on the screen; Emacs uses one or
-more X windows as frames, and subdivides them into Emacs windows. When
-you use Emacs on a character-only terminal, Emacs treats the whole
-terminal screen as one frame.
+ Emacs uses the word ``window'' with a different meaning than in
+graphical desktop environments and window systems, such as the X
+Window System. When Emacs is run on X, each of its graphical X
+windows is an Emacs frame (containing one or more Emacs windows).
+When Emacs is run on a text-only terminal, the frame fills the entire
+terminal screen.
@cindex tiled windows
- Most window systems support arbitrarily located overlapping windows.
-In contrast, Emacs windows are @dfn{tiled}; they never overlap, and
-together they fill the whole screen or frame. Because of the way in
-which Emacs creates new windows (@pxref{Splitting Windows}) and resizes
-them (@pxref{Resizing Windows}), not all conceivable tilings of windows
-on an Emacs frame are actually possible.
-
- For practical purposes, a window exists only while it is displayed in
-a frame. Once removed from the frame, the window is effectively deleted
-and should not be used, even though the Lisp object representing it
-might be still referenced from other Lisp objects; see @ref{Deleting
-Windows}. Restoring a saved window configuration is the only way for a
-window no longer on the screen to come back to life; see @ref{Window
-Configurations}.
-
-@defun windowp object
-This function returns @code{t} if @var{object} is a window, @code{nil}
-otherwise. It can return @code{t} if @var{object} denotes a window that
-has been deleted.
-@end defun
+ Unlike X windows, Emacs windows are @dfn{tiled}; they never overlap
+within the area of the frame. When a window is created, resized, or
+deleted, the change in window space is taken from or given to the
+adjacent windows, so that the total area of the frame is unchanged.
@cindex live windows
@cindex internal windows
- For historical reasons a window is considered @dfn{live} if and only
-if it currently displays a buffer; see @ref{Buffers and Windows}. In
-order to show multiple windows within one and the same frame, Emacs
-organizes them in form of a tree called window tree; see @ref{Windows
-and Frames}. The internal nodes of a window tree are called internal
-windows and are not considered live. The leaf nodes of a window tree
-constitute the windows displaying buffers and only they will be called
-live here.
+ A @dfn{live window} is one that is actually displaying a buffer in a
+frame. Such a window can be @dfn{deleted}, i.e. removed from the
+frame (@pxref{Deleting Windows}); then it is no longer live, but the
+Lisp object representing it might be still referenced from other Lisp
+objects. A deleted window may be brought back to life by restoring a
+saved window configuration (@pxref{Window Configurations}).
+
+@defun windowp object
+This function returns @code{t} if @var{object} is a window (whether or
+not it is live). Otherwise, it returns @code{nil}.
+@end defun
@defun window-live-p object
This function returns @code{t} if @var{object} is a live window and
-@code{nil} otherwise. A live window is a window that displays a buffer.
+@code{nil} otherwise. A live window is one that displays a buffer.
@end defun
-@defun window-any-p object
-This function returns @code{t} if @var{object} denotes a live or an
-internal window and @code{nil} otherwise. In particular, this function
-returns @code{nil} if @var{object} is a window that has been
-deleted.
+ The windows in each frame are organized into a @dfn{window tree}.
+@xref{Windows and Frames}. The leaf nodes of each window tree are
+live windows---the ones actually displaying buffers. The internal
+nodes of the window tree are internal windows, which are not live.
+You can distinguish internal windows from deleted windows with
+@code{window-valid-p}.
+
+@defun window-valid-p object
+This function returns @code{t} if @var{object} is a live window, or an
+internal window in a window tree. Otherwise, it returns @code{nil},
+including for the case where @var{object} is a deleted window.
@end defun
@cindex selected window
-In each frame, at any time, one and only one window is designated as
-@dfn{selected within the frame}. Also, at any time, one frame is the
-selected frame (@pxref{Input Focus}). The window selected within the
-selected frame is the @dfn{selected window}.
-
- The selected window is always a live window. Its buffer is usually
-the current buffer (except when @code{set-buffer} has been used); see
-@ref{Current Buffer}.
+ In each frame, at any time, exactly one Emacs window is designated
+as @dfn{selected within the frame}. For the selected frame, that
+window is called the @dfn{selected window}---the one in which most
+editing takes place, and in which the cursor for selected windows
+appears (@pxref{Cursor Parameters}). The selected window's buffer is
+usually also the current buffer, except when @code{set-buffer} has
+been used (@pxref{Current Buffer}). As for non-selected frames, the
+window selected within the frame becomes the selected window if the
+frame is ever selected. @xref{Selecting Windows}.
@defun selected-window
-This function returns the selected window. This is the window in which
-the cursor for selected windows (@pxref{Cursor Parameters}) appears and
-to which many commands apply.
-@end defun
-
-The window handling functions can be roughly grouped into functions
-operating on live windows only and functions that accept any window as
-argument. Many of these functions accept as argument the value
-@code{nil} to specify the selected window. The two functions below can
-be used to ``normalize'' arguments specifying windows in a uniform
-manner.
-
-@defun window-normalize-any-window window
-This function returns the normalized value for @var{window} which can be
-any window that has not been deleted. More precisely, if @var{window}
-is @code{nil}, it returns the selected window. If @var{window} denotes
-a live or internal window, it returns that window. Otherwise, this
-function signals an error.
-@end defun
-
-@defun window-normalize-live-window window
-This functions returns the normalized value for a live window
-@var{window}. More precisely, if @var{window} is @code{nil}, it returns
-the selected window. If @var{window} is a live window, it returns that
-window. Otherwise, this function signals an error.
+This function returns the selected window (which is always a live
+window).
@end defun
-
@node Windows and Frames
@section Windows and Frames
-Each window is part of one and only one frame (@pxref{Frames}); you can
-get that frame with the function described next.
+Each window belongs to exactly one frame (@pxref{Frames}).
@defun window-frame window
-This function returns the frame that @var{window} is on. The argument
-@var{window} can be any window and defaults to the selected one.
+This function returns the frame that the window @var{window} belongs
+to. If @var{window} is @code{nil}, it defaults to the selected
+window.
@end defun
-The following function returns a list of all live windows on a specific
-frame.
+@defun window-list &optional frame minibuffer window
+This function returns a list of live windows belonging to the frame
+@var{frame}. If @var{frame} is omitted or @code{nil}, it defaults to
+the selected frame.
-@defun window-list &optional frame minibuf window
-This function returns a list of @var{frame}'s live windows, starting
-with @var{window}. The optional argument @var{frame} has to denote a
-live frame and defaults to the selected frame. The optional argument
-@var{window} has to denote a live window on the frame specified by
-@var{frame} and defaults to the selected one.
+The optional argument @var{minibuffer} specifies whether to include
+the minibuffer window in the returned list. If @var{minibuffer} is
+@code{t}, the minibuffer window is included. If @var{minibuffer} is
+@code{nil} or omitted, the minibuffer window is included only if it is
+active. If @var{minibuffer} is neither @code{nil} nor @code{t}, the
+minibuffer window is never included.
-The argument @var{minibuf} specifies if the minibuffer window shall be
-included in the return value. If @var{minibuf} is @code{t}, the result
-always includes the minibuffer window. If @var{minibuf} is @code{nil}
-or omitted, that includes the minibuffer window only if it is active.
-If @var{minibuf} is neither @code{nil} nor @code{t}, the result never
-includes the minibuffer window.
+The optional argument @var{window}, if non-@code{nil}, should be a
+live window on the specified frame; then @var{window} will be the
+first element in the returned list. If @var{window} is omitted or
+@code{nil}, the window selected within the frame is first element.
@end defun
@cindex window tree
-Windows within one and the same frame are organized in form of a tree
-called @dfn{window tree}. The leaf nodes of a window tree constitute
-the windows visible to the user. These are the windows associated with
-buffers and are usually called live windows. The internal nodes of a
-window tree are needed for finding, traversing and displaying the live
-windows.
-
- A minibuffer window (@pxref{Minibuffer Windows}) is not considered
-part of its frame's window tree unless the frame is a minibuffer-only
-frame. Most functions covered in this section accept, however, the
-minibuffer window as argument. Also, the minibuffer window is listed by
-the function @code{window-tree} described at the end of this section.
-
- A window tree is rooted at the root window of its frame.
+@cindex root window
+ Windows in the same frame are organized into a @dfn{window tree},
+whose leaf nodes are the live windows. The internal nodes of a window
+tree are not live; they exist for the purpose of organizing the
+relationships between live windows. The root node of a window tree is
+called the @dfn{root window}. It can be either a live window (if the
+frame has just one window), or an internal window.
+
+ A minibuffer window (@pxref{Minibuffer Windows}) is not part of its
+frame's window tree unless the frame is a minibuffer-only frame.
+Nonetheless, most of the functions in this section accept the
+minibuffer window as an argument. Also, the function
+@code{window-tree} described at the end of this section lists the
+minibuffer window alongside the actual window tree.
@defun frame-root-window &optional frame-or-window
-This function returns the root window of @var{frame-or-window}. The
-argument @var{frame-or-window} has to denote either a window or a frame
-and defaults to the selected frame. If @var{frame-or-window} denotes a
-window, the return value is the root window of that window's frame.
-This function always returns a window; a live window if the frame
-specified by @var{frame-or-window} contains no other live windows and an
-internal window otherwise.
+This function returns the root window for @var{frame-or-window}. The
+argument @var{frame-or-window} should be either a window or a frame;
+if omitted or @code{nil}, it defaults to the selected frame. If
+@var{frame-or-window} is a window, the return value is the root window
+of that window's frame.
@end defun
-@cindex subwindow
-All other windows of a frame with the exception of the minibuffer window
-are subwindows of the frame's root window. A window is considered a
-@dfn{subwindow} of another window if it occupies a part of that other
-window's screen area.
-
-The functions described next allow to access the members of a window
-tree and take an arbitrary window as argument.
+@cindex parent window
+@cindex child window
+@cindex sibling window
+ When a window is split, there are two live windows where previously
+there was one. One of these is represented by the same Lisp window
+object as the original window, and the other is represented by a
+newly-created Lisp window object. Both of these live windows become
+leaf nodes of the window tree, as @dfn{child windows} of a single
+internal window. If necessary, Emacs automatically creates this
+internal window, which is also called the @dfn{parent window}, and
+assigns it to the appropriate position in the window tree. A set of
+windows that share the same parent are called @dfn{siblings}.
@cindex parent window
@defun window-parent &optional window
-Return @var{window}'s parent in the window tree. The optional argument
-@var{window} can denote an arbitrary window and defaults to the selected
-one. The return value is @code{nil} if @var{window} is a minibuffer
-window or the root window of its frame and an internal window otherwise.
+This function returns the parent window of @var{window}. If
+@var{window} is omitted or @code{nil}, it defaults to the selected
+window. The return value is @code{nil} if @var{window} has no parent
+(i.e. it is a minibuffer window or the root window of its frame).
@end defun
-@cindex child window
- Parent windows do not appear on the screen. The screen area of a
-parent window is the rectangular part of the window's frame occupied by
-the window's @dfn{child windows}, that is, the set of windows having
-that window as their parent. Each parent window has at least two child
-windows, so there are no ``Matryoshka'' windows. Minibuffer windows do
-not have child windows.
+ Each internal window always has at least two child windows. If this
+number falls to one as a result of window deletion, Emacs
+automatically deletes the internal window, and its sole remaining
+child window takes its place in the window tree.
+
+ Each child window can be either a live window, or an internal window
+(which in turn would have its own child windows). Therefore, each
+internal window can be thought of as occupying a certain rectangular
+@dfn{screen area}---the union of the areas occupied by the live
+windows that are ultimately descended from it.
@cindex window combination
@cindex vertical combination
@cindex horizontal combination
-The children of any parent window form either a vertical or a horizontal
-combination of windows. A @dfn{vertical combination} is a set of
-windows arranged one above each other. A @dfn{horizontal combination}
-is a set of windows arranged side by side. Consider the frame shown
-below (for simplicity we assume that the frame does not contain a
-minibuffer window):
+ For each internal window, the screen areas of the immediate children
+are arranged either vertically or horizontally (never both). If the
+child windows are arranged one above the other, they are said to form
+a @dfn{vertical combination}; if they are arranged side by side, they
+are said to form a @dfn{horizontal combination}. Consider the
+following example:
@smallexample
@group
______________________________________
| ______ ____________________________ |
|| || __________________________ ||
- || ||| ___________ ___________ |||
- || |||| || ||||
- || |||| || ||||
- || ||||_____W6____||_____W7____||||
+ || ||| |||
+ || ||| |||
+ || ||| |||
|| |||____________W4____________|||
|| || __________________________ ||
|| ||| |||
+ || ||| |||
|| |||____________W5____________|||
||__W2__||_____________W3_____________ |
|__________________W1__________________|
@@ -267,91 +239,70 @@ minibuffer window):
@end group
@end smallexample
-The root window of the frame is @code{W1}---a horizontal combination of
-the live window @code{W2} and the internal window @code{W3}. Hence
-@code{(window-parent W1)} is @code{nil} while @code{(window-parent W2)}
-and @code{(window-parent W3)} are both @code{W1}.
-
- The internal window @code{W3} is a vertical combination of @code{W4}
-and the live window @code{W5}. The internal window @code{W4} is a
-horizontal combination of the live windows @code{W6} and @code{W7}. The
-windows you can actually see on the screen are @code{W2}, @code{W5},
-@code{W6} and @code{W7}.
-
- For any parent window, the first child window can be retrieved by the
-functions given next.
-
-@defun window-top-child &optional window
-This function returns @var{window}'s first vertical child window. The
-optional argument @var{window} can be an arbitrary window and defaults
-to the selected one. The return value is @code{nil} if @var{window} is
-a live window or its children form a horizontal combination. In the
-example above @code{(window-top-child W3)} is @code{W4} while
-@code{(window-top-child W4)} is @code{nil}.
+@noindent
+The root window of this frame is an internal window, @code{W1}. Its
+child windows form a horizontal combination, consisting of the live
+window @code{W2} and the internal window @code{W3}. The child windows
+of @code{W3} form a vertical combination, consisting of the live
+windows @code{W4} and @code{W5}. Hence, the live windows in this
+window tree are @code{W2} @code{W4}, and @code{W5}.
+
+ The following functions can be used to retrieve a child window of an
+internal window, and the siblings of a child window.
+
+@defun window-top-child window
+This function returns the topmost child window of @var{window}, if
+@var{window} is an internal window whose children form a vertical
+combination. For any other type of window, the return value is
+@code{nil}.
@end defun
-@defun window-left-child &optional window
-This function returns @var{window}'s first horizontal child window. The
-optional argument @var{window} can be an arbitrary window and defaults
-to the selected one. The return value is @code{nil} if @var{window} is
-a live window or its children form a vertical combination. In the
-example above @code{(window-left-child W4)} is @code{W6} while
-@code{(window-left-child W3)} is @code{nil}.
+@defun window-left-child window
+This function returns the leftmost child window of @var{window}, if
+@var{window} is an internal window whose children form a horizontal
+combination. For any other type of window, the return value is
+@code{nil}.
@end defun
@defun window-child window
-This function return @var{window}'s first child window. The return
-value is @code{nil} if @var{window} is a live window. In the example
-above @code{(window-child W3)} is @code{W4} while @code{(window-child
-W4)} is @code{W6}.
+This function returns the first child window of the internal window
+@var{window}---the topmost child window for a vertical combination, or
+the leftmost child window for a horizontal combination. If
+@var{window} is a live window, the return value is @code{nil}.
@end defun
-The following function is useful to determine whether a window is part
-of a vertical or horizontal combination.
-
@defun window-combined-p &optional window horizontal
-This function returns non-@code{nil} if and only if @var{window} is
-vertically combined. The argument @var{window} can specify any window
-and defaults to the selected one. The actual return value is the first
-vertical child of window.
+This function returns a non-@code{nil} value if and only if
+@var{window} is part of a vertical combination. If @var{window} is
+omitted or nil, it defaults to the selected one.
-If the optional argument @var{horizontal} is non-@code{nil}, this means
-to return non-@code{nil} if and only if @var{window} is horizontally
-combined. In this case, the return value is the first horizontal child
-of window.
+If the optional argument @var{horizontal} is non-@code{nil}, this
+means to return non-@code{nil} if and only if @var{window} is part of
+a horizontal combination.
@end defun
-@cindex sibling window
-For any window that is part of a combination, the other windows in that
-combination are called the window's @dfn{siblings}. The only windows
-that do not have siblings are root windows of frames and minibuffer
-windows. A window's siblings can be retrieved with the following two
-functions.
-
@defun window-next-sibling &optional window
-This function returns @var{window}'s next sibling. The optional
-argument @var{window} can be an arbitrary window and defaults to the
-selected window. It returns @code{nil} if @var{window} is the last
-child of its parent. In our example @code{(window-next-sibling W2)} is
-@code{W3} while @code{(window-next-sibling W3)} is @code{nil}.
+This function returns the next sibling of the window @var{window}. If
+omitted or @code{nil}, @var{window} defaults to the selected window.
+The return value is @code{nil} if @var{window} is the last child of
+its parent.
@end defun
@defun window-prev-sibling &optional window
-This function returns @var{window}'s previous sibling. The optional
-argument @var{window} can be an arbitrary window and defaults to the
-selected window. It returns @code{nil} if @var{window} is the first
-child of its parent. In our example @code{(window-prev-sibling W3)} is
-@code{W2} and @code{(window-prev-sibling W2)} is @code{nil}.
+This function returns the previous sibling of the window @var{window}.
+If omitted or @code{nil}, @var{window} defaults to the selected
+window. The return value is @code{nil} if @var{window} is the first
+child of its parent.
@end defun
-The functions @code{window-next-sibling} and @code{window-prev-sibling}
-should not be confused with the functions @code{next-window} and
-@code{previous-window} which respectively return the next and previous
-window in the cyclic ordering of windows, see @ref{Cyclic Window
-Ordering}.
+The functions @code{window-next-sibling} and
+@code{window-prev-sibling} should not be confused with the functions
+@code{next-window} and @code{previous-window} which respectively
+return the next and previous window in the cyclic ordering of windows
+(@pxref{Cyclic Window Ordering}).
- In order to find the first live window on a frame, the following
-function can be used.
+ You can use the following functions to find the first live window on
+a frame, and to retrieve the entire window tree of a frame:
@defun frame-first-window &optional frame-or-window
This 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
@code{(frame-first-window)} returns @code{W2}.
@end defun
-You can get the window tree of a frame with the following function.
-
-@cindex window tree
@defun window-tree &optional frame
-This function returns the window tree for frame @var{frame}. The
-optional argument @var{frame} must be a live frame and defaults to the
-selected one.
+This function returns a list representing the window tree for frame
+@var{frame}. If @var{frame} is omitted or @code{nil}, it defaults to
+the selected frame.
The return value is a list of the form @code{(@var{root} @var{mini})},
-where @var{root} represents the window tree of the frame's
-root window, and @var{mini} is the frame's minibuffer window.
+where @var{root} represents the window tree of the frame's root
+window, and @var{mini} is the frame's minibuffer window.
-If the root window is live, @var{root} specifies the root window and
-nothing else. Otherwise, @var{root} is a list @code{(@var{dir}
-@var{edges} @var{w1} @var{w2} ...)} where @var{dir} is @code{nil} for a
-horizontal combination, and @code{t} for a vertical combination,
-@var{edges} gives the size and position of the combination, and the
-remaining elements are the child windows. Each child window may again
-be a live window or a list representing a window combination, and so on.
-The @var{edges} element is a list @code{(@var{left}@var{ top}@var{
-right}@var{ bottom})} similar to the value returned by
-@code{window-edges}, see @ref{Coordinates and Windows}.
+If the root window is live, @var{root} is that window itself.
+Otherwise, @var{root} is a list @code{(@var{dir} @var{edges} @var{w1}
+@var{w2} ...)} where @var{dir} is @code{nil} for a horizontal
+combination and @code{t} for a vertical combination, @var{edges} gives
+the size and position of the combination, and the remaining elements
+are the child windows. Each child window may again be a window object
+(for a live window) or a list with the same format as above (for an
+internal window). The @var{edges} element is a list @code{(@var{left}
+@var{top} @var{right} @var{bottom})}, similar to the value returned by
+@code{window-edges} (@pxref{Coordinates and Windows}).
@end defun
-
@node Window Sizes
@section Window Sizes
@cindex window size
@@ -563,8 +510,18 @@ window's body width.
@cindex body size of a window
@cindex window body size
-The following functions retrieve height and width of the body of a live
-window:
+@cindex canonical units of window/frame size
+The following functions retrieve height and width of the body of a
+live window. Note that the values these functions return are measured
+in @dfn{canonical units}, i.e.@: for the default frame's face. If the
+window shows some characters with non-default face, e.g., if the font
+of some characters is larger or smaller than the default font, the
+values returned by these functions will not match the actual number of
+lines or characters per line shown in the window. To get the actual
+number of columns and lines, move to the last character in the line
+(e.g., with @code{end-of-visual-line}) or to the last line of the
+window (e.g., with @code{window-end}), and use @code{posn-at-point} to
+find the line or column there.
@defun window-body-size &optional window horizontal
This function returns the number of lines of @var{window}'s text area.
@@ -1556,7 +1513,7 @@ configuration.
For interactive use, Emacs provides two commands which always split the
selected window.
-@deffn Command split-window-above-each-other &optional size
+@deffn Command split-window-below &optional size
This function splits the selected window into two windows, one above the
other, leaving the upper of the two windows selected, with @var{size}
lines. (If @var{size} is negative, then the lower of the two windows
@@ -1572,16 +1529,16 @@ is the new, lower window.
@defopt split-window-keep-point
If this variable is non-@code{nil} (the default), then
-@code{split-window-above-each-other} behaves as described above.
+@code{split-window-below} behaves as described above.
- If it is @code{nil}, then @code{split-window-above-each-other}
-adjusts point in each of the two windows to avoid scrolling. (This is
-useful on slow terminals.) It selects whichever window contains the
-screen line that point was previously on. Other functions are not
-affected by this variable.
+ If it is @code{nil}, then @code{split-window-below} adjusts point
+in each of the two windows to avoid scrolling. (This is useful on
+slow terminals.) It selects whichever window contains the screen line
+that point was previously on. Other functions are not affected by
+this variable.
@end defopt
-@deffn Command split-window-side-by-side &optional size
+@deffn Command split-window-right &optional size
This function splits the selected window into two windows
side-by-side, leaving the selected window on the left with @var{size}
columns. If @var{size} is negative, the rightmost window gets
@@ -3679,7 +3636,7 @@ as @code{save-window-excursion}:
@group
(let ((config (current-window-configuration)))
(unwind-protect
- (progn (split-window-vertically nil)
+ (progn (split-window-below nil)
@dots{})
(set-window-configuration config)))
@end group
diff --git a/etc/NEWS b/etc/NEWS
index bd2f6004d3..5e7e6cbb47 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1033,33 +1033,31 @@ directionality are not known in advance, without disrupting the layout
of the line.
** Window changes
-
+++
*** Window tree functions are accessible in Elisp.
Functions are provided to return the parent, siblings or child windows
of any window including internal windows (windows not associated with a
buffer) in the window tree.
-
+++
-*** Window manipulation can deal with internal windows.
+**** New function `window-valid-p' gives non-nil for live and internal
+windows.
++++
+**** Window manipulation can deal with internal windows.
Many window handling functions like `split-window', `delete-window', or
`delete-other-windows' as well as the window resizing functions can now
act on any window including internal ones.
-
+++
*** window-total-height/-width vs window-body-height/-width.
The function `window-height' has been renamed to `window-total-height'
and `window-width' has been renamed to `window-body-width'. The old
names are provided as aliases. Two new functions `window-total-width'
and `window-body-height' are provided.
-
+++
*** Window parameters specific to window handling functions.
For each window you can specify a parameter to override the default
behavior of a number of functions like `split-window', `delete-window'
and `delete-other-windows'. The variable `ignore-window-parameters'
allows to ignore processing such parameters.
-
+++
*** New semantics of third argument of `split-window'.
The 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
new window appear on the corresponding side of the window that shall be
split. Any other value of SIDE will cause `split-window' to split the
window into two side-by-side windows as before.
-
+++
*** Window resizing functions.
A new standard function for resizing windows called `window-resize' has
been introduced. This and all other functions for resizing windows no
longer delete any windows when they become too small.
-
+++
*** Deleting the selected window now selects the most recently selected
live window on that frame instead.
-
+++
*** `adjust-window-trailing-edge' adjustments.
`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
edge cannot be shrunk any more. This makes its behavior more similar to
that of Emacs 21 without compromising, however, its inability to delete
windows which was introduced in Emacs 22.
-
+++
*** Window-local buffer lists.
Windows 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
shown in that window with its previous window-start and window-point
positions. This also means that the same buffer may be automatically
shown twice even if it already appears in another window.
-
+++
*** `switch-to-buffer' has a new optional argument FORCE-SAME-WINDOW,
which if non-nil requires the buffer to be displayed in the currently
selected window, signaling an error otherwise. If nil, another window
can be used, e.g. if the selected one is strongly dedicated.
-
++++
*** `split-window-vertically' and `split-window-horizontally' renamed
to `split-window-below' and `split-window-right' respectively.
The old names are kept as aliases.
-
++++
*** Display actions
**** 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
STARTTLS opportunistically or use plain SSL, depending on your needs.
Only versions 2.8.x and higher or GnuTLS have been tested.
+[FIXME: this statement needs clarifying, given that GnuTLS >= 2.6.6
+is the test used by configure.]
*** gnutls-log-level
Set `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 6b451dd14e..d530425887 100644
--- a/lib/makefile.w32-in
+++ b/lib/makefile.w32-in
@@ -50,7 +50,9 @@ all: stamp_BLD $(ALL)
### TAGS ###
-TAGS:
+FRC:
+
+TAGS: FRC
../lib-src/$(BLD)/etags.exe *.c *.h
### DEPENDENCIES ###
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6352a65e4f..6cc9cc8651 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,43 @@
+2011-11-06 Chong Yidong <[email protected]>
+
+ * window.el (window-combination-p): Function deleted; its
+ side-effect is not used in any existing code.
+ (window-combinations, window-combined-p): Call window-*-child
+ directly.
+
+2011-11-05 Chong Yidong <[email protected]>
+
+ * window.el (window-valid-p): Rename from window-any-p.
+ (window-size-ignore, window-state-get): Callers changed.
+ (window-normalize-window): Rename from window-normalize-any-window.
+ New arg LIVE-ONLY, replacing window-normalize-live-window.
+ (window-normalize-live-window): Deleted.
+ (window-combination-p, window-combined-p, window-combinations)
+ (walk-window-subtree, window-atom-root, window-min-size)
+ (window-sizable, window-sizable-p, window-size-fixed-p)
+ (window-min-delta, window-max-delta, window-resizable)
+ (window-resizable-p, window-full-height-p, window-full-width-p)
+ (window-current-scroll-bars, window-point-1, set-window-point-1)
+ (window-at-side-p, window-in-direction, window-resize)
+ (adjust-window-trailing-edge, maximize-window, minimize-window)
+ (window-deletable-p, delete-window, delete-other-windows)
+ (record-window-buffer, unrecord-window-buffer)
+ (switch-to-prev-buffer, switch-to-next-buffer, window--delete)
+ (quit-window, split-window, window-state-put)
+ (set-window-text-height, fit-window-to-buffer)
+ (shrink-window-if-larger-than-buffer): Callers changed.
+
+2011-11-04 Eli Zaretskii <[email protected]>
+
+ * mail/rmail.el (rmail-simplified-subject): Decode subject with
+ rfc2047-decode-string.
+ (rmail-mime-toggle-hidden): Declare to avoid byte-compilation
+ warnings.
+
+ * window.el (window-body-height, window-body-width): Mention in
+ the doc string that the return values are in frame's canonical
+ units. (Bug#9949)
+
2011-11-03 Alan Mackenzie <[email protected]>
* progmodes/cc-langs.el (c-nonlabel-token-2-key): New variable for
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 603a615192..a535d3a86d 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -194,6 +194,7 @@ please report it with \\[report-emacs-bug].")
(declare-function mail-dont-reply-to "mail-utils" (destinations))
(declare-function rmail-update-summary "rmailsum" (&rest ignore))
+(declare-function rmail-mime-toggle-hidden "rmailmm" ())
(defun rmail-probe (prog)
"Determine what flavor of movemail PROG is.
@@ -3262,6 +3263,7 @@ Interactively, empty argument means use same regexp used last time."
Simplifying the subject means stripping leading and trailing whitespace,
and typical reply prefixes such as Re:."
(let ((subject (or (rmail-get-header "Subject" msgnum) "")))
+ (setq subject (rfc2047-decode-string subject))
(if (string-match "\\`[ \t]+" subject)
(setq subject (substring subject (match-end 0))))
(if (string-match rmail-reply-regexp subject)
diff --git a/lisp/window.el b/lisp/window.el
index 9b12c204d4..1b51bde36b 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -100,8 +100,10 @@ be any window."
(setq window (window-next-sibling window))))
window)
-(defsubst window-any-p (object)
- "Return t if OBJECT denotes a live or internal window."
+(defsubst window-valid-p (object)
+ "Return t if OBJECT denotes a live window or internal window.
+Otherwise, return nil; this includes the case where OBJECT is a
+deleted window."
(and (windowp object)
(or (window-buffer object) (window-child object))
t))
@@ -130,24 +132,21 @@ FRAME must be a live frame and defaults to the selected frame."
(error "%s is not a live frame" frame))
(selected-frame)))
-(defsubst window-normalize-any-window (window)
+(defsubst window-normalize-window (window &optional live-only)
"Return window specified by WINDOW.
-WINDOW must be a window that has not been deleted and defaults to
-the selected window."
- (if window
- (if (window-any-p window)
- window
- (error "%s is not a window" window))
- (selected-window)))
-
-(defsubst window-normalize-live-window (window)
- "Return live window specified by WINDOW.
-WINDOW must be a live window and defaults to the selected one."
- (if window
- (if (and (windowp window) (window-buffer window))
- window
- (error "%s is not a live window" window))
- (selected-window)))
+If WINDOW is nil, return `selected-window'.
+If WINDOW is a live window or internal window, return WINDOW;
+ if LIVE-ONLY is non-nil, return WINDOW for a live window only.
+Otherwise, signal an error."
+ (cond ((null window)
+ (selected-window))
+ (live-only
+ (if (window-live-p window)
+ window
+ (error "%s is not a live window" window)))
+ ((if (window-valid-p window)
+ window
+ (error "%s is not a window" window)))))
(defvar ignore-window-parameters nil
"If non-nil, standard functions ignore window parameters.
@@ -196,36 +195,35 @@ narrower, explictly specify the SIZE argument of that function."
:version "24.1"
:group 'windows)
-(defun window-combination-p (&optional window horizontal)
- "If WINDOW is a vertical combination return WINDOW's first child.
-WINDOW can be any window and defaults to the selected one.
-Optional argument HORIZONTAL non-nil means return WINDOW's first
-child if WINDOW is a horizontal combination."
- (setq window (window-normalize-any-window window))
- (if horizontal
- (window-left-child window)
- (window-top-child window)))
-
(defsubst window-combined-p (&optional window horizontal)
- "Return non-nil if and only if WINDOW is vertically combined.
-WINDOW can be any window and defaults to the selected one.
-Optional argument HORIZONTAL non-nil means return non-nil if and
-only if WINDOW is horizontally combined."
- (setq window (window-normalize-any-window window))
+ "Return non-nil if WINDOW has siblings in a given direction.
+If WINDOW is omitted or nil, it defaults to the selected window.
+
+HORIZONTAL determines a direction for the window combination.
+If HORIZONTAL is omitted or nil, return non-nil if WINDOW is part
+of a vertical window combination.
+If HORIZONTAL is non-nil, return non-nil if WINDOW is part of a
+horizontal window combination."
+ (setq window (window-normalize-window window))
(let ((parent (window-parent window)))
- (and parent (window-combination-p parent horizontal))))
+ (and parent
+ (if horizontal
+ (window-left-child parent)
+ (window-top-child parent)))))
(defun window-combinations (&optional window horizontal)
"Return largest number of vertically arranged subwindows of WINDOW.
-WINDOW can be any window and defaults to the selected one.
-Optional argument HORIZONTAL non-nil means to return the largest
-number of horizontally arranged subwindows of WINDOW."
- (setq window (window-normalize-any-window window))
+If WINDOW is omitted or nil, it defaults to the selected window.
+If HORIZONTAL is non-nil, return the largest number of
+horizontally arranged subwindows of WINDOW."
+ (setq window (window-normalize-window window))
(cond
((window-live-p window)
;; If WINDOW is live, return 1.
1)
- ((window-combination-p window horizontal)
+ ((if horizontal
+ (window-left-child window)
+ (window-top-child window))
;; If WINDOW is iso-combined, return the sum of the values for all
;; subwindows of WINDOW.
(let ((child (window-child window))
@@ -289,7 +287,7 @@ on all live and internal subwindows of WINDOW.
This function performs a pre-order, depth-first traversal of the
window tree rooted at WINDOW. If PROC changes that window tree,
the result is unpredictable."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(walk-window-tree-1 proc window any t))
(defun windows-with-parameter (parameter &optional value frame any values)
@@ -335,7 +333,7 @@ too."
"Return root of atomic window WINDOW is a part of.
WINDOW can be any window and defaults to the selected one.
Return nil if WINDOW is not part of a atomic window."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let (root)
(while (and window (window-parameter window 'window-atom))
(setq root window)
@@ -532,7 +530,7 @@ window).")
(defsubst window-size-ignore (window ignore)
"Return non-nil if IGNORE says to ignore size restrictions for WINDOW."
- (if (window-any-p ignore) (eq window ignore) ignore))
+ (if (window-valid-p ignore) (eq window ignore) ignore))
(defun window-min-size (&optional window horizontal ignore)
"Return the minimum number of lines of WINDOW.
@@ -547,7 +545,7 @@ windows may get as small as `window-safe-min-height' lines and
`window-safe-min-width' columns. IGNORE a window means ignore
restrictions for that window only."
(window-min-size-1
- (window-normalize-any-window window) horizontal ignore))
+ (window-normalize-window window) horizontal ignore))
(defun window-min-size-1 (window horizontal ignore)
"Internal function of `window-min-size'."
@@ -640,7 +638,7 @@ imposed by fixed size windows, `window-min-height' or
windows may get as small as `window-safe-min-height' lines and
`window-safe-min-width' columns. IGNORE any window means ignore
restrictions for that window only."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(cond
((< delta 0)
(max (- (window-min-size window horizontal ignore)
@@ -658,7 +656,7 @@ restrictions for that window only."
"Return t if WINDOW can be resized by DELTA lines.
For the meaning of the arguments of this function see the
doc-string of `window-sizable'."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(if (> delta 0)
(>= (window-sizable window delta horizontal ignore) delta)
(<= (window-sizable window delta horizontal ignore) delta)))
@@ -706,7 +704,7 @@ If this function returns nil, this does not necessarily mean that
WINDOW can be resized in the desired direction. The functions
`window-resizable' and `window-resizable-p' will tell that."
(window-size-fixed-1
- (window-normalize-any-window window) horizontal))
+ (window-normalize-window window) horizontal))
(defun window-min-delta-1 (window delta &optional horizontal ignore trail noup)
"Internal function for `window-min-delta'."
@@ -772,7 +770,7 @@ tree but try to enlarge windows within WINDOW's combination only.
Optional argument NODOWN non-nil means don't check whether WINDOW
itself \(and its subwindows) can be shrunk; check only whether at
least one other windows can be enlarged appropriately."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let ((size (window-total-size window horizontal))
(minimum (window-min-size window horizontal ignore)))
(cond
@@ -854,7 +852,7 @@ WINDOW's combination.
Optional argument NODOWN non-nil means do not check whether
WINDOW itself \(and its subwindows) can be enlarged; check only
whether other windows can be shrunk appropriately."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(if (and (not (window-size-ignore window ignore))
(not nodown) (window-size-fixed-p window horizontal))
;; With IGNORE and NOWDON nil return zero if WINDOW has fixed
@@ -898,7 +896,7 @@ within WINDOW's combination.
Optional argument NODOWN non-nil means don't check whether WINDOW
and its subwindows can be resized."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(cond
((< delta 0)
(max (- (window-min-delta window horizontal ignore trail noup nodown))
@@ -912,7 +910,7 @@ and its subwindows can be resized."
"Return t if WINDOW can be resized vertically by DELTA lines.
For the meaning of the arguments of this function see the
doc-string of `window-resizable'."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(if (> delta 0)
(>= (window-resizable window delta horizontal ignore trail noup nodown)
delta)
@@ -941,7 +939,7 @@ More precisely, return t if and only if the total height of
WINDOW equals the total height of the root window of WINDOW's
frame. WINDOW can be any window and defaults to the selected
one."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(= (window-total-size window)
(window-total-size (frame-root-window window))))
@@ -960,7 +958,7 @@ otherwise."
More precisely, return t if and only if the total width of WINDOW
equals the total width of the root window of WINDOW's frame.
WINDOW can be any window and defaults to the selected one."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(= (window-total-size window t)
(window-total-size (frame-root-window window) t)))
@@ -972,7 +970,14 @@ The return value does not include WINDOW's mode line and header
line, if any. If a line at the bottom of the window is only
partially visible, that line is included in the return value. If
you do not want to include a partially visible bottom line in the
-return value, use `window-text-height' instead."
+return value, use `window-text-height' instead.
+
+Note that the return value is measured in canonical units, i.e. for
+the default frame's face. If the window shows some characters with
+non-default face, e.g., if the font of some characters is larger or
+smaller than the default font, the value returned by this function
+will not match the actual number of lines shown in the window. To
+get the actual number of lines, use `posn-at-point'."
(window-body-size window))
(defsubst window-body-width (&optional window)
@@ -982,7 +987,14 @@ WINDOW must be a live window and defaults to the selected one.
The return value does not include any vertical dividers or scroll
bars owned by WINDOW. On a window-system the return value does
not include the number of columns used for WINDOW's fringes or
-display margins either."
+display margins either.
+
+Note that the return value is measured in canonical units, i.e. for
+the default frame's face. If the window shows some characters with
+non-default face, e.g., if the font of some characters is larger or
+smaller than the default font, the value returned by this function
+will not match the actual number of characters per line shown in the
+window. To get the actual number of columns, use `posn-at-point'."
(window-body-size window t))
;; Eventually we should make `window-height' obsolete.
@@ -1001,7 +1013,7 @@ or nil).
Unlike `window-scroll-bars', this function reports the scroll bar
type actually used, once frame defaults and `scroll-bar-mode' are
taken into account."
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(let ((vert (nth 2 (window-scroll-bars window)))
(hor nil))
(when (or (eq vert t) (eq hor t))
@@ -1065,7 +1077,7 @@ WINDOW can be any live window and defaults to the selected one.
This function is like `window-point' with one exception: If
WINDOW is selected, it returns the value of `point' of WINDOW's
buffer regardless of whether that buffer is current or not."
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(if (eq window (selected-window))
(with-current-buffer (window-buffer window)
(point))
@@ -1078,7 +1090,7 @@ WINDOW can be any live window and defaults to the selected one.
This function is like `set-window-point' with one exception: If
WINDOW is selected, it moves `point' of WINDOW's buffer to POS
regardless of whether that buffer is current or not."
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(if (eq window (selected-window))
(with-current-buffer (window-buffer window)
(goto-char pos))
@@ -1089,7 +1101,7 @@ regardless of whether that buffer is current or not."
WINDOW can be any window and defaults to the selected one. SIDE
can be any of the symbols `left', `top', `right' or `bottom'.
The default value nil is handled like `bottom'."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let ((edge
(cond
((eq side 'left) 0)
@@ -1131,7 +1143,7 @@ DIRECTION must be one of `above', `below', `left' or `right'.
WINDOW must be a live window and defaults to the selected one.
IGNORE, when non-nil means a window can be returned even if its
`no-other-window' parameter is non-nil."
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(unless (memq direction '(above below left right))
(error "Wrong direction %s" direction))
(let* ((frame (window-frame window))
@@ -1486,7 +1498,7 @@ This function resizes other windows proportionally and never
deletes any windows. If you want to move only the low (right)
edge of WINDOW consider using `adjust-window-trailing-edge'
instead."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let* ((frame (window-frame window))
sibling)
(cond
@@ -2005,7 +2017,7 @@ If DELTA is greater zero, then move the edge downwards or to the
right. If DELTA is less than zero, move the edge upwards or to
the left. If the edge can't be moved by DELTA lines or columns,
move it as far as possible in the desired direction."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let ((frame (window-frame window))
(right window)
left this-delta min-delta max-delta failed)
@@ -2152,7 +2164,7 @@ Return nil."
Make WINDOW as large as possible without deleting any windows.
WINDOW can be any window and defaults to the selected window."
(interactive)
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(window-resize window (window-max-delta window))
(window-resize window (window-max-delta window t) t))
@@ -2161,7 +2173,7 @@ WINDOW can be any window and defaults to the selected window."
Make WINDOW as small as possible without deleting any windows.
WINDOW can be any window and defaults to the selected window."
(interactive)
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(window-resize window (- (window-min-delta window)))
(window-resize window (- (window-min-delta window t)) t))
@@ -2317,7 +2329,7 @@ and no others."
"Return t if WINDOW can be safely deleted from its frame.
Return `frame' if deleting WINDOW should also delete its
frame."
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(unless ignore-window-parameters
;; Handle atomicity.
@@ -2367,7 +2379,7 @@ Otherwise, if WINDOW is part of an atomic window, call
argument. If WINDOW is the only window on its frame or the last
non-side window, signal an error."
(interactive)
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let* ((frame (window-frame window))
(function (window-parameter window 'delete-window))
(parent (window-parent window))
@@ -2448,7 +2460,7 @@ WINDOW is a non-side window, make WINDOW the only non-side window
on the frame. Side windows are not deleted. If WINDOW is a side
window signal an error."
(interactive)
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let* ((frame (window-frame window))
(function (window-parameter window 'delete-other-windows))
(window-side (window-parameter window 'window-side))
@@ -2530,7 +2542,7 @@ This may be a useful alternative binding for \\[delete-other-windows]
(defun record-window-buffer (&optional window)
"Record WINDOW's buffer.
WINDOW must be a live window and defaults to the selected one."
- (let* ((window (window-normalize-live-window window))
+ (let* ((window (window-normalize-window window t))
(buffer (window-buffer window))
(entry (assq buffer (window-prev-buffers window))))
;; Reset WINDOW's next buffers. If needed, they are resurrected by
@@ -2566,7 +2578,7 @@ WINDOW must be a live window and defaults to the selected one."
WINDOW must be a live window and defaults to the selected one.
BUFFER must be a live buffer and defaults to the buffer of
WINDOW."
- (let* ((window (window-normalize-live-window window))
+ (let* ((window (window-normalize-window window t))
(buffer (or buffer (window-buffer window))))
(set-window-prev-buffers
window (assq-delete-all buffer (window-prev-buffers window)))
@@ -2599,7 +2611,7 @@ Optional argument BURY-OR-KILL non-nil means the buffer currently
shown in WINDOW is about to be buried or killed and consequently
shall not be switched to in future invocations of this command."
(interactive)
- (let* ((window (window-normalize-live-window window))
+ (let* ((window (window-normalize-window window t))
(old-buffer (window-buffer window))
;; Save this since it's destroyed by `set-window-buffer'.
(next-buffers (window-next-buffers window))
@@ -2688,7 +2700,7 @@ shall not be switched to in future invocations of this command."
"In WINDOW switch to next buffer.
WINDOW must be a live window and defaults to the selected one."
(interactive)
- (let* ((window (window-normalize-live-window window))
+ (let* ((window (window-normalize-window window t))
(old-buffer (window-buffer window))
(next-buffers (window-next-buffers window))
new-buffer entry killed-buffers visible)
@@ -2811,7 +2823,7 @@ Optional argument DEDICATED-ONLY non-nil means to delete WINDOW
only if it's dedicated to its buffer. Optional argument KILL
means the buffer shown in window will be killed. Return non-nil
if WINDOW gets deleted or its frame is auto-hidden."
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(unless (and dedicated-only (not (window-dedicated-p window)))
(let* ((buffer (window-buffer window))
(deletable (window-deletable-p window)))
@@ -2957,7 +2969,7 @@ WINDOW, \(3) restore the buffer previously displayed in WINDOW,
or \(4) make WINDOW display some other buffer than the present
one. If non-nil, reset `quit-restore' parameter to nil."
(interactive "P")
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(let* ((buffer (window-buffer window))
(quit-restore (window-parameter window 'quit-restore))
(prev-buffer
@@ -3089,7 +3101,7 @@ window, these properties as well as the buffer displayed in the
new window are inherited from the window selected on WINDOW's
frame. The selected window is not changed by this function."
(interactive "i")
- (setq window (window-normalize-any-window window))
+ (setq window (window-normalize-window window))
(let* ((side (cond
((not side) 'below)
((memq side '(below above right left)) side)
@@ -3663,7 +3675,7 @@ to put the state recorded here into an arbitrary window. The
value can be also stored on disk and read back in a new session."
(setq window
(if window
- (if (window-any-p window)
+ (if (window-valid-p window)
window
(error "%s is not a live or internal window" window))
(frame-root-window)))
@@ -3833,7 +3845,7 @@ Optional argument IGNORE non-nil means ignore minimum window
sizes and fixed size restrictions. IGNORE equal `safe' means
subwindows can get as small as `window-safe-min-height' and
`window-safe-min-width'."
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(let* ((frame (window-frame window))
(head (car state))
;; We check here (1) whether the total sizes of root window of
@@ -5099,7 +5111,7 @@ Note that the current implementation of this function cannot
always set the height exactly, but attempts to be conservative,
by allocating more lines than are actually needed in the case
where some error may be present."
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
(let ((delta (- height (window-text-height window))))
(unless (zerop delta)
;; Setting window-min-height to a value like 1 can lead to very
@@ -5195,7 +5207,7 @@ WINDOW was scrolled."
(interactive)
;; Do all the work in WINDOW and its buffer and restore the selected
;; window and the current buffer when we're done.
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
;; Can't resize a full height or fixed-size window.
(unless (or (window-size-fixed-p window)
(window-full-height-p window))
@@ -5301,7 +5313,7 @@ window, or if the window is the only window of its frame.
Return non-nil if the window was shrunk, nil otherwise."
(interactive)
- (setq window (window-normalize-live-window window))
+ (setq window (window-normalize-window window t))
;; Make sure that WINDOW is vertically combined and `point-min' is
;; visible (for whatever reason that's needed). The remaining issues
;; should be taken care of by `fit-window-to-buffer'.
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 64b9577e36..fc612d64fa 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,40 @@
+2011-11-05 Christoph Scholtes <[email protected]>
+
+ * inc/stdint.h (UINT64_MAX, UINT64_MIN, INT64_MIN, UINTMAX_MAX)
+ (UINTMAX_MIN, INTMAX_MAX, INTMAX_MIN, UINT32_MIN, UINT32_MAX)
+ (INT32_MIN, UINTMAX_MAX, UINTMAX_MIN, INTMAX_MAX, INTMAX_MIN)
+ (intmax_t, INT64_MAX): Add for MSVC.
+
+ * config.nt: (mode_t) [!__GNUC__]: Define mode_t for MSVC.
+
+2011-11-05 Eli Zaretskii <[email protected]>
+
+ * config.nt (inline) [!__GNUC__]: Define to __inline for MSVC.
+
+ Support MSVC build with newer versions of Visual Studio.
+ * makefile.w32-in (clean-other-dirs-nmake)
+ (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake):
+ Update for current structure of doc/ subdirectories.
+
+ * gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables.
+
+ * INSTALL: Update for newer versions of MSVC.
+
+2011-11-05 Fabrice Popineau <[email protected]> (tiny change)
+
+ Support MSVC build with newer versions of Visual Studio.
+ * nmake.defs (USE_CRT_DLL): Define to 1.
+ (libc, EMACS_EXTRA_C_FLAGS, SYS_LDFLAGS, ARCH_CFLAGS): Update values.
+ (D): New variable.
+
+2011-11-04 Eli Zaretskii <[email protected]>
+
+ * runemacs.c (ensure_unicows_dll): New function, tries to load
+ UNICOWS.DLL on Windows 9X.
+ (WinMain): If ensure_unicows_dll fails to find UNICOWS.DLL,
+ display a dialog to the effect that Emacs cannot be started.
+ (Bug#8562)
+
2011-10-28 Eli Zaretskii <[email protected]>
* README.W32: Mention UNICOWS.DLL as prerequisite for running
diff --git a/nt/INSTALL b/nt/INSTALL
index 613610890a..63285047a6 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -21,19 +21,32 @@
cd nt
- 2. Run configure.bat. From the COMMAND.COM/CMD.EXE command prompt:
+ 2. Run configure.bat.
+
+ 2a.If you use MSVC, set up the build environment by running the
+ SetEnv.cmd batch file from the appropriate SDK directory. (Skip
+ this step if you are using MinGW.) For example:
+
+ "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /Debug
+
+ if you are goiung to compile a debug version, or
+
+ "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /Release
+
+ if you are going to compile an optimized version.
+
+ 2b.From the COMMAND.COM/CMD.EXE command prompt type:
configure
- from a Unixy shell prompt:
+ From a Unixy shell prompt:
cmd /c configure.bat
or
command.com /c configure.bat
3. Run the Make utility suitable for your environment. If you build
- with the Microsoft's Visual C compiler (but see notes about using
- VC++ 8.0 and later below):
+ with the Microsoft's Visual C compiler:
nmake
@@ -101,24 +114,21 @@
* Supported development environments
To compile Emacs, you will need either Microsoft Visual C++ 2.0, or
- later up to 7.0, and nmake, or a Windows port of GCC 2.95 or later
- with MinGW and W32 API support and a port of GNU Make. You can use
- the Cygwin ports of GCC, but Emacs requires the MinGW headers and
- libraries to build (latest versions of the Cygwin toolkit, at least
- since v1.3.3, include the MinGW headers and libraries as an integral
- part).
-
- Note that building Emacs with Visual Studio 2005 (VC++ 8.0) and
- later is not supported at this time, due to changes introduced by
- Microsoft into the libraries shipped with the compiler.
+ later and nmake, or a Windows port of GCC 2.95 or later with MinGW
+ and W32 API support and a port of GNU Make. You can use the Cygwin
+ ports of GCC, but Emacs requires the MinGW headers and libraries to
+ build (latest versions of the Cygwin toolkit, at least since v1.3.3,
+ include the MinGW headers and libraries as an integral part).
The rest of this file assumes you have a working development
- environment. If you just installed such an environment, try
+ environment. If you just installed such an environment, try
building a trivial C "Hello world" program, and see if it works. If
it doesn't work, resolve that problem first! If you use Microsoft
Visual Studio .NET 2003, don't forget to run the VCVARS32.BAT batch
file from the `Bin' subdirectory of the directory where you have
- installed VS.NET.
+ installed VS.NET. With other versions of MSVC, run the SetEnv.cmd
+ batch file from the `Bin' subdirectory of the directory where you
+ have the SDK installed.
If you use the MinGW port of GCC and GNU Make to build Emacs, there
are some compatibility issues wrt Make and the shell that is run by
diff --git a/nt/config.nt b/nt/config.nt
index 87c5f5cc8a..3a06a9f5b7 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/>. */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
+#ifdef __GNUC__
#ifndef __cplusplus
#undef inline
#endif
+#else /* MSVC */
+#define inline __inline
+#endif
/* Define to the equivalent of the C99 'restrict' keyword, or to
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/>. */
# define restrict
#endif
+/* `mode_t' is not defined for MSVC. Define. */
+#ifdef _MSC_VER
+typedef unsigned short mode_t;
+#endif
+
/* A va_copy replacement for MSVC. */
#ifdef _MSC_VER
# ifdef _WIN64
diff --git a/nt/gmake.defs b/nt/gmake.defs
index bbb560264c..46d4acf76d 100644
--- a/nt/gmake.defs
+++ b/nt/gmake.defs
@@ -193,6 +193,11 @@ OLE32 = -lole32
UNISCRIBE = -lusp10
UUID = -luuid
+# Used by src/makefile.w32-in, since Nmake barfs on $(func SOMETHING)
+OBJ0_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
+OBJ1_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
+OBJ2_c = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2))
+
ifdef NOOPT
DEBUG_CFLAGS = -DEMACSDEBUG
else
diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h
index 4af0346af2..5242a45df4 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/>. */
/* Minimum definitions to allow compilation with tool chains where
stdint.h is not available, e.g. Microsoft Visual Studio. */
-typedef unsigned int uint32_t;
-#define INT32_MAX 2147483647
+#ifdef _WIN64
+typedef __int64 intptr_t;
+#define UINT64_MAX 18446744073709551616
+#define UINT64_MIN 0
/* "i64" is the non-standard suffix used by MSVC for 64-bit constants. */
#define INT64_MAX 9223372036854775807i64
-
-#ifdef _WIN64
- typedef __int64 intptr_t;
+#define INT64_MIN (~INT64_MAX)
#define INTPTR_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+#define UINTMAX_MIN UINT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define INTMAX_MIN INT64_MIN
#else
- typedef int intptr_t;
+typedef int intptr_t;
+typedef unsigned int uint32_t;
+#define UINT32_MAX 4294967296
+#define UINT32_MIN 0
+#define INT32_MAX 2147483647
+#define INT32_MIN (~INT32_MAX)
#define INTPTR_MAX INT32_MAX
+#define UINTMAX_MAX UINT32_MAX
+#define UINTMAX_MIN UINT32_MIN
+#define INTMAX_MAX INT32_MAX
+#define INTMAX_MIN INT32_MIN
#endif
#define uintmax_t unsigned __int64
+#define intmax_t __int64
#define PTRDIFF_MAX INTPTR_MAX
#endif /* !__GNUC__ */
diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in
index 05631855f6..194f0759bb 100644
--- a/nt/makefile.w32-in
+++ b/nt/makefile.w32-in
@@ -313,15 +313,15 @@ clean-other-dirs-nmake:
$(MAKE) $(MFLAGS) clean
cd ..\doc\lispintro
$(MAKE) $(MFLAGS) clean
- cd ..\doc\lispref
+ cd ..\lispref
$(MAKE) $(MFLAGS) clean
- cd ..\leim
+ cd ..\..\leim
$(MAKE) $(MFLAGS) clean
cd ..\doc\emacs
$(MAKE) $(MFLAGS) clean
- cd ..\doc\misc
+ cd ..\misc
$(MAKE) $(MFLAGS) clean
- cd ..\nt
+ cd ..\..\nt
clean-other-dirs-gmake:
$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
@@ -381,13 +381,13 @@ distclean-other-dirs-nmake:
$(MAKE) $(MFLAGS) distclean
cd ..\doc\emacs
$(MAKE) $(MFLAGS) distclean
- cd ..\doc\misc
+ cd ..\misc
$(MAKE) $(MFLAGS) distclean
- cd ..\doc\lispintro
+ cd ..\lispintro
$(MAKE) $(MFLAGS) distclean
- cd ..\doc\lispref
+ cd ..\lispref
$(MAKE) $(MFLAGS) distclean
- cd ..\nt
+ cd ..\..\nt
distclean-other-dirs-gmake:
$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
@@ -415,13 +415,13 @@ maintainer-clean-other-dirs-nmake:
$(MAKE) $(MFLAGS) maintainer-clean
cd ..\doc\emacs
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\doc\misc
+ cd ..\misc
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\doc\lispintro
+ cd ..\lispintro
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\doc\lispref
+ cd ..\lispref
$(MAKE) $(MFLAGS) maintainer-clean
- cd ..\nt
+ cd ..\..\nt
maintainer-clean-other-dirs-gmake:
$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
diff --git a/nt/nmake.defs b/nt/nmake.defs
index 6c0922d78b..4a7d93d40d 100644
--- a/nt/nmake.defs
+++ b/nt/nmake.defs
@@ -109,7 +109,15 @@ RC = rc
RC_OUT = -Fo
RC_INCLUDE = -i
-libc = libc.lib
+USE_CRT_DLL = 1
+
+!ifdef USE_CRT_DLL
+libc = msvcrt$(D).lib
+EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
+!else
+libc = libcmt$(D).lib
+EMACS_EXTRA_C_FLAGS= -D_MT
+!endif
baselibs =
O = obj
A = lib
@@ -146,9 +154,13 @@ CFLAGS = -I. $(ARCH_CFLAGS) \
$(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
ESC_CFLAGS = -I. $(ARCH_CFLAGS) \
$(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
-EMACS_EXTRA_C_FLAGS =
-SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+#SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+!ifdef NOOPT
+SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -debug -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+!else
+SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
+!endif
# see comments in allocate_heap in w32heap.c before changing any of the
# -stack, -heap, or -base settings.
@@ -184,16 +196,20 @@ DEL_TREE = rm -r
!ifdef NODEBUG
DEBUG_FLAG =
DEBUG_LINK =
+D =
!else
DEBUG_FLAG = -Zi
-DEBUG_LINK = -debug:full
+DEBUG_LINK = -debug
+D = d
!endif
!if "$(ARCH)" == "i386"
!ifdef NOOPT
-ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
+#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Od -Gd $(DEBUG_FLAG)
!else
-ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
+#ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Oi -Ot -Oy- -Ob2 -GF -Gy -Gd $(DEBUG_FLAG)
!endif
ARCH_LDFLAGS = $(SYS_LDFLAGS)
diff --git a/nt/runemacs.c b/nt/runemacs.c
index 07e24f745f..47b8f54bb0 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/>. */
#include <malloc.h>
static void set_user_model_id (void);
+static int ensure_unicows_dll (void);
int WINAPI
WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
@@ -59,6 +60,9 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
char *p;
char modname[MAX_PATH];
+ if (!ensure_unicows_dll ())
+ goto error;
+
set_user_model_id ();
if (!GetModuleFileName (NULL, modname, MAX_PATH))
@@ -203,3 +207,43 @@ set_user_model_id (void)
}
}
+static int
+ensure_unicows_dll (void)
+{
+ OSVERSIONINFO os_ver;
+ HMODULE h;
+
+ ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
+ os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+ if (!GetVersionEx (&os_ver))
+ return 0;
+
+ if (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+ {
+ h = LoadLibrary ("Unicows.dll");
+ if (!h)
+ {
+ int button;
+
+ button = MessageBox (NULL,
+ "Emacs cannot load the UNICOWS.DLL library.\n"
+ "This library is essential for using Emacs\n"
+ "on this system. You need to install it.\n\n"
+ "However, you can still use Emacs by invoking\n"
+ "it with the '-nw' command-line option.\n\n"
+ "Emacs will exit when you click OK.",
+ "Emacs cannot load UNICOWS.DLL",
+ MB_ICONERROR | MB_TASKMODAL
+ | MB_SETFOREGROUND | MB_OK);
+ switch (button)
+ {
+ case IDOK:
+ default:
+ return 0;
+ }
+ }
+ FreeLibrary (h);
+ return 1;
+ }
+ return 1;
+}
diff --git a/src/ChangeLog b/src/ChangeLog
index 3af9590134..4058054ec0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -9,6 +9,150 @@
* callproc.c (Fcall_process): Set the member src_multibyte of
process_coding to 0 (bug#9912).
+2011-11-06 YAMAMOTO Mitsuharu <[email protected]>
+
+ * xmenu.c (cleanup_widget_value_tree): New function.
+ (xmenu_show, xdialog_show): Use it in record_unwind_protect instead of
+ calling free_menubar_widget_value_tree directly (Bug#9830).
+
+2011-11-06 Paul Eggert <[email protected]>
+
+ Fix some portability problems with 'inline'.
+ * dispextern.h (window_box, window_box_height, window_text_bottom_y)
+ (window_box_width, window_box_left, window_box_left_offset)
+ (window_box_right, window_box_right_offset): Declare extern.
+ Otherwise, these inline functions do not conform to C99 and
+ are miscompiled by Microsoft compilers. Reported by Eli Zaretskii in
+ <http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00084.html>.
+ * intervals.c (adjust_intervals_for_insertion)
+ (adjust_intervals_for_deletion): Now extern, because otherwise the
+ extern inline functions 'offset_intervals' couldn't refer to it.
+ (static_offset_intervals): Remove.
+ (offset_intervals): Rewrite using the old contents of
+ static_offset_intervals. The old version didn't conform to C99
+ because an extern inline function contained a reference to an
+ identifier with static linkage.
+
+2011-11-06 Andreas Schwab <[email protected]>
+
+ * keyboard.c (interrupt_signal): Don't call kill-emacs while in
+ GC.
+
+2011-11-06 Eli Zaretskii <[email protected]>
+
+ * xdisp.c (init_iterator, reseat_to_string): Don't set the
+ iterator's bidi_p flag if Vpurify_flag is non-nil. (Bug#9963)
+ (Fcurrent_bidi_paragraph_direction): If Vpurify_flag is non-nil,
+ return Qleft_to_right.
+
+2011-11-06 Chong Yidong <[email protected]>
+
+ * window.c (Fwindow_live_p, Fwindow_frame, Fframe_root_window)
+ (Fminibuffer_window, Fwindow_buffer, Fwindow_splits)
+ (Fset_window_splits, Fwindow_nest, Fset_window_nest)
+ (Fwindow_use_time, Fwindow_total_size, Fwindow_normal_size)
+ (Fwindow_new_normal, Fwindow_left_column, Fwindow_top_line)
+ (Fwindow_margins, Fwindow_fringes, Fwindow_scroll_bars)
+ (Fwindow_vscroll): Doc fix.
+ (Fwindow_top_child, Fwindow_left_child): Eliminate a nil default
+ argument, since it makes no sense to pass a live window and for
+ consistency with window-child.
+
+2011-11-05 Christoph Scholtes <[email protected]>
+
+ * makefile.w32-in ($(TEMACS), (gl-stamp)): Use $(THISDIR) to
+ support MSVC.
+
+2011-11-05 Jason Rumney <[email protected]>
+
+ * w32font.c (font_matches_spec): Filter out non-Japanese kana fonts.
+ (add_font_entity_to_list): Filter out non-Japanese Shift-JIS
+ fonts (Bug#6029).
+ (add_font_entity_to_list): Fix logic errors in mixed boolean and
+ bitwise arithmetic preventing use of unicode-sip and non-truetype
+ opentype fonts.
+
+2011-11-05 Eli Zaretskii <[email protected]>
+
+ * s/ms-w32.h (fstat, stat, utime): Move redirections to
+ "emacs"-only part.
+
+ * w32fns.c (x_create_tip_frame, Fx_create_frame): Rearrange
+ initialization code to keep similarity to xfns.c after changes
+ from 2011-11-05.
+
+2011-11-05 Jan Djärv <[email protected]>
+
+ * nsfns.m: Declare image_cache_refcount if GLYPH_DEBUG.
+ (unwind_create_frame): New function (Bug#9943).
+ (Fx_create_frame): Restructure code to be more similar to the one in
+ xfns.c. Call record_unwind_protect with unwind_create_frame (Bug#9943).
+ Initialize image_cache_refcount if GLYPH_DEBUG (Bug#9943).
+ Move terminal->reference_count++ just before making the frame official
+ (Bug#9943).
+
+ * nsterm.m (x_free_frame_resources): New function.
+ (x_destroy_window): Move code to x_free_frame_resources.
+
+ * xfns.c (unwind_create_frame): Fix comment.
+ (Fx_create_frame, x_create_tip_frame): Move
+ terminal->reference_count++ just before making the frame
+ official. Move initialization of image_cache_refcount and
+ dpyinfo_refcount before calling init_frame_faces (Bug#9943).
+
+2011-11-05 Eli Zaretskii <[email protected]>
+
+ Support MSVC build with newer versions of Visual Studio.
+ * makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as
+ Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on
+ nt/gmake.defs.
+
+ * lisp.h (ENUM_BF): New macro, for enumerated types in bitfields,
+ which are not supported by MSVC.
+ (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay)
+ (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in
+ bitfields.
+ (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated
+ types in bitfields.
+ (DEFUN) [_MSC_VER]: Define in a different way for MSVC.
+
+ * w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version.
+
+2011-11-05 Fabrice Popineau <[email protected]> (tiny change)
+
+ Support MSVC build with newer versions of Visual Studio.
+ * w32.c: Don't include w32api.h for MSVC.
+ (init_environment) [_MSC_VER]: Call sys_access, not _access.
+
+ * s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC.
+ [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h.
+ (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins.
+ (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the
+ e_* cousins.
+ (alloca) [_MSC_VER]: Define to _alloca.
+
+ * lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC.
+
+ * regex.c <re_char> [_MSC_VER]: A separate definition for MSVC.
+
+2011-11-04 Eli Zaretskii <[email protected]>
+
+ * xdisp.c (note_mouse_highlight): If either of
+ previous/next-single-property-change returns nil, treat that as
+ the beginning or the end of the buffer. (Bug#9955)
+
+2011-11-04 Jan Djärv <[email protected]>
+
+ * gtkutil.c (xg_make_tool_item): Add callbacks if one of wimage or
+ label is not null (Bug#9951).
+ (xg_tool_item_stale_p): Handle the fact that wimage and/or wlbl
+ may be NULL.
+
+2011-11-04 Eli Zaretskii <[email protected]>
+
+ * window.c (Fwindow_body_size): Mention in the doc string that the
+ return value is in frame's canonical units. (Bug#9949)
+
2011-11-03 Eli Zaretskii <[email protected]>
* xdisp.c (note_mouse_highlight): Initialize `area'. (Bug#9947)
@@ -2742,6 +2886,9 @@
2011-07-08 Jason Rumney <[email protected]>
+ * w32term.c (x_make_frame_visible): Use SH_SHOWNORMAL rather than
+ SH_SHOW for hidden windows (Bug#5482).
+
* w32fns.c (w32_wnd_proc) [WM_TIMER, WM_SET_CURSOR]: Avoid using
frame struct members of non-existent frames (Bug#6284).
diff --git a/src/dispextern.h b/src/dispextern.h
index 5c60a5499d..fdc7f2f908 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3006,14 +3006,14 @@ int resize_mini_window (struct window *, int);
void set_vertical_scroll_bar (struct window *);
#endif
int try_window (Lisp_Object, struct text_pos, int);
-void window_box (struct window *, int, int *, int *, int *, int *);
-int window_box_height (struct window *);
-int window_text_bottom_y (struct window *);
-int window_box_width (struct window *, int);
-int window_box_left (struct window *, int);
-int window_box_left_offset (struct window *, int);
-int window_box_right (struct window *, int);
-int window_box_right_offset (struct window *, int);
+extern void window_box (struct window *, int, int *, int *, int *, int *);
+extern int window_box_height (struct window *);
+extern int window_text_bottom_y (struct window *);
+extern int window_box_width (struct window *, int);
+extern int window_box_left (struct window *, int);
+extern int window_box_left_offset (struct window *, int);
+extern int window_box_right (struct window *, int);
+extern int window_box_right_offset (struct window *, int);
int estimate_mode_line_height (struct frame *, enum face_id);
void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
NativeRectangle *, int);
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 26959d57d4..af697c7267 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4237,7 +4237,7 @@ xg_make_tool_item (FRAME_PTR f,
gtk_container_add (GTK_CONTAINER (weventbox), wb);
gtk_container_add (GTK_CONTAINER (ti), weventbox);
- if (wimage)
+ if (wimage || label)
{
intptr_t ii = i;
gpointer gi = (gpointer) ii;
@@ -4302,21 +4302,21 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage);
/* Check if the tool icon matches. */
- if (stock_name)
+ if (stock_name && wimage)
{
old = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_STOCK_NAME);
if (!old || strcmp (old, stock_name))
return 1;
}
- else if (icon_name)
+ else if (icon_name && wimage)
{
old = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_ICON_NAME);
if (!old || strcmp (old, icon_name))
return 1;
}
- else
+ else if (wimage)
{
gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_IMAGE_DATA);
@@ -4331,7 +4331,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
return 1;
/* Ensure label is correct. */
- if (label)
+ if (label && wlbl)
gtk_label_set_text (GTK_LABEL (wlbl), label);
return 0;
}
diff --git a/src/intervals.c b/src/intervals.c
index 1f3f8cf793..be1bdfb905 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/>. */
#define TMEM(sym, set) (CONSP (set) ? ! NILP (Fmemq (sym, set)) : ! NILP (set))
+extern INTERVAL adjust_intervals_for_insertion (INTERVAL,
+ EMACS_INT, EMACS_INT);
+extern void adjust_intervals_for_deletion (struct buffer *,
+ EMACS_INT, EMACS_INT);
+
static Lisp_Object merge_properties_sticky (Lisp_Object, Lisp_Object);
static INTERVAL merge_interval_right (INTERVAL);
static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
@@ -798,7 +803,7 @@ update_interval (register INTERVAL i, EMACS_INT pos)
and check the hungry bits of both. Then add the length going back up
to the root. */
-static INTERVAL
+INTERVAL
adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
EMACS_INT length)
{
@@ -859,7 +864,7 @@ adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
interval. Another possibility would be to create a new interval for
this text, and make it have the merged properties of both ends. */
-static INTERVAL
+INTERVAL
adjust_intervals_for_insertion (INTERVAL tree,
EMACS_INT position, EMACS_INT length)
{
@@ -1369,7 +1374,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
text. The deletion is effected at position START (which is a
buffer position, i.e. origin 1). */
-static void
+void
adjust_intervals_for_deletion (struct buffer *buffer,
EMACS_INT start, EMACS_INT length)
{
@@ -1425,9 +1430,8 @@ adjust_intervals_for_deletion (struct buffer *buffer,
compiler that does not allow calling a static function (here,
adjust_intervals_for_deletion) from a non-static inline function. */
-static inline void
-static_offset_intervals (struct buffer *buffer, EMACS_INT start,
- EMACS_INT length)
+inline void
+offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
{
if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0)
return;
@@ -1440,12 +1444,6 @@ static_offset_intervals (struct buffer *buffer, EMACS_INT start,
adjust_intervals_for_deletion (buffer, start, -length);
}
}
-
-inline void
-offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
-{
- static_offset_intervals (buffer, start, length);
-}
/* Merge interval I with its lexicographic successor. The resulting
interval is returned, and has the properties of the original
diff --git a/src/keyboard.c b/src/keyboard.c
index 95604550c8..11c37d14f6 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10856,8 +10856,12 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
if (!terminal)
{
/* If there are no frames there, let's pretend that we are a
- well-behaving UN*X program and quit. */
- Fkill_emacs (Qnil);
+ well-behaving UN*X program and quit. We cannot do that while
+ GC is in progress, though. */
+ if (!gc_in_progress)
+ Fkill_emacs (Qnil);
+ else
+ Vquit_flag = Qt;
}
else
{
diff --git a/src/lisp.h b/src/lisp.h
index df8812f73b..f3c704bc76 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -168,6 +168,9 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
# if HAVE_ATTRIBUTE_ALIGNED
# define DECL_ALIGN(type, var) \
type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
+# elif defined(_MSC_VER)
+# define DECL_ALIGN(type, var) \
+ type __declspec(align(1 << GCTYPEBITS)) var
# else
/* What directives do other compilers use? */
# endif
@@ -225,6 +228,15 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
# endif
#endif
+/* Stolen from GDB. The only known compiler that doesn't support
+ enums in bitfields is MSVC. */
+#ifdef _MSC_VER
+#define ENUM_BF(TYPE) unsigned int
+#else
+#define ENUM_BF(TYPE) enum TYPE
+#endif
+
+
enum Lisp_Type
{
/* Integer. XINT (obj) is the integer value. */
@@ -315,12 +327,12 @@ union Lisp_Object
/* Use explict signed, the signedness of a bit-field of type
int is implementation defined. */
signed EMACS_INT val : VALBITS;
- enum Lisp_Type type : GCTYPEBITS;
+ ENUM_BF (Lisp_Type) type : GCTYPEBITS;
} s;
struct
{
EMACS_UINT val : VALBITS;
- enum Lisp_Type type : GCTYPEBITS;
+ ENUM_BF (Lisp_Type) type : GCTYPEBITS;
} u;
}
Lisp_Object;
@@ -336,14 +348,14 @@ union Lisp_Object
struct
{
- enum Lisp_Type type : GCTYPEBITS;
+ ENUM_BF (Lisp_Type) type : GCTYPEBITS;
/* Use explict signed, the signedness of a bit-field of type
int is implementation defined. */
signed EMACS_INT val : VALBITS;
} s;
struct
{
- enum Lisp_Type type : GCTYPEBITS;
+ ENUM_BF (Lisp_Type) type : GCTYPEBITS;
EMACS_UINT val : VALBITS;
} u;
}
@@ -1096,7 +1108,7 @@ struct Lisp_Symbol
1 : it's a varalias, the value is really in the `alias' symbol.
2 : it's a localized var, the value is in the `blv' object.
3 : it's a forwarding variable, the value is in `forward'. */
- enum symbol_redirect redirect : 3;
+ ENUM_BF (symbol_redirect) redirect : 3;
/* Non-zero means symbol is constant, i.e. changing its value
should signal an error. If the value is 3, then the var
@@ -1309,7 +1321,7 @@ struct Lisp_Hash_Table
struct Lisp_Misc_Any /* Supertype of all Misc types. */
{
- enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */
+ ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */
unsigned gcmarkbit : 1;
int spacer : 15;
/* Make it as long as "Lisp_Free without padding". */
@@ -1318,7 +1330,7 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */
struct Lisp_Marker
{
- enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Marker */
+ ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */
unsigned gcmarkbit : 1;
int spacer : 13;
/* This flag is temporarily used in the functions
@@ -1468,7 +1480,7 @@ struct Lisp_Overlay
I.e. 9words plus 2 bits, 3words of which are for external linked lists.
*/
{
- enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Overlay */
+ ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
unsigned gcmarkbit : 1;
int spacer : 15;
struct Lisp_Overlay *next;
@@ -1487,7 +1499,7 @@ struct Lisp_Kboard_Objfwd
This type of object is used in the arg to record_unwind_protect. */
struct Lisp_Save_Value
{
- enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Save_Value */
+ ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
unsigned gcmarkbit : 1;
int spacer : 14;
/* If DOGC is set, POINTER is the address of a memory
@@ -1501,7 +1513,7 @@ struct Lisp_Save_Value
/* A miscellaneous object, when it's on the free list. */
struct Lisp_Free
{
- enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_Free */
+ ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */
unsigned gcmarkbit : 1;
int spacer : 15;
union Lisp_Misc *chain;
@@ -1896,13 +1908,23 @@ typedef struct {
/* This version of DEFUN declares a function prototype with the right
arguments, so we can catch errors with maxargs at compile-time. */
-#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
- Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
- static DECL_ALIGN (struct Lisp_Subr, sname) = \
- { PVEC_SUBR, \
- { .a ## maxargs = fnname }, \
- minargs, maxargs, lname, intspec, 0}; \
- Lisp_Object fnname
+#ifdef _MSC_VER
+#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
+ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
+ static DECL_ALIGN (struct Lisp_Subr, sname) = \
+ { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
+ { (Lisp_Object (__cdecl *)(void))fnname }, \
+ minargs, maxargs, lname, intspec, 0}; \
+ Lisp_Object fnname
+#else /* not _MSC_VER */
+#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
+ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
+ static DECL_ALIGN (struct Lisp_Subr, sname) = \
+ { PVEC_SUBR, \
+ { .a ## maxargs = fnname }, \
+ minargs, maxargs, lname, intspec, 0}; \
+ Lisp_Object fnname
+#endif
/* Note that the weird token-substitution semantics of ANSI C makes
this work for MANY and UNEVALLED. */
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 53cb5f857a..e97f7f3aca 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -177,7 +177,7 @@ temacs: stamp_BLD $(TEMACS)
$(TEMACS): $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
../nt/$(BLD)/addsection.exe $(GNULIB)
$(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
- "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
+ "$(THISDIR)/../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
# These omit firstfile.${O}, but there's no documentation in there
# anyways.
@@ -232,7 +232,7 @@ globals.h: gl-stamp
gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES)
- $(DEL) gl-tmp
- "../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
+ "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h"
- $(DEL) gl-tmp
echo timestamp > $@
@@ -348,11 +348,11 @@ TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2)
TAGS-gmake:
../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
--regex=@../nt/emacs-src.tags \
- $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
+ $(OBJ0_c)
../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
- $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
+ $(OBJ1_c)
../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
- $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \
+ $(OBJ2_c) \
$(CURDIR)/*.h $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
TAGS-nmake:
diff --git a/src/nsfns.m b/src/nsfns.m
index a09011d846..23362433a3 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -101,6 +101,10 @@ extern BOOL ns_in_resize;
static Lisp_Object as_script, *as_result;
static int as_status;
+#if GLYPH_DEBUG
+static ptrdiff_t image_cache_refcount;
+#endif
+
/* ==========================================================================
Internal utility functions
@@ -1038,6 +1042,41 @@ frame_parm_handler ns_frame_parm_handlers[] =
};
+/* Handler for signals raised during x_create_frame.
+ FRAME is the frame which is partially constructed. */
+
+static Lisp_Object
+unwind_create_frame (Lisp_Object frame)
+{
+ struct frame *f = XFRAME (frame);
+
+ /* If frame is already dead, nothing to do. This can happen if the
+ display is disconnected after the frame has become official, but
+ before x_create_frame removes the unwind protect. */
+ if (!FRAME_LIVE_P (f))
+ return Qnil;
+
+ /* If frame is ``official'', nothing to do. */
+ if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame))
+ {
+#if GLYPH_DEBUG && XASSERTS
+ struct ns_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+#endif
+
+ x_free_frame_resources (f);
+ free_glyphs (f);
+
+#if GLYPH_DEBUG
+ /* Check that reference counts are indeed correct. */
+ xassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
+#endif
+ return Qt;
+ }
+
+ return Qnil;
+}
+
+
/* ==========================================================================
@@ -1047,46 +1086,50 @@ frame_parm_handler ns_frame_parm_handlers[] =
DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1, 1, 0,
- doc: /* Make a new Nextstep window, called a \"frame\" in Emacs terms.
+ doc: /* Make a new Nextstep window, called a "frame" in Emacs terms.
Return an Emacs frame object.
PARMS is an alist of frame parameters.
If the parameters specify that the frame should not have a minibuffer,
and do not specify a specific minibuffer window to use,
then `default-minibuffer-frame' must be a frame whose minibuffer can
-be shared by the new frame. */)
+be shared by the new frame.
+
+This function is an internal primitive--use `make-frame' instead. */)
(Lisp_Object parms)
{
- static int desc_ctr = 1;
struct frame *f;
- struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
Lisp_Object frame, tem;
Lisp_Object name;
int minibuffer_only = 0;
+ int window_prompting = 0;
+ int width, height;
int count = specpdl_ptr - specpdl;
+ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
Lisp_Object display;
struct ns_display_info *dpyinfo = NULL;
Lisp_Object parent;
struct kboard *kb;
Lisp_Object tfont, tfontsize;
- int window_prompting = 0;
- int width, height;
+ static int desc_ctr = 1;
check_ns ();
- /* Seems a little strange, but other terms do it. Perhaps the code below
- is modifying something? */
+ /* x_get_arg modifies parms. */
parms = Fcopy_alist (parms);
+ /* Use this general default value to start with
+ until we know if this frame has a specified name. */
+ Vx_resource_name = Vinvocation_name;
+
display = x_get_arg (dpyinfo, parms, Qterminal, 0, 0, RES_TYPE_STRING);
if (EQ (display, Qunbound))
display = Qnil;
dpyinfo = check_ns_display_info (display);
+ kb = dpyinfo->terminal->kboard;
if (!dpyinfo->terminal->name)
error ("Terminal is not live, can't create new frames on it");
- kb = dpyinfo->terminal->kboard;
-
name = x_get_arg (dpyinfo, parms, Qname, 0, 0, RES_TYPE_STRING);
if (!STRINGP (name)
&& ! EQ (name, Qunbound)
@@ -1095,8 +1138,6 @@ be shared by the new frame. */)
if (STRINGP (name))
Vx_resource_name = name;
- else
- Vx_resource_name = Vinvocation_name;
parent = x_get_arg (dpyinfo, parms, Qparent_id, 0, 0, RES_TYPE_NUMBER);
if (EQ (parent, Qunbound))
@@ -1104,57 +1145,36 @@ be shared by the new frame. */)
if (! NILP (parent))
CHECK_NUMBER (parent);
+ /* make_frame_without_minibuffer can run Lisp code and garbage collect. */
+ /* No need to protect DISPLAY because that's not used after passing
+ it to make_frame_without_minibuffer. */
frame = Qnil;
GCPRO4 (parms, parent, name, frame);
-
tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer",
RES_TYPE_SYMBOL);
if (EQ (tem, Qnone) || NILP (tem))
- {
f = make_frame_without_minibuffer (Qnil, kb, display);
- }
else if (EQ (tem, Qonly))
{
f = make_minibuffer_frame ();
minibuffer_only = 1;
}
else if (WINDOWP (tem))
- {
f = make_frame_without_minibuffer (tem, kb, display);
- }
else
- {
f = make_frame (1);
- }
-
- /* Set the name; the functions to which we pass f expect the name to
- be set. */
- if (EQ (name, Qunbound) || NILP (name) || (XTYPE (name) != Lisp_String))
- {
- f->name = build_string ([ns_app_name UTF8String]);
- f->explicit_name =0;
- }
- else
- {
- f->name = name;
- f->explicit_name = 1;
- specbind (Qx_resource_name, name);
- }
XSETFRAME (frame, f);
FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
f->terminal = dpyinfo->terminal;
- f->terminal->reference_count++;
f->output_method = output_ns;
f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
- memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns)));
+ memset (f->output_data.ns, 0, sizeof *(f->output_data.ns));
FRAME_FONTSET (f) = -1;
- /* record_unwind_protect (unwind_create_frame, frame); safety; maybe later? */
-
f->icon_name = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
RES_TYPE_STRING);
if (! STRINGP (f->icon_name))
@@ -1162,6 +1182,9 @@ be shared by the new frame. */)
FRAME_NS_DISPLAY_INFO (f) = dpyinfo;
+ /* With FRAME_NS_DISPLAY_INFO set up, this unwind-protect is safe. */
+ record_unwind_protect (unwind_create_frame, frame);
+
f->output_data.ns->window_desc = desc_ctr++;
if (!NILP (parent))
{
@@ -1174,6 +1197,20 @@ be shared by the new frame. */)
f->output_data.ns->explicit_parent = 0;
}
+ /* Set the name; the functions to which we pass f expect the name to
+ be set. */
+ if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name))
+ {
+ f->name = build_string ([ns_app_name UTF8String]);
+ f->explicit_name = 0;
+ }
+ else
+ {
+ f->name = name;
+ f->explicit_name = 1;
+ specbind (Qx_resource_name, name);
+ }
+
f->resx = dpyinfo->resx;
f->resy = dpyinfo->resy;
@@ -1223,11 +1260,15 @@ be shared by the new frame. */)
"leftFringe", "LeftFringe", RES_TYPE_NUMBER);
x_default_parameter (f, parms, Qright_fringe, Qnil,
"rightFringe", "RightFringe", RES_TYPE_NUMBER);
- /* end PENDING */
- init_frame_faces (f);
+#if GLYPH_DEBUG
+ image_cache_refcount =
+ FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
+#endif
- /* The X resources controlling the menu-bar and tool-bar are
+ init_frame_faces (f);
+
+ /* The resources controlling the menu-bar and tool-bar are
processed specially at startup, and reflected in the mode
variables; ignore them here. */
x_default_parameter (f, parms, Qmenu_bar_lines,
@@ -1244,38 +1285,6 @@ be shared by the new frame. */)
x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
RES_TYPE_STRING);
-/* TODO: other terms seem to get away w/o this complexity.. */
- if (NILP (Fassq (Qwidth, parms)))
- {
- Lisp_Object value
- = x_get_arg (dpyinfo, parms, Qwidth, "width", "Width",
- RES_TYPE_NUMBER);
- if (! EQ (value, Qunbound))
- parms = Fcons (Fcons (Qwidth, value), parms);
- }
- if (NILP (Fassq (Qheight, parms)))
- {
- Lisp_Object value
- = x_get_arg (dpyinfo, parms, Qheight, "height", "Height",
- RES_TYPE_NUMBER);
- if (! EQ (value, Qunbound))
- parms = Fcons (Fcons (Qheight, value), parms);
- }
- if (NILP (Fassq (Qleft, parms)))
- {
- Lisp_Object value
- = x_get_arg (dpyinfo, parms, Qleft, "left", "Left", RES_TYPE_NUMBER);
- if (! EQ (value, Qunbound))
- parms = Fcons (Fcons (Qleft, value), parms);
- }
- if (NILP (Fassq (Qtop, parms)))
- {
- Lisp_Object value
- = x_get_arg (dpyinfo, parms, Qtop, "top", "Top", RES_TYPE_NUMBER);
- if (! EQ (value, Qunbound))
- parms = Fcons (Fcons (Qtop, value), parms);
- }
-
window_prompting = x_figure_window_size (f, parms, 1);
tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
@@ -1297,23 +1306,27 @@ be shared by the new frame. */)
x_icon (f, parms);
+ /* ns_display_info does not have a reference_count. */
+ f->terminal->reference_count++;
+
/* It is now ok to make the frame official even if we get an error below.
The frame needs to be on Vframe_list or making it visible won't work. */
Vframe_list = Fcons (frame, Vframe_list);
- /*FRAME_NS_DISPLAY_INFO (f)->reference_count++; */
-
- x_default_parameter (f, parms, Qicon_type, Qnil, "bitmapIcon", "BitmapIcon",
- RES_TYPE_SYMBOL);
- x_default_parameter (f, parms, Qauto_raise, Qnil, "autoRaise", "AutoRaiseLower",
- RES_TYPE_BOOLEAN);
- x_default_parameter (f, parms, Qauto_lower, Qnil, "autoLower", "AutoLower",
- RES_TYPE_BOOLEAN);
- x_default_parameter (f, parms, Qcursor_type, Qbox, "cursorType", "CursorType",
- RES_TYPE_SYMBOL);
- x_default_parameter (f, parms, Qscroll_bar_width, Qnil, "scrollBarWidth",
- "ScrollBarWidth", RES_TYPE_NUMBER);
- x_default_parameter (f, parms, Qalpha, Qnil, "alpha", "Alpha",
- RES_TYPE_NUMBER);
+
+ x_default_parameter (f, parms, Qicon_type, Qnil,
+ "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL);
+
+ x_default_parameter (f, parms, Qauto_raise, Qnil,
+ "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
+ x_default_parameter (f, parms, Qauto_lower, Qnil,
+ "autoLower", "AutoLower", RES_TYPE_BOOLEAN);
+ x_default_parameter (f, parms, Qcursor_type, Qbox,
+ "cursorType", "CursorType", RES_TYPE_SYMBOL);
+ x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
+ "scrollBarWidth", "ScrollBarWidth",
+ RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qalpha, Qnil,
+ "alpha", "Alpha", RES_TYPE_NUMBER);
width = FRAME_COLS (f);
height = FRAME_LINES (f);
@@ -1324,20 +1337,24 @@ be shared by the new frame. */)
if (! f->output_data.ns->explicit_parent)
{
- tem = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
- if (EQ (tem, Qunbound))
- tem = Qt;
- x_set_visibility (f, tem, Qnil);
- if (EQ (tem, Qicon))
+ Lisp_Object visibility;
+
+ visibility = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0,
+ RES_TYPE_SYMBOL);
+ if (EQ (visibility, Qunbound))
+ visibility = Qt;
+
+ if (EQ (visibility, Qicon))
x_iconify_frame (f);
- else if (! NILP (tem))
+ else if (! NILP (visibility))
{
x_make_frame_visible (f);
- f->async_visible = 1;
[[FRAME_NS_VIEW (f) window] makeKeyWindow];
}
else
- f->async_visible = 0;
+ {
+ /* Must have been Qnil. */
+ }
}
if (FRAME_HAS_MINIBUF_P (f)
@@ -1352,6 +1369,9 @@ be shared by the new frame. */)
f->param_alist = Fcons (XCAR (tem), f->param_alist);
UNGCPRO;
+
+ /* Make sure windows on this frame appear in calls to next-window
+ and similar functions. */
Vwindow_list = Qnil;
return unbind_to (count, frame);
diff --git a/src/nsterm.m b/src/nsterm.m
index a2ae5e6951..3d3723fc28 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -164,7 +164,7 @@ static Lisp_Object last_mouse_motion_frame;
static EmacsScroller *last_mouse_scroll_bar = nil;
static struct frame *ns_updating_frame;
static NSView *focus_view = NULL;
-static int ns_window_num =0;
+static int ns_window_num = 0;
static NSRect uRect;
static BOOL gsaved = NO;
BOOL ns_in_resize = NO;
@@ -1123,12 +1123,10 @@ x_iconify_frame (struct frame *f)
[[view window] miniaturize: NSApp];
}
+/* Free X resources of frame F. */
void
-x_destroy_window (struct frame *f)
-/* --------------------------------------------------------------------------
- External: Delete the window
- -------------------------------------------------------------------------- */
+x_free_frame_resources (struct frame *f)
{
NSView *view = FRAME_NS_VIEW (f);
struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
@@ -1163,10 +1161,21 @@ x_destroy_window (struct frame *f)
[[view window] close];
[view release];
- ns_window_num--;
UNBLOCK_INPUT;
}
+void
+x_destroy_window (struct frame *f)
+/* --------------------------------------------------------------------------
+ External: Delete the window
+ -------------------------------------------------------------------------- */
+{
+ NSTRACE (x_destroy_window);
+ check_ns ();
+ x_free_frame_resources (f);
+ ns_window_num--;
+}
+
void
x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
diff --git a/src/regex.c b/src/regex.c
index 8033ab9eda..ccbad58abb 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -530,7 +530,11 @@ init_syntax_once (void)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* Type of source-pattern and string chars. */
+#ifdef _MSC_VER
+typedef unsigned char re_char;
+#else
typedef const unsigned char re_char;
+#endif
typedef char boolean;
#define false 0
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 813c3cef11..fb0882860d 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/>. */
#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
#include <sys/types.h>
+
+#ifdef _MSC_VER
+typedef unsigned long sigset_t;
+typedef int ssize_t;
+#endif
+
struct sigaction {
int sa_flags;
void (*sa_handler)(int);
@@ -181,6 +187,17 @@ struct sigaction {
#ifdef emacs
+#ifdef _MSC_VER
+#include <sys/timeb.h>
+#include <sys/stat.h>
+#include <signal.h>
+
+/* MSVC gets link-time errors without these redirections. */
+#define fstat(a, b) sys_fstat(a, b)
+#define stat(a, b) sys_stat(a, b)
+#define utime sys_utime
+#endif
+
/* Calls that are emulated or shadowed. */
#undef access
#define access sys_access
@@ -267,6 +284,7 @@ typedef int pid_t;
#if !defined (_MSC_VER) || (_MSC_VER < 1400)
#define tzname _tzname
+#undef utime
#define utime _utime
#endif
@@ -317,13 +335,17 @@ extern char *get_emacs_configuration_options (void);
#define _WINSOCK_H
/* Defines size_t and alloca (). */
-#ifdef USE_CRT_DLL
+#if (defined(_MSC_VER) && defined(emacs)) || defined(USE_CRT_DLL)
#define malloc e_malloc
#define free e_free
#define realloc e_realloc
#define calloc e_calloc
#endif
+#ifdef _MSC_VER
+#define alloca _alloca
+#else
#include <malloc.h>
+#endif
#include <sys/stat.h>
diff --git a/src/w32.c b/src/w32.c
index 42546fc8d4..f17e987f43 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -94,7 +94,9 @@ typedef struct _MEMORY_STATUS_EX {
#include <tlhelp32.h>
#include <psapi.h>
+#ifndef _MSC_VER
#include <w32api.h>
+#endif
#if !defined (__MINGW32__) || __W32API_MAJOR_VERSION < 3 || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 15)
/* This either is not in psapi.h or guarded by higher value of
_WIN32_WINNT than what we use. w32api supplied with MinGW 3.15
@@ -1547,7 +1549,12 @@ init_environment (char ** argv)
read-only filesystem, like CD-ROM or a write-protected floppy.
The only way to be really sure is to actually create a file and
see if it succeeds. But I think that's too much to ask. */
+#ifdef _MSC_VER
+ /* MSVC's _access crashes with D_OK. */
+ if (tmp && sys_access (tmp, D_OK) == 0)
+#else
if (tmp && _access (tmp, D_OK) == 0)
+#endif
{
char * var = alloca (strlen (tmp) + 8);
sprintf (var, "TMPDIR=%s", tmp);
diff --git a/src/w32fns.c b/src/w32fns.c
index f7ba1c59e7..6f32442514 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -140,8 +140,8 @@ struct MONITOR_INFO
DWORD dwFlags;
};
-/* Reportedly, VS 6 does not have this in its headers. */
-#if defined (_MSC_VER) && _MSC_VER < 1300
+/* Reportedly, MSVC does not have this in its headers. */
+#ifdef _MSC_VER
DECLARE_HANDLE(HMONITOR);
#endif
@@ -3977,7 +3977,7 @@ x_make_gc (struct frame *f)
/* Handler for signals raised during x_create_frame and
- x_create_top_frame. FRAME is the frame which is partially
+ x_create_tip_frame. FRAME is the frame which is partially
constructed. */
static Lisp_Object
@@ -4135,7 +4135,6 @@ This function is an internal primitive--use `make-frame' instead. */)
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
f->terminal = dpyinfo->terminal;
- f->terminal->reference_count++;
f->output_method = output_w32;
f->output_data.w32 =
@@ -4154,7 +4153,8 @@ This function is an internal primitive--use `make-frame' instead. */)
/* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */
record_unwind_protect (unwind_create_frame, frame);
#if GLYPH_DEBUG
- image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
+ image_cache_refcount =
+ FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
dpyinfo_refcount = dpyinfo->reference_count;
#endif /* GLYPH_DEBUG */
@@ -4287,6 +4287,7 @@ This function is an internal primitive--use `make-frame' instead. */)
x_make_gc (f);
/* Now consider the frame official. */
+ f->terminal->reference_count++;
FRAME_W32_DISPLAY_INFO (f)->reference_count++;
Vframe_list = Fcons (frame, Vframe_list);
@@ -5229,7 +5230,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
from this point on, x_destroy_window might screw up reference
counts etc. */
f->terminal = dpyinfo->terminal;
- f->terminal->reference_count++;
f->output_method = output_w32;
f->output_data.w32 =
(struct w32_output *) xmalloc (sizeof (struct w32_output));
@@ -5239,7 +5239,8 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
f->icon_name = Qnil;
#if GLYPH_DEBUG
- image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
+ image_cache_refcount =
+ FRAME_IMAGE_CACHE ? FRAME_IMAGE_CACHE (f)->refcount : 0;
dpyinfo_refcount = dpyinfo->reference_count;
#endif /* GLYPH_DEBUG */
FRAME_KBOARD (f) = kb;
@@ -5380,15 +5381,16 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
UNGCPRO;
+ /* Now that the frame is official, it counts as a reference to
+ its display. */
+ FRAME_W32_DISPLAY_INFO (f)->reference_count++;
+ f->terminal->reference_count++;
+
/* It is now ok to make the frame official even if we get an error
below. And the frame needs to be on Vframe_list or making it
visible won't work. */
Vframe_list = Fcons (frame, Vframe_list);
- /* Now that the frame is official, it counts as a reference to
- its display. */
- FRAME_W32_DISPLAY_INFO (f)->reference_count++;
-
/* Setting attributes of faces of the tooltip frame from resources
and similar will increment face_change_count, which leads to the
clearing of all current matrices. Since this isn't necessary
diff --git a/src/w32font.c b/src/w32font.c
index 6c1b4d0bc2..26bf4207de 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1292,6 +1292,15 @@ font_matches_spec (DWORD type, NEWTEXTMETRICEX *font,
= font_supported_scripts (&font->ntmFontSig);
if (! memq_no_quit (val, support))
return 0;
+
+ /* Avoid using non-Japanese fonts for Japanese, even
+ if they claim they are capable, due to known
+ breakage in Vista and Windows 7 fonts
+ (bug#6029). */
+ if (EQ (val, Qkana)
+ && (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET
+ || !(font->ntmFontSig.fsCsb[0] & CSB_JAPANESE)))
+ return 0;
}
else
{
@@ -1507,7 +1516,7 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
/* For uniscribe backend, consider only truetype or opentype fonts
that have some unicode coverage. */
if (match_data->opentype_only
- && ((!physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE
+ && ((!(physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE)
&& !(font_type & TRUETYPE_FONTTYPE))
|| !is_unicode))
return 1;
@@ -1568,8 +1577,8 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
the bits for CJK ranges that include those characters. */
else if (EQ (spec_charset, Qunicode_sip))
{
- if (!physical_font->ntmFontSig.fsUsb[1] & 0x02000000
- || !physical_font->ntmFontSig.fsUsb[1] & 0x28000000)
+ if (!(physical_font->ntmFontSig.fsUsb[1] & 0x02000000)
+ || !(physical_font->ntmFontSig.fsUsb[1] & 0x28000000))
return 1;
}
@@ -1577,8 +1586,16 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
/* If registry was specified, ensure it is reported as the same. */
if (!NILP (spec_charset))
- ASET (entity, FONT_REGISTRY_INDEX, spec_charset);
-
+ {
+ /* Avoid using non-Japanese fonts for Japanese, even if they
+ claim they are capable, due to known breakage in Vista
+ and Windows 7 fonts (bug#6029). */
+ if (logical_font->elfLogFont.lfCharSet == SHIFTJIS_CHARSET
+ && !(physical_font->ntmFontSig.fsCsb[0] & CSB_JAPANESE))
+ return 1;
+ else
+ ASET (entity, FONT_REGISTRY_INDEX, spec_charset);
+ }
/* Otherwise if using the uniscribe backend, report ANSI and DEFAULT
fonts as unicode and skip other charsets. */
else if (match_data->opentype_only)
diff --git a/src/w32term.c b/src/w32term.c
index 39f1e245e1..f876cff036 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5690,15 +5690,15 @@ x_make_frame_visible (struct frame *f)
f->output_data.w32->asked_for_visible = 1;
- /* The first of these seems to give more expected behavior, but
- was added as a commented out line in Sept 1997, with the
- second version remaining uncommented. There may have been
- some problem with it that led to it not being enabled,
- so the old version remains commented out below in case we
- decide we need to go back to it [23.0.60 2008-06-09]. */
+ /* According to a report in emacs-devel 2008-06-03, SW_SHOWNORMAL
+ causes unexpected behaviour when unminimizing frames that were
+ previously maximised. But only SW_SHOWNORMAL works properly for
+ frames that were truely hidden (using make-frame-invisible), so
+ we need it to avoid Bug#5482. It seems that async_iconified
+ is only set for minimised windows that are still visible, so
+ use that to determine the appropriate flag to pass ShowWindow. */
my_show_window (f, FRAME_W32_WINDOW (f),
- f->async_iconified ? SW_RESTORE : SW_SHOW);
- /* my_show_window (f, FRAME_W32_WINDOW (f), SW_SHOWNORMAL); */
+ f->async_iconified ? SW_RESTORE : SW_SHOWNORMAL);
}
/* Synchronize to ensure Emacs knows the frame is visible
diff --git a/src/window.c b/src/window.c
index 422073b1bd..605d00b8e0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -159,7 +159,8 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
doc: /* Return t if OBJECT is a live window and nil otherwise.
-A live window is a window that displays a buffer. */)
+A live window is a window that displays a buffer.
+Internal windows and deleted windows are not live. */)
(Lisp_Object object)
{
return WINDOW_LIVE_P (object) ? Qt : Qnil;
@@ -168,7 +169,7 @@ A live window is a window that displays a buffer. */)
/* Frames and windows. */
DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
doc: /* Return the frame that window WINDOW is on.
-WINDOW can be any window and defaults to the selected one. */)
+If WINDOW is omitted or nil, it defaults to the selected window. */)
(Lisp_Object window)
{
return decode_any_window (window)->frame;
@@ -177,9 +178,8 @@ WINDOW can be any window and defaults to the selected one. */)
DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
doc: /* Return the root window of FRAME-OR-WINDOW.
If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
-Else if FRAME-OR-WINDOW denotes any window, return the root window of
-that window's frame. If FRAME-OR-WINDOW denotes a live frame, return
-the root window of that frame. */)
+With a frame argument, return that frame's root window.
+With a window argument, return the root window of that window's frame. */)
(Lisp_Object frame_or_window)
{
Lisp_Object window;
@@ -198,9 +198,8 @@ the root window of that frame. */)
}
DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
- doc: /* Return the window used now for minibuffers.
-If the optional argument FRAME is specified, return the minibuffer window
-used by that frame. */)
+ doc: /* Return the minibuffer window for frame FRAME.
+If FRAME is omitted or nil, it defaults to the selected frame. */)
(Lisp_Object frame)
{
if (NILP (frame))
@@ -212,7 +211,7 @@ used by that frame. */)
DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p,
Swindow_minibuffer_p, 0, 1, 0,
doc: /* Return non-nil if WINDOW is a minibuffer window.
-WINDOW can be any window and defaults to the selected one. */)
+If WINDOW is omitted or nil, it defaults to the selected window. */)
(Lisp_Object window)
{
return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil;
@@ -409,44 +408,48 @@ buffer of the selected window before each command. */)
}
DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
- doc: /* Return the buffer that WINDOW is displaying.
-WINDOW can be any window and defaults to the selected one.
-If WINDOW is an internal window return nil. */)
+ doc: /* Return the buffer displayed in window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
+Return nil for an internal window or a deleted window. */)
(Lisp_Object window)
{
return decode_any_window (window)->buffer;
}
DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
- doc: /* Return WINDOW's parent window.
-WINDOW can be any window and defaults to the selected one.
-Return nil if WINDOW has no parent. */)
+ doc: /* Return the parent window of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
+Return nil for a window with no parent (e.g. a root window). */)
(Lisp_Object window)
{
return decode_any_window (window)->parent;
}
-DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0,
- doc: /* Return WINDOW's topmost child window.
-WINDOW can be any window and defaults to the selected one.
-Return nil if WINDOW is not a vertical combination. */)
+DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0,
+ doc: /* Return the topmost child window of window WINDOW.
+Return nil if WINDOW is a live window (live windows have no children).
+Return nil if WINDOW is an internal window whose children form a
+horizontal combination. */)
(Lisp_Object window)
{
+ CHECK_WINDOW (window);
return decode_any_window (window)->vchild;
}
-DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0,
- doc: /* Return WINDOW's leftmost child window.
-WINDOW can be any window and defaults to the selected one.
-Return nil if WINDOW is not a horizontal combination. */)
+DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0,
+ doc: /* Return the leftmost child window of window WINDOW.
+Return nil if WINDOW is a live window (live windows have no children).
+Return nil if WINDOW is an internal window whose children form a
+vertical combination. */)
(Lisp_Object window)
{
+ CHECK_WINDOW (window);
return decode_any_window (window)->hchild;
}
DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
- doc: /* Return WINDOW's next sibling window.
-WINDOW can be any window and defaults to the selected one.
+ doc: /* Return the next sibling window of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
Return nil if WINDOW has no next sibling. */)
(Lisp_Object window)
{
@@ -454,8 +457,8 @@ Return nil if WINDOW has no next sibling. */)
}
DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
- doc: /* Return WINDOW's previous sibling window.
-WINDOW can be any window and defaults to the selected one.
+ doc: /* Return the previous sibling window of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
Return nil if WINDOW has no previous sibling. */)
(Lisp_Object window)
{
@@ -463,8 +466,8 @@ Return nil if WINDOW has no previous sibling. */)
}
DEFUN ("window-splits", Fwindow_splits, Swindow_splits, 0, 1, 0,
- doc: /* Return splits status for WINDOW.
-WINDOW can be any window and defaults to the selected one.
+ doc: /* Return splits status for the window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
If the value returned by this function is nil and WINDOW is resized, the
corresponding space is preferably taken from (or given to) WINDOW's
@@ -479,9 +482,8 @@ WINDOW may resize all windows in the same combination. */)
}
DEFUN ("set-window-splits", Fset_window_splits, Sset_window_splits, 2, 2, 0,
- doc: /* Set splits status of WINDOW to STATUS.
-WINDOW can be any window and defaults to the selected one. Return
-STATUS.
+ doc: /* Set splits status of window WINDOW to STATUS.
+If WINDOW is omitted or nil, it defaults to the selected window.
If STATUS is nil and WINDOW is later resized, the corresponding space is
preferably taken from (or given to) WINDOW's right sibling. When WINDOW
@@ -499,8 +501,8 @@ windows in the same combination. */)
}
DEFUN ("window-nest", Fwindow_nest, Swindow_nest, 0, 1, 0,
- doc: /* Return nest status of WINDOW.
-WINDOW can be any window and defaults to the selected one.
+ doc: /* Return nest status of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
If the return value is nil, subwindows of WINDOW can be recombined with
WINDOW's siblings. A return value of non-nil means that subwindows of
@@ -511,9 +513,8 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */)
}
DEFUN ("set-window-nest", Fset_window_nest, Sset_window_nest, 2, 2, 0,
- doc: /* Set nest status of WINDOW to STATUS.
-WINDOW can be any window and defaults to the selected one. Return
-STATUS.
+ doc: /* Set nest status of window WINDOW to STATUS; return STATUS.
+If WINDOW is omitted or nil, it defaults to the selected window.
If STATUS is nil, subwindows of WINDOW can be recombined with WINDOW's
siblings. STATUS non-nil means that subwindows of WINDOW are never
@@ -528,22 +529,24 @@ siblings. STATUS non-nil means that subwindows of WINDOW are never
}
DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
- doc: /* Return WINDOW's use time.
-WINDOW defaults to the selected window. The window with the highest use
-time is the most recently selected one. The window with the lowest use
-time is the least recently selected one. */)
+ doc: /* Return the use time of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
+The window with the highest use time is the most recently selected
+one. The window with the lowest use time is the least recently
+selected one. */)
(Lisp_Object window)
{
return decode_window (window)->use_time;
}
DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0,
- doc: /* Return the total number of lines of WINDOW.
-WINDOW can be any window and defaults to the selected one. The return
-value includes WINDOW's mode line and header line, if any. If WINDOW
-is internal, the return value is the sum of the total number of lines
-of WINDOW's child windows if these are vertically combined and the
-height of WINDOW's first child otherwise.
+ doc: /* Return the total number of lines of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
+
+The return value includes WINDOW's mode line and header line, if any.
+If WINDOW is internal, the return value is the sum of the total number
+of lines of WINDOW's child windows if these are vertically combined
+and the height of WINDOW's first child otherwise.
Optional argument HORIZONTAL non-nil means return the total number of
columns of WINDOW. In this case the return value includes any vertical
@@ -560,17 +563,17 @@ first child otherwise. */)
}
DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
- doc: /* Return new total size of WINDOW.
-WINDOW defaults to the selected window. */)
+ doc: /* Return the new total size of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window. */)
(Lisp_Object window)
{
return decode_any_window (window)->new_total;
}
DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
- doc: /* Return normal height of WINDOW.
-WINDOW can be any window and defaults to the selected one. Optional
-argument HORIZONTAL non-nil means return normal width of WINDOW. */)
+ doc: /* Return the normal height of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window.
+If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
(Lisp_Object window, Lisp_Object horizontal)
{
if (NILP (horizontal))
@@ -580,24 +583,24 @@ argument HORIZONTAL non-nil means return normal width of WINDOW. */)
}
DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
- doc: /* Return new normal size of WINDOW.
-WINDOW can be any window and defaults to the selected one. */)
+ doc: /* Return new normal size of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window. */)
(Lisp_Object window)
{
return decode_any_window (window)->new_normal;
}
DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
- doc: /* Return left column of WINDOW.
-WINDOW can be any window and defaults to the selected one. */)
+ doc: /* Return left column of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window. */)
(Lisp_Object window)
{
return decode_any_window (window)->left_col;
}
DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
- doc: /* Return top line of WINDOW.
-WINDOW can be any window and defaults to the selected one. */)
+ doc: /* Return top line of window WINDOW.
+If WINDOW is omitted or nil, it defaults to the selected window. */)
(Lisp_Object window)
{
return decode_any_window (window)->top_line;
@@ -653,16 +656,25 @@ window_body_cols (struct window *w)
}
DEFUN ("window-body-size", Fwindow_body_size, Swindow_body_size, 0, 2, 0,
- doc: /* Return the number of lines of WINDOW's body.
-WINDOW must be a live window and defaults to the selected one. The
-return value does not include WINDOW's mode line and header line, if
-any.
-
-Optional argument HORIZONTAL non-nil means return the number of columns
-of WINDOW's body. In this case, the return value does not include any
-vertical dividers or scroll bars owned by WINDOW. On a window-system
-the return value does not include the number of columns used for
-WINDOW's fringes or display margins either. */)
+ doc: /* Return the number of lines or columns of WINDOW's body.
+WINDOW must be a live window and defaults to the selected one.
+
+If the optional argument HORIZONTAL is omitted or nil, the function
+returns the number of WINDOW's lines, excluding the mode line and
+header line, if any.
+
+If HORIZONTAL is non-nil, the function returns the number of columns
+excluding any vertical dividers or scroll bars owned by WINDOW. On a
+window-system the return value also excludes the number of columns
+used for WINDOW's fringes or display margins.
+
+Note that the return value is measured in canonical units, i.e. for
+the default frame's face. If the window shows some characters with
+non-default face, e.g., if the font of some characters is larger or
+smaller than the default font, the value returned by this function
+will not match the actual number of lines or characters per line
+shown in the window. To get the actual number of columns and lines,
+use `posn-at-point'. */)
(Lisp_Object window, Lisp_Object horizontal)
{
struct window *w = decode_any_window (window);
@@ -2302,7 +2314,7 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames)
DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0,
doc: /* Return a list of windows on FRAME, starting with WINDOW.
FRAME nil or omitted means use the selected frame.
-WINDOW nil or omitted means use the selected window.
+WINDOW nil or omitted means use the window selected within FRAME.
MINIBUF t means include the minibuffer window, even if it isn't active.
MINIBUF nil or omitted means include the minibuffer window only
if it's active.
@@ -5993,7 +6005,7 @@ means no margin. */)
DEFUN ("window-margins", Fwindow_margins, Swindow_margins,
0, 1, 0,
doc: /* Get width of marginal areas of window WINDOW.
-If WINDOW is omitted or nil, use the currently selected window.
+If WINDOW is omitted or nil, it defaults to the selected window.
Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH).
If a marginal area does not exist, its width will be returned
as nil. */)
@@ -6057,7 +6069,7 @@ display marginal areas and the text area. */)
DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes,
0, 1, 0,
doc: /* Get width of fringes of window WINDOW.
-If WINDOW is omitted or nil, use the currently selected window.
+If WINDOW is omitted or nil, it defaults to the selected window.
Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
(Lisp_Object window)
{
@@ -6126,7 +6138,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars,
0, 1, 0,
doc: /* Get width and type of scroll bars of window WINDOW.
-If WINDOW is omitted or nil, use the currently selected window.
+If WINDOW is omitted or nil, it defaults to the selected window.
Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE).
If WIDTH is nil or TYPE is t, the window is using the frame's corresponding
value. */)
@@ -6149,7 +6161,7 @@ value. */)
DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
doc: /* Return the amount by which WINDOW is scrolled vertically.
-Use the selected window if WINDOW is nil or omitted.
+If WINDOW is omitted or nil, it defaults to the selected window.
Normally, value is a multiple of the canonical character height of WINDOW;
optional second arg PIXELS-P means value is measured in pixels. */)
(Lisp_Object window, Lisp_Object pixels_p)
diff --git a/src/xdisp.c b/src/xdisp.c
index 257e4ad428..197fb74859 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2763,9 +2763,13 @@ init_iterator (struct it *it, struct window *w,
/* Do we need to reorder bidirectional text? Not if this is a
unibyte buffer: by definition, none of the single-byte
characters are strong R2L, so no reordering is needed. And
- bidi.c doesn't support unibyte buffers anyway. */
+ bidi.c doesn't support unibyte buffers anyway. Also, don't
+ reorder while we are loading loadup.el, since the tables of
+ character properties needed for reordering are not yet
+ available. */
it->bidi_p =
- !NILP (BVAR (current_buffer, bidi_display_reordering))
+ NILP (Vpurify_flag)
+ && !NILP (BVAR (current_buffer, bidi_display_reordering))
&& it->multibyte_p;
/* If we are to reorder bidirectional text, init the bidi
@@ -6136,8 +6140,12 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
it->multibyte_p = multibyte > 0;
/* Bidirectional reordering of strings is controlled by the default
- value of bidi-display-reordering. */
- it->bidi_p = !NILP (BVAR (&buffer_defaults, bidi_display_reordering));
+ value of bidi-display-reordering. Don't try to reorder while
+ loading loadup.el, as the necessary character property tables are
+ not yet available. */
+ it->bidi_p =
+ NILP (Vpurify_flag)
+ && !NILP (BVAR (&buffer_defaults, bidi_display_reordering));
if (s == NULL)
{
@@ -19460,7 +19468,10 @@ See also `bidi-paragraph-direction'. */)
}
if (NILP (BVAR (buf, bidi_display_reordering))
- || NILP (BVAR (buf, enable_multibyte_characters)))
+ || NILP (BVAR (buf, enable_multibyte_characters))
+ /* When we are loading loadup.el, the character property tables
+ needed for bidi iteration are not yet available. */
+ || !NILP (Vpurify_flag))
return Qleft_to_right;
else if (!NILP (BVAR (buf, bidi_paragraph_direction)))
return BVAR (buf, bidi_paragraph_direction);
@@ -27152,8 +27163,12 @@ note_mouse_highlight (struct frame *f, int x, int y)
}
mouse_face_from_buffer_pos (window, hlinfo, pos,
- XFASTINT (before),
- XFASTINT (after),
+ NILP (before)
+ ? 1
+ : XFASTINT (before),
+ NILP (after)
+ ? BUF_Z (XBUFFER (buffer))
+ : XFASTINT (after),
before_string, after_string,
disp_string);
cursor = No_Cursor;
diff --git a/src/xfns.c b/src/xfns.c
index ac030582ff..49c4c774ca 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2914,7 +2914,7 @@ x_free_gcs (struct frame *f)
/* Handler for signals raised during x_create_frame and
- x_create_top_frame. FRAME is the frame which is partially
+ x_create_tip_frame. FRAME is the frame which is partially
constructed. */
static Lisp_Object
@@ -3138,7 +3138,6 @@ This function is an internal primitive--use `make-frame' instead. */)
FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
f->terminal = dpyinfo->terminal;
- f->terminal->reference_count++;
f->output_method = output_x_window;
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. */)
"scrollBarBackground",
"ScrollBarBackground", 0);
+#if GLYPH_DEBUG
+ image_cache_refcount =
+ FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
+ dpyinfo_refcount = dpyinfo->reference_count;
+#endif /* GLYPH_DEBUG */
+
/* Init faces before x_default_parameter is called for scroll-bar
parameters because that function calls x_set_scroll_bar_width,
which calls change_frame_size, which calls Fset_window_buffer,
@@ -3316,11 +3321,6 @@ This function is an internal primitive--use `make-frame' instead. */)
happen. */
init_frame_faces (f);
-#if GLYPH_DEBUG
- image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
- dpyinfo_refcount = dpyinfo->reference_count;
-#endif /* GLYPH_DEBUG */
-
/* The X resources controlling the menu-bar and tool-bar are
processed specially at startup, and reflected in the mode
variables; ignore them here. */
@@ -3364,6 +3364,7 @@ This function is an internal primitive--use `make-frame' instead. */)
x_make_gc (f);
/* Now consider the frame official. */
+ f->terminal->reference_count++;
FRAME_X_DISPLAY_INFO (f)->reference_count++;
Vframe_list = Fcons (frame, Vframe_list);
@@ -4594,7 +4595,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
record_unwind_protect (unwind_create_tip_frame, frame);
f->terminal = dpyinfo->terminal;
- f->terminal->reference_count++;
/* By setting the output method, we're essentially saying that
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,
x_default_parameter (f, parms, Qborder_color, build_string ("black"),
"borderColor", "BorderColor", RES_TYPE_STRING);
+#if GLYPH_DEBUG
+ image_cache_refcount =
+ FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
+ dpyinfo_refcount = dpyinfo->reference_count;
+#endif /* GLYPH_DEBUG */
+
/* Init faces before x_default_parameter is called for scroll-bar
parameters because that function calls x_set_scroll_bar_width,
which calls change_frame_size, which calls Fset_window_buffer,
@@ -4724,11 +4730,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
happen. */
init_frame_faces (f);
-#if GLYPH_DEBUG
- image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount;
- dpyinfo_refcount = dpyinfo->reference_count;
-#endif /* GLYPH_DEBUG */
-
f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
x_figure_window_size (f, parms, 0);
@@ -4834,14 +4835,16 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
UNGCPRO;
+ /* Now that the frame will be official, it counts as a reference to
+ its display and terminal. */
+ FRAME_X_DISPLAY_INFO (f)->reference_count++;
+ f->terminal->reference_count++;
+
/* It is now ok to make the frame official even if we get an error
below. And the frame needs to be on Vframe_list or making it
visible won't work. */
Vframe_list = Fcons (frame, Vframe_list);
- /* Now that the frame is official, it counts as a reference to
- its display. */
- FRAME_X_DISPLAY_INFO (f)->reference_count++;
/* Setting attributes of faces of the tooltip frame from resources
and similar will increment face_change_count, which leads to the
diff --git a/src/xmenu.c b/src/xmenu.c
index 7fcd2ad372..0dd652b566 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,
#endif /* not USE_GTK */
+static Lisp_Object
+cleanup_widget_value_tree (Lisp_Object arg)
+{
+ struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
+ widget_value *wv = p->pointer;
+
+ free_menubar_widget_value_tree (wv);
+
+ return Qnil;
+}
+
Lisp_Object
xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
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,
int first_pane;
+ int specpdl_count = SPECPDL_INDEX ();
+
if (! FRAME_X_P (f))
abort ();
@@ -1812,11 +1825,15 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
/* No selection has been chosen yet. */
menu_item_selection = 0;
+ /* Make sure to free the widget_value objects we used to specify the
+ contents even with longjmp. */
+ record_unwind_protect (cleanup_widget_value_tree,
+ make_save_value (first_wv, 0));
+
/* Actually create and show the menu until popped down. */
create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp);
- /* Free the widget_value objects we used to specify the contents. */
- free_menubar_widget_value_tree (first_wv);
+ unbind_to (specpdl_count, Qnil);
/* Find the selected item, and its pane, to return
the proper value. */
@@ -2003,6 +2020,8 @@ xdialog_show (FRAME_PTR f,
/* 1 means we've seen the boundary between left-hand elts and right-hand. */
int boundary_seen = 0;
+ int specpdl_count = SPECPDL_INDEX ();
+
if (! FRAME_X_P (f))
abort ();
@@ -2116,11 +2135,15 @@ xdialog_show (FRAME_PTR f,
/* No selection has been chosen yet. */
menu_item_selection = 0;
+ /* Make sure to free the widget_value objects we used to specify the
+ contents even with longjmp. */
+ record_unwind_protect (cleanup_widget_value_tree,
+ make_save_value (first_wv, 0));
+
/* Actually create and show the dialog. */
create_and_show_dialog (f, first_wv);
- /* Free the widget_value objects we used to specify the contents. */
- free_menubar_widget_value_tree (first_wv);
+ unbind_to (specpdl_count, Qnil);
/* Find the selected item, and its pane, to return
the proper value. */