aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-02-16 18:12:50 -0800
committerGlenn Morris2014-02-16 18:12:50 -0800
commit2836affa62a72a7f2d132e30f09e5dd93d022343 (patch)
tree7afc28e4190378ac9a9b3092a46f7a967d756631
parentdd7691b7f3d6149778a6d153288bc6c911a8cfc7 (diff)
downloademacs-2836affa62a72a7f2d132e30f09e5dd93d022343.tar.gz
emacs-2836affa62a72a7f2d132e30f09e5dd93d022343.zip
Some doc for read-regexp
* doc/lispref/minibuf.texi (Text from Minibuffer): Update read-regexp details. Mention read-regexp-defaults-function. * etc/NEWS: Related markup.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/minibuf.texi75
-rw-r--r--etc/NEWS1
3 files changed, 64 insertions, 17 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index f10577faf77..7869bcfdc2e 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12014-02-17 Glenn Morris <rgm@gnu.org>
2
3 * minibuf.texi (Text from Minibuffer): Update read-regexp details.
4 Mention read-regexp-defaults-function.
5
12014-02-13 Glenn Morris <rgm@gnu.org> 62014-02-13 Glenn Morris <rgm@gnu.org>
2 7
3 * debugging.texi (Debugger Commands): Tiny edits. 8 * debugging.texi (Debugger Commands): Tiny edits.
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index df510862460..63e9e2bbc23 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -211,25 +211,39 @@ This function works by calling the
211@end smallexample 211@end smallexample
212@end defun 212@end defun
213 213
214@defun read-regexp prompt &optional default history 214@defun read-regexp prompt &optional defaults history
215This function reads a regular expression as a string from the 215This function reads a regular expression as a string from the
216minibuffer and returns it. The argument @var{prompt} is used as in 216minibuffer and returns it. If the minibuffer prompt string
217@code{read-from-minibuffer}. 217@var{prompt} does not end in @samp{:} (followed by optional
218whitespace), the function adds @samp{: } to the end, preceded by the
219default return value (see below), if that is non-empty.
218 220
219The optional argument @var{default} specifies a default value to 221The optional argument @var{defaults} controls the default value to
220return if the user enters null input; it should be a string, or 222return if the user enters null input, and should be one of: a string;
221@code{nil}, which is equivalent to an empty string. 223@code{nil}, which is equivalent to an empty string; a list of strings;
224or a symbol.
222 225
223The optional argument @var{history}, if non-@code{nil}, is a symbol 226If @var{defaults} is a symbol, @code{read-regexp} consults the value
224specifying a minibuffer history list to use (@pxref{Minibuffer 227of the variable @code{read-regexp-defaults-function} (see below), and
225History}). If it is omitted or @code{nil}, the history list defaults 228if that is non-@code{nil} uses it in preference to @var{defaults}.
226to @code{regexp-history}. 229The value in this case should be either:
227 230
228@code{read-regexp} also collects a few useful candidates for input and 231@itemize @minus
229passes them to @code{read-from-minibuffer}, to make them available to 232@item
230the user as the ``future minibuffer history list'' (@pxref{Minibuffer 233@code{regexp-history-last}, which means to use the first element of
231History, future list,, emacs, The GNU Emacs Manual}). These 234the appropriate minibuffer history list (see below).
232candidates are: 235
236@item
237A function of no arguments, whose return value (which should be
238@code{nil}, a string, or a list of strings) becomes the value of
239@var{defaults}.
240@end itemize
241
242@code{read-regexp} now ensures that the result of processing
243@var{defaults} is a list (i.e., if the value is @code{nil} or a
244string, it converts it to a list of one element). To this list,
245@code{read-regexp} then appends a few potentially useful candidates for
246input. These are:
233 247
234@itemize @minus 248@itemize @minus
235@item 249@item
@@ -242,10 +256,37 @@ The last string used in an incremental search.
242The last string or pattern used in query-replace commands. 256The last string or pattern used in query-replace commands.
243@end itemize 257@end itemize
244 258
245This function works by calling the @code{read-from-minibuffer} 259The function now has a list of regular expressions that it passes to
246function, after computing the list of defaults as described above. 260@code{read-from-minibuffer} to obtain the user's input. The first
261element of the list is the default result in case of empty input. All
262elements of the list are available to the user as the ``future
263minibuffer history list'' (@pxref{Minibuffer History, future list,,
264emacs, The GNU Emacs Manual}).
265
266The optional argument @var{history}, if non-@code{nil}, is a symbol
267specifying a minibuffer history list to use (@pxref{Minibuffer
268History}). If it is omitted or @code{nil}, the history list defaults
269to @code{regexp-history}.
247@end defun 270@end defun
248 271
272@defvar read-regexp-defaults-function
273The function @code{read-regexp} may use the value of this variable to
274determine its list of default regular expressions. If non-@code{nil},
275the value of this variable should be either:
276
277@itemize @minus
278@item
279The symbol @code{regexp-history-last}.
280
281@item
282A function of no arguments that returns either @code{nil}, a string,
283or a list of strings.
284@end itemize
285
286@noindent
287See @code{read-regexp} above for details of how these values are used.
288@end defvar
289
249@defvar minibuffer-allow-text-properties 290@defvar minibuffer-allow-text-properties
250If this variable is @code{nil}, then @code{read-from-minibuffer} 291If this variable is @code{nil}, then @code{read-from-minibuffer}
251and @code{read-string} strip all text properties from the minibuffer 292and @code{read-string} strip all text properties from the minibuffer
diff --git a/etc/NEWS b/etc/NEWS
index 364046c40f4..278bc7fd003 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1097,6 +1097,7 @@ respecting file-local variables.
1097+++ 1097+++
1098** New function `get-pos-property'. 1098** New function `get-pos-property'.
1099 1099
1100+++
1100** `read-regexp' now uses the new variable `read-regexp-defaults-function' 1101** `read-regexp' now uses the new variable `read-regexp-defaults-function'
1101as a function to call to provide default values. 1102as a function to call to provide default values.
1102 1103