(main): When relative file names are given as argument,
[bpt/emacs.git] / lispref / frames.texi
index 909c2bc..c2c4888 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002
-@c   Free Software Foundation, Inc. 
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002, 2004
+@c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/frames
 @node Frames, Positions, Windows, Top
@@ -56,7 +56,7 @@ The frame is displayed on an MS-DOS terminal.
 * Input Focus::                        Specifying the selected frame.
 * Visibility of Frames::       Frames may be visible or invisible, or icons.
 * Raising and Lowering::       Raising a frame makes it hide other windows;
-                                 lowering it makes the others hide them.
+                                 lowering it makes the others hide it.
 * Frame Configurations::       Saving the state of all frames.
 * Mouse Tracking::             Getting events that say when the mouse moves.
 * Mouse Position::             Asking where the mouse is, or moving it.
@@ -70,7 +70,7 @@ The frame is displayed on an MS-DOS terminal.
 * Display Feature Testing::     Determining the features of a terminal.
 @end menu
 
-  @xref{Display}, for information about the related topic of 
+  @xref{Display}, for information about the related topic of
 controlling Emacs redisplay.
 
 @node Creating Frames
@@ -79,8 +79,9 @@ controlling Emacs redisplay.
 To create a new frame, call the function @code{make-frame}.
 
 @defun make-frame &optional alist
-This function creates a new frame.  If you are using a supported window
-system, it makes a window frame; otherwise, it makes a terminal frame.
+This function creates and returns a new frame, displaying the current
+buffer.  If you are using a supported window system, it makes a window
+frame; otherwise, it makes a terminal frame.
 
 The argument is an alist specifying frame parameters.  Any parameters
 not mentioned in @var{alist} default according to the value of the
@@ -91,6 +92,12 @@ your system.
 The set of possible parameters depends in principle on what kind of
 window system Emacs uses to display its frames.  @xref{Window Frame
 Parameters}, for documentation of individual parameters you can specify.
+
+This function itself does not make the new frame the selected frame.
+@xref{Input Focus}.  The previously selected frame remains selected.
+However, the window system may select the new frame for its own reasons,
+for instance if the frame appears under the mouse pointer and your
+setup is for focus to follow the pointer.
 @end defun
 
 @defvar before-make-frame-hook
@@ -138,9 +145,10 @@ names that they share a single keyboard, and it treats them as a single
 terminal.
 
 @deffn Command make-frame-on-display display &optional parameters
-This creates a new frame on display @var{display}, taking the other
-frame parameters from @var{parameters}.  Aside from the @var{display}
-argument, it is like @code{make-frame} (@pxref{Creating Frames}).
+This creates and returns a new frame on display @var{display}, taking
+the other frame parameters from @var{parameters}.  Aside from the
+@var{display} argument, it is like @code{make-frame} (@pxref{Creating
+Frames}).
 @end deffn
 
 @defun x-display-list
@@ -165,7 +173,7 @@ look like:
 "*BorderWidth: 3\n*InternalBorder: 2\n"
 @end example
 
-@xref{Resources}.
+@xref{X Resources,, X Resources, emacs, The GNU Emacs Manual}.
 
 If @var{must-succeed} is non-@code{nil}, failure to open the connection
 terminates Emacs.  Otherwise, it is an ordinary Lisp error.
@@ -207,14 +215,16 @@ frame.
 
 @defun frame-parameter frame parameter
 @tindex frame-parameter
-This function returns the value of the parameter named @var{parameter}
-of @var{frame}.  If @var{frame} is @code{nil}, it returns the
-selected  frame's parameter.
+This function returns the value of the parameter @var{parameter} (a
+symbol) of @var{frame}.  If @var{frame} is @code{nil}, it returns the
+selected frame's parameter.  If @var{frame} has no setting for
+@var{parameter}, this function returns @code{nil}.
 @end defun
 
-@defun frame-parameters frame
+@defun frame-parameters &optional frame
 The function @code{frame-parameters} returns an alist listing all the
-parameters of @var{frame} and their values.
+parameters of @var{frame} and their values.  If @var{frame} is
+@code{nil} or omitted, this returns the selected frame's parameters
 @end defun
 
 @defun modify-frame-parameters frame alist
