(Invisible Text): Correct add-to-invisibility-spec.
[bpt/emacs.git] / lispref / commands.texi
index f1f94e1..29a86f9 100644 (file)
@@ -74,15 +74,15 @@ character causes @dfn{quitting} (@pxref{Quitting}).
 The editor command loop runs this normal hook before each command.  At
 that time, @code{this-command} contains the command that is about to
 run, and @code{last-command} describes the previous command.
-@xref{Hooks}.
+@xref{Command Loop Info}.
 @end defvar
 
 @defvar post-command-hook
 The editor command loop runs this normal hook after each command
 (including commands terminated prematurely by quitting or by errors),
 and also when the command loop is first entered.  At that time,
-@code{this-command} describes the command that just ran, and
-@code{last-command} describes the command before that.  @xref{Hooks}.
+@code{this-command} refers to the command that just ran, and
+@code{last-command} refers to the command before that.
 @end defvar
 
   Quitting is suppressed while running @code{pre-command-hook} and
@@ -350,6 +350,11 @@ Prompt.
 @item F
 A file name.  The file need not exist.  Completion, Default, Prompt.
 
+@item G
+A file name.  The file need not exist.  If the user enters just a
+directory name, then the value is just that directory name, with no
+file name within the directory added.  Completion, Default, Prompt.
+
 @item i
 An irrelevant argument.  This code always supplies @code{nil} as
 the argument's value.  No I/O.
@@ -420,7 +425,7 @@ the string.)  Other characters that normally terminate a symbol (e.g.,
 parentheses and brackets) do not do so here.  Prompt.
 
 @item U
-A key sequence or nil.  May be used after a @code{k} or @code{K}
+A key sequence or @code{nil}.  May be used after a @code{k} or @code{K}
 argument to get the up-event that was discarded in case the key
 sequence read for that argument was a down-event.  No I/O.
 
@@ -617,7 +622,7 @@ This function returns @code{t} if the containing function (the one
 whose code includes the call to @code{interactive-p}) was called in
 direct response to user input.  This means that it was called with the
 function @code{call-interactively}, and that a keyboard macro is
-not running.
+not running, and that Emacs is not running in batch mode.
 
 If the containing function was called by Lisp evaluation (or with
 @code{apply} or @code{funcall}), then it was not called interactively.
@@ -679,6 +684,15 @@ Defined in this way, the function does display the message when called
 from a keyboard macro.  We use @code{"p"} because the numeric prefix
 argument is never @code{nil}.
 
+@defun called-interactively-p
+This function returns @code{t} when the calling function was called
+using @code{call-interactively}.
+
+When possible, instead of using this function, you should use the
+method in the example above; that method makes it possible for a
+caller to ``pretend'' that the function was called interactively.
+@end defun
+
 @node Command Loop Info
 @comment  node-name,  next,  previous,  up
 @section Information from the Command Loop
@@ -831,21 +845,21 @@ If the last event came from a keyboard macro, the value is @code{macro}.
 @node Adjusting Point
 @section Adjusting Point After Commands
 
-  It is not easy to display a value of point in the middle of a sequence
-of text that has the @code{display} or @code{composition} property.  So
-after a command finishes and returns to the command loop, if point is
-within such a sequence, the command loop normally moves point to the
-edge of the sequence.
+  It is not easy to display a value of point in the middle of a
+sequence of text that has the @code{display}, @code{composition} or
+@code{intangible} property, or is invisible.  Therefore, after a
+command finishes and returns to the command loop, if point is within
+such a sequence, the command loop normally moves point to the edge of
+the sequence.
 
   A command can inhibit this feature by setting the variable
 @code{disable-point-adjustment}:
 
 @defvar disable-point-adjustment
 @tindex disable-point-adjustment
-If this variable is non-@code{nil} when a command returns to the command
-loop, then the command loop does not check for text properties such as
-@code{display} and @code{composition}, and does not move point out of
-sequences that have these properties.
+If this variable is non-@code{nil} when a command returns to the
+command loop, then the command loop does not check for those text
+properties, and does not move point out of sequences that have them.
 
 The command loop sets this variable to @code{nil} before each command,
 so if a command sets it, the effect applies only to that command.
@@ -1538,6 +1552,21 @@ The usual way to handle this event is by visiting these files.
 This kind of event is generated, at present, only on some kinds of
 systems.
 
+@cindex @code{help-echo} event
+@item help-echo
+This kind of event is generated when a mouse pointer moves onto a
+portion of buffer text which has a @code{help-echo} text property.
+The generated event has this form:
+
+@example
+(help-echo @var{frame} @var{help} @var{window} @var{object} @var{pos})
+@end example
+
+@noindent
+The precise meaning of the event parameters and the way these
+parameters are used to display the help-echo text are described in
+@ref{Text help-echo}.
+
 @cindex @code{usr1-signal} event
 @cindex @code{usr2-signal} event
 @item usr1-signal
@@ -1834,12 +1863,15 @@ This function returns a position list for position @var{pos} in
 @var{window}.
 @end defun
 
