aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-06-05 17:39:46 +0000
committerRichard M. Stallman2004-06-05 17:39:46 +0000
commit79467ffe3e64fe46149e578124c62c38f6eaaf8a (patch)
treec232a027c69aa5356f1104a09c5e5414a28bad1d
parent1fb101f339ebef5c2d5f5ffdadb281d673703354 (diff)
downloademacs-79467ffe3e64fe46149e578124c62c38f6eaaf8a.tar.gz
emacs-79467ffe3e64fe46149e578124c62c38f6eaaf8a.zip
(Minibuffer Completion): For INITIAL arg,
refer the user to the Initial Input node. (Text from Minibuffer): Likewise. (Initial Input): New node. Document this feature and say it is mostly deprecated.
-rw-r--r--lispref/minibuf.texi90
1 files changed, 52 insertions, 38 deletions
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi
index 0c56f9d4622..a2695eab6b9 100644
--- a/lispref/minibuf.texi
+++ b/lispref/minibuf.texi
@@ -23,6 +23,7 @@ for reading an argument.
23* Object from Minibuffer:: How to read a Lisp object or expression. 23* Object from Minibuffer:: How to read a Lisp object or expression.
24* Minibuffer History:: Recording previous minibuffer inputs 24* Minibuffer History:: Recording previous minibuffer inputs
25 so the user can reuse them. 25 so the user can reuse them.
26* Initial Input:: Specifying initial contents for the minibuffer.
26* Completion:: How to invoke and customize completion. 27* Completion:: How to invoke and customize completion.
27* Yes-or-No Queries:: Asking a question with a simple answer. 28* Yes-or-No Queries:: Asking a question with a simple answer.
28* Multiple Queries:: Asking a series of similar questions. 29* Multiple Queries:: Asking a series of similar questions.
@@ -168,25 +169,9 @@ the setting of @code{enable-multibyte-characters} (@pxref{Text
168Representations}) from whichever buffer was current before entering the 169Representations}) from whichever buffer was current before entering the
169minibuffer. 170minibuffer.
170 171
171If @var{initial-contents} is a string, @code{read-from-minibuffer} 172Use of @var{initial-contents} is mostly deprecated; we recommend using
172inserts it into the minibuffer, leaving point at the end, before the 173a non-@code{nil} value only in conjunction with specifying a cons cell
173user starts to edit the text. The minibuffer appears with this text as 174for @var{hist}. @xref{Initial Input}.
174its initial contents.
175
176Alternatively, @var{initial-contents} can be a cons cell of the form
177@code{(@var{string} . @var{position})}. This means to insert
178@var{string} in the minibuffer but put point at @emph{one-indexed}
179@var{position} in the minibuffer, rather than at the end. Any integer
180value less or equal to one puts point at the beginning of the string.
181
182@strong{Usage note:} The @var{initial-contents} argument and the
183@var{default} argument are two alternative features for more or less the
184same job. It does not make sense to use both features in a single call
185to @code{read-from-minibuffer}. In general, we recommend using
186@var{default}, since this permits the user to insert the default value
187when it is wanted, but does not burden the user with deleting it from
188the minibuffer on other occasions. For an exception to this rule,
189see @ref{Minibuffer History}.
190@end defun 175@end defun
191 176
192@defun read-string prompt &optional initial history default inherit-input-method 177@defun read-string prompt &optional initial history default inherit-input-method
@@ -440,9 +425,11 @@ symbol @var{variable}. @code{previous-history-element} will display
440the most recent element of the history list in the minibuffer. If you 425the most recent element of the history list in the minibuffer. If you
441specify a positive @var{startpos}, the minibuffer history functions 426specify a positive @var{startpos}, the minibuffer history functions
442behave as if @code{(elt @var{variable} (1- @var{STARTPOS}))} were the 427behave as if @code{(elt @var{variable} (1- @var{STARTPOS}))} were the
443history element currently shown in the minibuffer. For consistency, 428history element currently shown in the minibuffer.
444you should also specify that element of the history as the initial 429
445minibuffer contents. 430For consistency, you should also specify that element of the history
431as the initial minibuffer contents, using the @var{initial} argument
432to the minibuffer input function (@pxref{Initial Input}).
446@end table 433@end table
447 434
448 If you don't specify @var{hist}, then the default history list 435 If you don't specify @var{hist}, then the default history list
@@ -506,6 +493,45 @@ A history list for arguments that are shell commands.
506A history list for arguments that are Lisp expressions to evaluate. 493A history list for arguments that are Lisp expressions to evaluate.
507@end defvar 494@end defvar
508 495
496@node Initial Input
497@section Initial Input
498
499Several of the functions for minibuffer input have an argument called
500@var{initial} or @var{initial-contents}. This is a mostly-deprecated
501feature for specifiying that the minibuffer should start out with
502certain text, instead of empty as usual.
503
504If @var{initial} is a string, the minibuffer starts out containing the
505text of the string, with point at the end, when the user starts to
506edit the text. If the user simply types @key{RET} to exit the
507minibuffer, it will use the initial input string to determine the
508value to return.
509
510@strong{We discourage use of a non-@code{nil} value for
511@var{initial}}, because initial input is an intrusive interface.
512History lists and default values provide a much more convenient method
513to offer useful default inputs to the user.
514
515There is just one situation where you should specify a string for an
516@var{initial} argument. This is when you specify a cons cell for the
517@var{hist} or @var{history} argument. @xref{Minibuffer History}.
518
519@var{initial} can also be a cons cell of the form @code{(@var{string}
520. @var{position})}. This means to insert @var{string} in the
521minibuffer but put point at @var{position} within the string's text.
522
523As a historical accident, @var{position} was implemented
524inconsistently in different functions. In @code{completing-read},
525@var{position}'s value is interpreted as origin-zero; that is, a value
526of 0 means the beginning of the string, 1 means after the first
527character, etc. In @code{read-minibuffer}, and the other
528non-completion minibuffer input functions that support this argument,
5291 means the beginning of the string 2 means after the first character,
530etc.
531
532Use of a cons cell as the value for @var{initial} arguments is
533deprecated in user code.
534
509@node Completion 535@node Completion
510@section Completion 536@section Completion
511@cindex completion 537@cindex completion
@@ -797,22 +823,10 @@ The argument @var{hist} specifies which history list variable to use for
797saving the input and for minibuffer history commands. It defaults to 823saving the input and for minibuffer history commands. It defaults to
798@code{minibuffer-history}. @xref{Minibuffer History}. 824@code{minibuffer-history}. @xref{Minibuffer History}.
799 825
800If @var{initial} is non-@code{nil}, @code{completing-read} inserts it 826The argument @var{initial} is mostly deprecated; we recommend using a
801into the minibuffer as part of the input, with point at the end. Then 827non-@code{nil} value only in conjunction with specifying a cons cell
802it allows the user to edit the input, providing several commands to 828for @var{hist}. @xref{Initial Input}. For default input, use
803attempt completion. @var{initial} can also be a cons cell of the form 829@var{default} instead.
804@code{(@var{string} . @var{position})}. In that case, point is put at
805@emph{zero-indexed} position @var{position} in @var{string}. Note
806that this is different from @code{read-from-minibuffer} and related
807functions, which use a one-indexed position. In most cases, we
808recommend using @var{default}, and not @var{initial}.
809
810@strong{We discourage use of a non-@code{nil} value for
811@var{initial}}, because it is an intrusive interface. The history
812list feature (which did not exist when we introduced @var{initial})
813offers a far more convenient and general way for the user to get the
814default and edit it, and it is always available. For an exception to
815this rule, see @ref{Minibuffer History}.
816 830
817If the argument @var{inherit-input-method} is non-@code{nil}, then the 831If the argument @var{inherit-input-method} is non-@code{nil}, then the
818minibuffer inherits the current input method (@pxref{Input 832minibuffer inherits the current input method (@pxref{Input