@@ -222,7 +232,15 @@ This function alters the parameters of frame @var{frame} based on the
 elements of @var{alist}.  Each element of @var{alist} has the form
 @code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming a
 parameter.  If you don't mention a parameter in @var{alist}, its value
-doesn't change.
+doesn't change.  If @var{frame} is @code{nil}, it defaults to the selected
+frame.
+@end defun
+
+@defun modify-all-frames-parameters alist
+This function alters the frame parameters of all existing frames
+according to @var{alist}, then modifies @code{default-frame-alist}
+(and, if necessary, @code{initial-frame-alist}) to apply the same
+parameter values to frames that will be created henceforth.
 @end defun
 
 @node Initial Parameters
@@ -276,9 +294,12 @@ This is an alist specifying default values of frame parameters for all
 Emacs frames---the first frame, and subsequent frames.  When using the X
 Window System, you can get the same results by means of X resources
 in many cases.
+
+Setting this variable does not affect existing frames.
 @end defvar
 
-See also @code{special-display-frame-alist}, in @ref{Choosing Window}.
+See also @code{special-display-frame-alist}.  @xref{Definition of
+special-display-frame-alist}.
 
 If you use options that specify window appearance when you invoke Emacs,
 they take effect by adding elements to @code{default-frame-alist}.  One
@@ -359,6 +380,10 @@ The screen position of the left edge @emph{of the frame's icon}, in
 pixels, counting from the left edge of the screen.  This takes effect if
 and when the frame is iconified.
 
+If you specify a value for this parameter, then you must also specify
+a value for @code{icon-top} and vice versa.  The window manager may
+ignore these two parameters.
+
 @item icon-top
 The screen position of the top edge @emph{of the frame's icon}, in
 pixels, counting from the top edge of the screen.  This takes effect if
@@ -423,13 +448,6 @@ considers that buffer.
 A list of buffers that have been selected in this frame,
 ordered most-recently-selected first.
 
-@item font
-The name of the font for displaying text in the frame.  This is a
-string, either a valid font name for your system or the name of an Emacs
-fontset (@pxref{Fontsets}).  Changing this frame parameter on a frame
-also changes the font-related attributes of the default face on that
-frame.
-
 @item auto-raise
 Whether selecting the frame raises it (non-@code{nil} means yes).
 
@@ -447,7 +465,8 @@ Whether the frame has scroll bars for horizontal scrolling
 implemented.)
 
 @item scroll-bar-width
-The width of the vertical scroll bar, in pixels.
+The width of the vertical scroll bar, in pixels,
+or @code{nil} meaning to use the default width.
 
 @item icon-type
 The type of icon to use for this frame when it is iconified.  If the
@@ -459,33 +478,10 @@ picture of a gnu); @code{nil} specifies a text icon.
 The name to use in the icon for this frame, when and if the icon
 appears.  If this is @code{nil}, the frame's title is used.
 
-@item foreground-color
-The color to use for the image of a character.  This is a string; the
-window system defines the meaningful color names.  Changing this
-parameter is equivalent to changing the foreground color of the face
-@code{default} on the frame in question.
-
-@item background-color
-The color to use for the background of characters.  Changing this
-parameter is equivalent to changing the foreground color of the face
-@code{default} on the frame in question.
-
 @item background-mode
 This parameter is either @code{dark} or @code{light}, according
 to whether the background color is a light one or a dark one.
 
-@item mouse-color
-The color for the mouse pointer.  Changing this parameter is equivalent
-to changing the background color of face @code{mouse}.
-
-@item cursor-color
-The color for the cursor that shows point.  Changing this parameter is
-equivalent to changing the background color of face @code{cursor}.
-
-@item border-color
-The color for the border of the frame.  Changing this parameter is
-equivalent to changing the background color of face @code{border}.
-
 @item tty-color-mode
 @cindex standard colors for character terminals
 This parameter overrides the terminal's color support as given by the
@@ -500,16 +496,6 @@ value is a symbol, that symbol is looked up in the alist
 @code{tty-color-mode-alist}, and if found, the associated number is
 used as the color support mode.
 