-@defun posn-at-x-y x y &optional frame-or-window
+@defun posn-at-x-y x y &optional frame-or-window whole
 This function returns position information corresponding to pixel
 coordinates @var{x} and @var{y} in a specified frame or window,
 @var{frame-or-window}, which defaults to the selected window.
 The coordinates @var{x} and @var{y} are relative to the
 frame or window used.
+If @var{whole} is @code{nil}, the coordinates are relative
+to the window text area, otherwise they are relative to
+the entire window area including scroll bars, margins and fringes.
 @end defun
 
   These functions are useful for decoding scroll bar events.
@@ -2024,7 +2056,7 @@ can use for translating or modifying input events while reading them.
 @code{read-key-sequence}.  Lisp programs can also call this function;
 for example, @code{describe-key} uses it to read the key to describe.
 
-@defun read-key-sequence prompt
+@defun read-key-sequence prompt &optional continue-echo dont-downcase-last switch-frame-ok command-loop
 @cindex key sequence
 This function reads a key sequence and returns it as a string or
 vector.  It keeps reading events until it has accumulated a complete key
@@ -2039,8 +2071,28 @@ Otherwise, it returns a vector, since a vector can hold all kinds of
 events---characters, symbols, and lists.  The elements of the string or
 vector are the events in the key sequence.
 
-The argument @var{prompt} is either a string to be displayed in the echo
-area as a prompt, or @code{nil}, meaning not to display a prompt.
+The argument @var{prompt} is either a string to be displayed in the
+echo area as a prompt, or @code{nil}, meaning not to display a prompt.
+The argument @var{continue-echo}, if non-@code{nil}, means to echo
+this key as a continuation of the previous key.
+
+Normally any upper case event is converted to lower case if the
+original event is undefined and the lower case equivalent is defined.
+The argument @var{dont-downcase-last}, if non-@code{nil}, means do not
+convert the last event to lower case.  This is appropriate for reading
+a key sequence to be defined.
+
+The argument @var{switch-frame-ok}, if non-@code{nil}, means that this
+function should process a @code{switch-frame} event if the user
+switches frames before typing anything.  If the user switches frames
+in the middle of a key sequence, or at the start of the sequence but
+@var{switch-frame-ok} is @code{nil}, then the event will be put off
+until after the current key sequence.
+
+The argument @var{command-loop}, if non-@code{nil}, means that this
+key sequence is being read by something that will read commands one
+after another.  It should be @code{nil} if the caller will read just
+one key sequence.
 
 In the example below, the prompt @samp{?} is displayed in the echo area,
 and the user types @kbd{C-x C-f}.
@@ -2062,7 +2114,7 @@ typed while reading with this function works like any other character,
 and does not set @code{quit-flag}.  @xref{Quitting}.
 @end defun
 
-@defun read-key-sequence-vector prompt
+@defun read-key-sequence-vector prompt &optional continue-echo dont-downcase-last switch-frame-ok command-loop
 This is like @code{read-key-sequence} except that it always
 returns the key sequence as a vector, never as a string.
 @xref{Strings of Events}.
@@ -2379,6 +2431,18 @@ The alias @code{last-input-char} exists for compatibility with
 Emacs version 18.
 @end defvar
 
+@defmac while-no-input body...
+This construct runs the @var{body} forms and returns the value
+of the last one---but only if no input arrives.  If any input
+arrives during the execution of the @var{body} forms, it aborts
+them (working much like a quit), and the @code{while-no-input}
+form returns @code{nil}.
+
+If a part of @var{body} binds @code{inhibit-quit} to non-@code{nil},
+arrival of input during those parts won't cause an abort until
+the end of that part.
+@end defmac
+
 @defun discard-input
 @cindex flush input
 @cindex discard input
@@ -2584,7 +2648,8 @@ non-@code{nil}, then @code{quit-flag} has no special effect.
 This macro executes @var{forms} in sequence, but allows quitting, at
 least locally, within @var{body} even if @code{inhibit-quit} was
 non-@code{nil} outside this construct.  It returns the value of the
-last form in @var{forms}.
+last form in @var{forms}, unless exited by quitting, in which case
+it returns @code{nil}.
 
 If @code{inhibit-quit} is @code{nil} on entry to @code{with-local-quit},
 it only executes the @var{forms}, and setting @code{quit-flag} causes
@@ -3014,9 +3079,10 @@ yourself.
 @defvar defining-kbd-macro
 This variable is non-@code{nil} if and only if a keyboard macro is
 being defined.  A command can test this variable so as to behave
-differently while a macro is being defined.  The commands
-@code{start-kbd-macro} and @code{end-kbd-macro} set this variable---do
-not set it yourself.
+differently while a macro is being defined.  The value is
+@code{append} while appending to the definition of an existing macro.
+The commands @code{start-kbd-macro}, @code{kmacro-start-macro} and
+@code{end-kbd-macro} set this variable---do not set it yourself.
 
 The variable is always local to the current terminal and cannot be
 buffer-local.  @xref{Multiple Displays}.