-@item scroll-bar-foreground
-If non-@code{nil}, the color for the foreground of scroll bars.
-Changing this parameter is equivalent to setting the foreground color of
-face @code{scroll-bar}.
-
-@item scroll-bar-background
-If non-@code{nil}, the color for the background of scroll bars.
-Changing this parameter is equivalent to setting the background color of
-face @code{scroll-bar}.
-
 @item display-type
 This parameter describes the range of possible colors that can be used
 in this frame.  Its value is @code{color}, @code{grayscale} or
@@ -537,9 +523,8 @@ Display a horizontal bar @var{width} pixels high.
 
 @vindex cursor-type
 The buffer-local variable @code{cursor-type} overrides the value of
-the @code{cursor-type} frame parameter, and can in addition have
-values @code{t} (use the cursor specified for the frame) and
-@code{nil} (don't display a cursor).
+the @code{cursor-type} frame parameter, but if it is @code{t}, that
+means to use the cursor specified for the frame.
 
 @item border-width
 The width in pixels of the window border.
@@ -547,6 +532,22 @@ The width in pixels of the window border.
 @item internal-border-width
 The distance in pixels between text and border.
 
+@item left-fringe
+@itemx right-fringe
+The default width of the left and right fringes of windows in this
+frame (@pxref{Fringes}).  If either of these is zero, that effectively
+removes the corresponding fringe.  A value of @code{nil} stands for
+the standard fringe width, which is the width needed to display the
+fringe bitmaps.
+
+The combined fringe widths must add up to an integral number of
+columns, so the actual default fringe widths for the frame may be
+larger than the specified values.  The extra width needed to reach an
+acceptable total is distributed evenly between the left and right
+fringe.  However, you can force one fringe or the other to a precise
+width by specifying that width as a negative integer.  If both widths are
+negative, only the left fringe gets the specified width.
+
 @item unsplittable
 If non-@code{nil}, this frame's window is never split automatically.
 
@@ -556,10 +557,15 @@ The state of visibility of the frame.  There are three possibilities:
 iconified.  @xref{Visibility of Frames}.
 
 @item menu-bar-lines
-The number of lines to allocate at the top of the frame for a menu bar.
-The default is 1.  @xref{Menu Bar}.  (In Emacs versions that use the X
-toolkit, there is only one menu bar line; all that matters about the
-number you specify is whether it is greater than zero.)
+The number of lines to allocate at the top of the frame for a menu
+bar.  The default is 1.  A value of @code{nil} means don't display a
+menu bar.  @xref{Menu Bar}.  (The X toolkit and GTK allow at most one
+menu bar line; they treat larger values as 1.)
+
+@item tool-bar-lines
+The number of lines to use for the tool bar.  A value of @code{nil}
+means don't display a tool bar.  (GTK allows at most one tool bar line;
+it treats larger values as 1.)
 
 @item screen-gamma
 @cindex gamma correction
@@ -572,7 +578,7 @@ Emacs, and in X windows generally, are calibrated to display properly
 on a monitor with that gamma value.  If you specify 2.2 for
 @code{screen-gamma}, that means no correction is needed.  Other values
 request correction, designed to make the corrected colors appear on
-your screen they way they would have appeared without correction on an
+your screen the way they would have appeared without correction on an
 ordinary monitor with a gamma value of 2.2.
 
 If your monitor displays colors too light, you should specify a
@@ -580,12 +586,14 @@ If your monitor displays colors too light, you should specify a
 that makes colors darker.  A screen gamma value of 1.5 may give good
 results for LCD color displays.
 
-@item tool-bar-lines
-The number of lines to use for the toolbar.  A value of @code{nil} means
-don't display a tool bar.
-
 @item line-spacing
-Additional space put below text lines in pixels (a positive integer).
+Additional space put below text lines, in pixels (a positive integer)
+
+@item wait-for-wm
+If non-@code{nil}, tell Xt to wait for the window manager to confirm
+geometry changes.  Some window managers, including versions of Fvwm2
+and KDE, fail to confirm, so Xt hangs.  Set this to @code{nil} to
+prevent hanging with those window managers.
 
 @ignore
 @item parent-id
@@ -611,6 +619,47 @@ in this variable do not take effect immediately, because the variable
 is examined only when you specify a cursor type for a frame.
 @end defvar
 
+These frame parameters are semi-obsolete in that they are automatically
+equivalent to particular face attributes of particular faces.
+
+@table @code
+@item font
+The name of the font for displaying text in the frame.  This is a
+string, either a valid font name for your system or the name of an Emacs
+fontset (@pxref{Fontsets}).  It is equivalent to the @code{font}
+attribute of the @code{default} face.
+
+@item foreground-color
+The color to use for the image of a character.  It is equivalent to
+the @code{:foreground} attribute of the @code{default} face.
+
+@item background-color
+The color to use for the background of characters.  It is equivalent to
+the @code{:background} attribute of the @code{default} face.
+
+@item mouse-color
+The color for the mouse pointer.  It is equivalent to the @code{:background}
+attribute of the @code{mouse} face.
+
+@item cursor-color
+The color for the cursor that shows point.  It is equivalent to the
+@code{:background} attribute of the @code{cursor} face.
+
+@item border-color
+The color for the border of the frame.  It is equivalent to the
+@code{:background} attribute of the @code{border} face.
+
+@item scroll-bar-foreground
+If non-@code{nil}, the color for the foreground of scroll bars.  It is
+equivalent to the @code{:foreground} attribute of the
+@code{scroll-bar} face.
+
+@item scroll-bar-background
+If non-@code{nil}, the color for the background of scroll bars.  It is
+equivalent to the @code{:background} attribute of the
+@code{scroll-bar} face.
+@end table
+
 @node Size and Position
 @subsection Frame Size And Position
 @cindex size of frame
@@ -784,6 +833,10 @@ there are two or more frames (not counting minibuffer-only frames or
 invisible frames).  The default value of @code{frame-title-format} uses
 @code{multiple-frames} so as to put the buffer name in the frame title
 only when there is more than one frame.
+
+The value of this variable is not guaranteed to be accurate except
+while processing @code{frame-title-format} or
+@code{icon-title-format}.
 @end defvar
 
 @node Deleting Frames
@@ -792,16 +845,14 @@ only when there is more than one frame.
 
 Frames remain potentially visible until you explicitly @dfn{delete}
 them.  A deleted frame cannot appear on the screen, but continues to
-exist as a Lisp object until there are no references to it.  There is no
-way to cancel the deletion of a frame aside from restoring a saved frame
-configuration (@pxref{Frame Configurations}); this is similar to the
-way windows behave.
+exist as a Lisp object until there are no references to it.
 
 @deffn Command delete-frame &optional frame force
-@vindex delete-frame-hook
-This function deletes the frame @var{frame} after running the hook
-@code{delete-frame-hook}.  By default, @var{frame} is the selected
-frame.
+@vindex delete-frame-functions
+This function deletes the frame @var{frame}.  Unless @var{frame} is a
+tooltip, it first runs the hook @code{delete-frame-functions} (each
+function gets one argument, @var{frame}).  By default, @var{frame} is
+the selected frame.
 
 A frame cannot be deleted if its minibuffer is used by other frames.
 Normally, you cannot delete a frame if all other frames are invisible,
@@ -810,7 +861,8 @@ but if the @var{force} is non-@code{nil}, then you are allowed to do so.
 
 @defun frame-live-p frame
 The function @code{frame-live-p} returns non-@code{nil} if the frame
-@var{frame} has not been deleted.
+@var{frame} has not been deleted.  The possible non-@code{nil} return
+values are like those of @code{framep}.  @xref{Frames}.
 @end defun
 
   Some window managers provide a command to delete a window.  These work
@@ -884,8 +936,9 @@ upper left corner, down and to the right, until it reaches the window at
 the lower right corner (always the minibuffer window, if the frame has
 one), and then it moves back to the top.  @xref{Cyclic Window Ordering}.
 
-@defun frame-first-window frame
+@defun frame-first-window &optional frame
 This returns the topmost, leftmost window of frame @var{frame}.
+If omitted or @code{nil}, @var{frame} defaults to the selected frame.
 @end defun
 
 At any time, exactly one window on any frame is @dfn{selected within the
@@ -893,23 +946,32 @@ frame}.  The significance of this designation is that selecting the
 frame also selects this window.  You can get the frame's current
 selected window with @code{frame-selected-window}.
 
-@defun frame-selected-window frame
-This function returns the window on @var{frame} that is selected within
-@var{frame}.
+@defun frame-selected-window  &optional frame
+This function returns the window on @var{frame} that is selected
+within @var{frame}.  If omitted or @code{nil}, @var{frame} defaults to
+the selected frame.
+@end defun
+
+@defun set-frame-selected-window frame window
+This sets the selected window of frame @var{frame} to @var{window}.
+If @var{frame} is @code{nil}, it operates on the selected frame.  If
+@var{frame} is the selected frame, this makes @var{window} the
+selected window.  This function returns @var{window}.
 @end defun
 
   Conversely, selecting a window for Emacs with @code{select-window} also
 makes that window selected within its frame.  @xref{Selecting Windows}.
 
   Another function that (usually) returns one of the windows in a given
-frame is @code{minibuffer-window}.  @xref{Minibuffer Misc}.
+frame is @code{minibuffer-window}.  @xref{Definition of minibuffer-window}.
 
 @node Minibuffers and Frames
 @section Minibuffers and Frames
 
 Normally, each frame has its own minibuffer window at the bottom, which
 is used whenever that frame is selected.  If the frame has a minibuffer,
-you can get it with @code{minibuffer-window} (@pxref{Minibuffer Misc}).
+you can get it with @code{minibuffer-window} (@pxref{Definition of
+minibuffer-window}).
 
 However, you can also create a frame with no minibuffer.  Such a frame
 must use the minibuffer window of some other frame.  When you create the
@@ -924,8 +986,9 @@ when you enter the minibuffer.  If so, set the variable
 
 @defvar default-minibuffer-frame
 This variable specifies the frame to use for the minibuffer window, by
-default.  It is always local to the current terminal and cannot be
-buffer-local.  @xref{Multiple Displays}.
+default.  It does not affect existing frames.  It is always local to
+the current terminal and cannot be buffer-local.  @xref{Multiple
+Displays}.
 @end defvar
 
 @node Input Focus
@@ -954,28 +1017,43 @@ This function returns the selected frame.
 Some window systems and window managers direct keyboard input to the
 window object that the mouse is in; others require explicit clicks or
 commands to @dfn{shift the focus} to various window objects.  Either
-way, Emacs automatically keeps track of which frame has the focus.
+way, Emacs automatically keeps track of which frame has the focus.  To
+switch to a different frame from a Lisp function, call
+@code{select-frame-set-input-focus}.
 
 Lisp programs can also switch frames ``temporarily'' by calling the
 function @code{select-frame}.  This does not alter the window system's
 concept of focus; rather, it escapes from the window manager's control
 until that control is somehow reasserted.
 
-When using a text-only terminal, only the selected terminal frame is
-actually displayed on the terminal.  @code{switch-frame} is the only way
-to switch frames, and the change lasts until overridden by a subsequent
-call to @code{switch-frame}.  Each terminal screen except for the
-initial one has a number, and the number of the selected frame appears
-in the mode line before the buffer name (@pxref{Mode Line Variables}).
+When using a text-only terminal, only one frame can be displayed at a
+time on the terminal, so after a call to @code{select-frame}, the next
+redisplay actually displays the newly selected frame.  This frame
+remains selected until a subsequent call to @code{select-frame} or
+@code{select-frame-set-input-focus}.  Each terminal frame has a number
+which appears in the mode line before the buffer name (@pxref{Mode
+Line Variables}).
+
+@defun select-frame-set-input-focus frame
+This function makes @var{frame} the selected frame, raises it (should
+it happen to be obscured by other frames) and tries to give it the X
+server's focus.  On a text-only terminal, the next redisplay displays
+the new frame on the entire terminal screen.  The return value of this
+function is not significant.
+@end defun
 
 @c ??? This is not yet implemented properly.
 @defun select-frame frame
 This function selects frame @var{frame}, temporarily disregarding the
 focus of the X server if any.  The selection of @var{frame} lasts until
 the next time the user does something to select a different frame, or
-until the next time this function is called.  The specified @var{frame}
+until the next time this function is called.  (If you are using a
+window system, the previously selected frame may be restored as the
+selected frame after return to the command loop, because it still may
+have the window system's input focus.)  The specified @var{frame}
 becomes the selected frame, as explained above, and the terminal that
-@var{frame} is on becomes the selected terminal.
+@var{frame} is on becomes the selected terminal.  This function
+returns @var{frame}, or @code{nil} if @var{frame} has been deleted.
 
 In general, you should never use @code{select-frame} in a way that could
 switch to a different terminal without switching back when you're done.
@@ -994,14 +1072,14 @@ Focus events normally do their job by invoking this command.
 Don't call it for any other reason.
 @end deffn
 
-@defun redirect-frame-focus frame focus-frame
+@defun redirect-frame-focus frame &optional focus-frame
 This function redirects focus from @var{frame} to @var{focus-frame}.
 This means that @var{focus-frame} will receive subsequent keystrokes and
 events intended for @var{frame}.  After such an event, the value of
 @code{last-event-frame} will be @var{focus-frame}.  Also, switch-frame
 events specifying @var{frame} will instead select @var{focus-frame}.
 
-If @var{focus-frame} is @code{nil}, that cancels any existing
+If @var{focus-frame} is omitted or @code{nil}, that cancels any existing
 redirection for @var{frame}, which therefore once again receives its own
 events.
 
@@ -1053,9 +1131,12 @@ This function makes frame @var{frame} visible.  If you omit @var{frame},
 it makes the selected frame visible.
 @end deffn
 
-@deffn Command make-frame-invisible &optional frame
+@deffn Command make-frame-invisible &optional frame force
 This function makes frame @var{frame} invisible.  If you omit
 @var{frame}, it makes the selected frame invisible.
+
+Unless @var{force} is non-@code{nil}, this function refuses to make
+@var{frame} invisible if all other frames are invisible..
 @end deffn
 
 @deffn Command iconify-frame &optional frame
@@ -1067,6 +1148,10 @@ iconifies the selected frame.
 This returns the visibility status of frame @var{frame}.  The value is
 @code{t} if @var{frame} is visible, @code{nil} if it is invisible, and
 @code{icon} if it is iconified.
+
+On a text-only terminal, all frames are considered visible, whether
+they are currently being displayed or not, and this function returns
+@code{t} for all frames.
 @end defun
 
   The visibility status of a frame is also available as a frame
@@ -1101,6 +1186,7 @@ on the screen.
 
 @deffn Command raise-frame &optional frame
 This function raises frame @var{frame} (default, the selected frame).
+If @var{frame} is invisible or iconified, this makes it visible.
 @end deffn
 
 @deffn Command lower-frame &optional frame
@@ -1131,7 +1217,8 @@ the current arrangement of frames and their contents.
 
 @defun set-frame-configuration configuration &optional nodelete
 This function restores the state of frames described in
-@var{configuration}.
+@var{configuration}.  However, this function does not restore deleted
+frames.
 
 Ordinarily, this function deletes all existing frames not listed in
 @var{configuration}.  But if @var{nodelete} is non-@code{nil}, the
@@ -1413,7 +1500,7 @@ distinguished by @dfn{selection types}, represented in Emacs by
 symbols.  X clients including Emacs can read or set the selection for
 any given type.
 
-@defun x-set-selection type data
+@deffn Command x-set-selection type data
 This function sets a ``selection'' in the X server.  It takes two
 arguments: a selection type @var{type}, and the value to assign to it,
 @var{data}.  If @var{data} is @code{nil}, it means to clear out the
@@ -1426,10 +1513,13 @@ The argument @var{data} may also be a vector of valid non-vector
 selection values.
 
 Each possible @var{type} has its own selection value, which changes
-independently.  The usual values of @var{type} are @code{PRIMARY} and
-@code{SECONDARY}; these are symbols with upper-case names, in accord
-with X Window System conventions.  The default is @code{PRIMARY}.
-@end defun
+independently.  The usual values of @var{type} are @code{PRIMARY},
+@code{SECONDARY} and @code{CLIPBOARD}; these are symbols with upper-case
+names, in accord with X Window System conventions.  If @var{type} is
+@code{nil}, that stands for @code{PRIMARY}.
+
+This function returns @var{data}.
+@end deffn
 
 @defun x-get-selection &optional type data-type
 This function accesses selections set up by Emacs or by other X
@@ -1440,6 +1530,7 @@ clients.  It takes two optional arguments, @var{type} and
 The @var{data-type} argument specifies the form of data conversion to
 use, to convert the raw data obtained from another X client into Lisp
 data.  Meaningful values include @code{TEXT}, @code{STRING},
+@code{UTF8_STRING},
 @code{TARGETS}, @code{LENGTH}, @code{DELETE}, @code{FILE_NAME},
 @code{CHARACTER_POSITION}, @code{LINE_NUMBER}, @code{COLUMN_NUMBER},
 @code{OWNER_OS}, @code{HOST_NAME}, @code{USER}, @code{CLASS},
@@ -1449,16 +1540,18 @@ upper-case names in accord with X conventions.)  The default for
 @end defun
 
 @cindex cut buffer
-The X server also has a set of numbered @dfn{cut buffers} which can
+The X server also has a set of eight numbered @dfn{cut buffers} which can
 store text or other data being moved between applications.  Cut buffers
 are considered obsolete, but Emacs supports them for the sake of X
-clients that still use them.
+clients that still use them.  Cut buffers are numbered from 0 to 7.
 
-@defun x-get-cut-buffer n
+@defun x-get-cut-buffer &optional n
 This function returns the contents of cut buffer number @var{n}.
+If omitted @var{n} defaults to 0.
 @end defun
 
 @defun x-set-cut-buffer string &optional push
+@anchor{Definition of x-set-cut-buffer}
 This function stores @var{string} into the first cut buffer (cut buffer
 0).  If @var{push} is @code{nil}, only the first cut buffer is changed.
 If @var{push} is non-@code{nil}, that says to move the values down
@@ -1520,6 +1613,7 @@ and that name is still supported as an alias.
 @tindex defined-colors
 This function returns a list of the color names that are defined
 and supported on frame @var{frame} (default, the selected frame).
+If @var{frame} does not support colors, the value is @code{nil}.
 
 @findex x-defined-colors
 This function used to be called @code{x-defined-colors},
@@ -1544,18 +1638,18 @@ The argument @var{color} must be a valid color name.
 @tindex color-gray-p
 This returns @code{t} if @var{color} is a shade of gray, as defined on
 @var{frame}'s display.  If @var{frame} is omitted or @code{nil}, the
-question applies to the selected frame.  The argument @var{color} must
-be a valid color name.
+question applies to the selected frame.  If @var{color} is not a valid
+color name, this function returns @code{nil}.
 @end defun
 
 @defun color-values color &optional frame
 @tindex color-values
 This function returns a value that describes what @var{color} should
-ideally look like.  If @var{color} is defined, the value is a list of
-three integers, which give the amount of red, the amount of green, and
-the amount of blue.  Each integer ranges in principle from 0 to 65535,
-but in practice no value seems to be above 65280.  This kind
-of three-element list is called an @dfn{rgb value}.
+ideally look like on @var{frame}.  If @var{color} is defined, the
+value is a list of three integers, which give the amount of red, the
+amount of green, and the amount of blue.  Each integer ranges in
+principle from 0 to 65535, but some displays may not use the full
+range.  This kind of three-element list is called an @dfn{rgb value}.
 
 If @var{color} is not defined, the value is @code{nil}.
 
@@ -1600,8 +1694,7 @@ are used by Emacs.
   Several of these functions use or return @dfn{rgb values}.  An rgb
 value is a list of three integers, which give the amount of red, the
 amount of green, and the amount of blue.  Each integer ranges in
-principle from 0 to 65535, but in practice the largest value used is
-65280.
+principle from 0 to 65535, but some displays may not use the full range.  .
 
   These functions accept a display (either a frame or the name of a
 terminal) as an optional argument.  We hope in the future to make Emacs
@@ -1643,13 +1736,14 @@ actually looks like.
 @tindex tty-color-approximate
 This function finds the closest color, among the known colors supported
 for @var{display}, to that described by the rgb value @var{rgb}.
+The return value is an element of @code{tty-color-alist}.
 @end defun
 
 @defun tty-color-translate color &optional display
 @tindex tty-color-translate
 This function finds the closest color to @var{color} among the known
-colors supported for @var{display}.  If the name @var{color} is not
-defined, the value is @code{nil}.
+colors supported for @var{display} and returns its index (an integer).
+If the name @var{color} is not defined, the value is @code{nil}.
 
 @var{color} can be an X-style @code{"#@var{xxxyyyzzz}"} specification
 instead of an actual name.  The format
@@ -1661,7 +1755,7 @@ instead of an actual name.  The format
 
 @defun x-get-resource attribute class &optional component subclass
 The function @code{x-get-resource} retrieves a resource value from the X
-Windows defaults database.
+Window defaults database.
 
 Resources are indexed by a combination of a @dfn{key} and a @dfn{class}.
 This function searches using a key of the form
@@ -1683,6 +1777,35 @@ resources for application names other than ``Emacs'' by binding this
 variable to some other string, around a call to @code{x-get-resource}.
 @end defvar
 
+@defvar x-resource-name
+This variable specifies the instance name that @code{x-get-resource}
+should look up.  The default value is the name Emacs was invoked with,
+or the value specified with the @samp{-name} or @samp{-rn} switches.
+@end defvar
+
+To illustrate some of the above, suppose that you have the line:
+
+@example
+xterm.vt100.background: yellow
+@end example
+
+@noindent
+in in your X resources file (usually named @file{~/.Xdefaults} or
+@file{~/.Xresources}).  Then:
+
+@example
+@group
+(let ((x-resource-class "XTerm") (x-resource-name "xterm"))
+  (x-get-resource "vt100.background" "VT100.Background"))
+     @result{} "yellow"
+@end group
+@group
+(let ((x-resource-class "XTerm") (x-resource-name "xterm"))
+  (x-get-resource "background" "VT100" "vt100" "Background"))
+     @result{} "yellow"
+@end group
+@end example
+
   @xref{X Resources,, X Resources, emacs, The GNU Emacs Manual}.
 
 @node Display Feature Testing
@@ -1691,7 +1814,7 @@ variable to some other string, around a call to @code{x-get-resource}.
 
   The functions in this section describe the basic capabilities of a
 particular display.  Lisp programs can use them to adapt their behavior
-to what the display can do.  For example, a program that ordinarly uses
+to what the display can do.  For example, a program that ordinarily uses
 a popup menu could use the minibuffer if popup menus are not supported.
 
   The optional argument @var{display} in these functions specifies which
@@ -1741,8 +1864,8 @@ This function returns @code{t} if the screen can display shades of gray.
 (All color displays can do this.)
 @end defun
 
-@anchor{Display Face Attribute Testing}
 @defun display-supports-face-attributes-p attributes &optional display
+@anchor{Display Face Attribute Testing}
 @tindex display-supports-face-attributes-p
 This function returns non-@code{nil} if all the face attributes in
 @var{attributes} are supported (@pxref{Face Attributes}).
@@ -1790,6 +1913,7 @@ This function returns the number of screens associated with the display.
 @defun display-pixel-height &optional display
 @tindex display-pixel-height
 This function returns the height of the screen in pixels.
+On a character terminal, it gives the height in characters.
 @end defun
 
 @defun display-mm-height &optional display
@@ -1801,6 +1925,7 @@ or @code{nil} if Emacs cannot get that information.
 @defun display-pixel-width &optional display
 @tindex display-pixel-width
 This function returns the width of the screen in pixels.
+On a character terminal, it gives the width in characters.
 @end defun
 
 @defun display-mm-width &optional display
@@ -1854,11 +1979,13 @@ about X displays.
 
 @defun x-server-version &optional display
 This function returns the list of version numbers of the X server
-running the display.
+running the display.  The value is a list of three integers: the major
+and minor version numbers, and the vendor-specific release number.
 @end defun
 
 @defun x-server-vendor &optional display
-This function returns the vendor that provided the X server software.
+This function returns the ``vendor'' that provided the X server software
+(as a string).
 @end defun
 
 @ignore
@@ -1872,3 +1999,7 @@ This variable's value is @code{t} if no X window manager is in use.
 The functions @code{x-pixel-width} and @code{x-pixel-height} return the
 width and height of an X Window frame, measured in pixels.
 @end ignore
+
+@ignore
+   arch-tag: 94977df6-3dca-4730-b57b-c6329e9282ba
+@end ignore