diff options
| author | Glenn Morris | 2014-02-16 18:12:50 -0800 |
|---|---|---|
| committer | Glenn Morris | 2014-02-16 18:12:50 -0800 |
| commit | 2836affa62a72a7f2d132e30f09e5dd93d022343 (patch) | |
| tree | 7afc28e4190378ac9a9b3092a46f7a967d756631 | |
| parent | dd7691b7f3d6149778a6d153288bc6c911a8cfc7 (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/minibuf.texi | 75 | ||||
| -rw-r--r-- | etc/NEWS | 1 |
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 @@ | |||
| 1 | 2014-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 | |||
| 1 | 2014-02-13 Glenn Morris <rgm@gnu.org> | 6 | 2014-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 |
| 215 | This function reads a regular expression as a string from the | 215 | This function reads a regular expression as a string from the |
| 216 | minibuffer and returns it. The argument @var{prompt} is used as in | 216 | minibuffer and returns it. If the minibuffer prompt string |
| 217 | @code{read-from-minibuffer}. | 217 | @var{prompt} does not end in @samp{:} (followed by optional |
| 218 | whitespace), the function adds @samp{: } to the end, preceded by the | ||
| 219 | default return value (see below), if that is non-empty. | ||
| 218 | 220 | ||
| 219 | The optional argument @var{default} specifies a default value to | 221 | The optional argument @var{defaults} controls the default value to |
| 220 | return if the user enters null input; it should be a string, or | 222 | return 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; |
| 224 | or a symbol. | ||
| 222 | 225 | ||
| 223 | The optional argument @var{history}, if non-@code{nil}, is a symbol | 226 | If @var{defaults} is a symbol, @code{read-regexp} consults the value |
| 224 | specifying a minibuffer history list to use (@pxref{Minibuffer | 227 | of the variable @code{read-regexp-defaults-function} (see below), and |
| 225 | History}). If it is omitted or @code{nil}, the history list defaults | 228 | if that is non-@code{nil} uses it in preference to @var{defaults}. |
| 226 | to @code{regexp-history}. | 229 | The 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 |
| 229 | passes them to @code{read-from-minibuffer}, to make them available to | 232 | @item |
| 230 | the user as the ``future minibuffer history list'' (@pxref{Minibuffer | 233 | @code{regexp-history-last}, which means to use the first element of |
| 231 | History, future list,, emacs, The GNU Emacs Manual}). These | 234 | the appropriate minibuffer history list (see below). |
| 232 | candidates are: | 235 | |
| 236 | @item | ||
| 237 | A 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 | ||
| 244 | string, it converts it to a list of one element). To this list, | ||
| 245 | @code{read-regexp} then appends a few potentially useful candidates for | ||
| 246 | input. 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. | |||
| 242 | The last string or pattern used in query-replace commands. | 256 | The last string or pattern used in query-replace commands. |
| 243 | @end itemize | 257 | @end itemize |
| 244 | 258 | ||
| 245 | This function works by calling the @code{read-from-minibuffer} | 259 | The function now has a list of regular expressions that it passes to |
| 246 | function, after computing the list of defaults as described above. | 260 | @code{read-from-minibuffer} to obtain the user's input. The first |
| 261 | element of the list is the default result in case of empty input. All | ||
| 262 | elements of the list are available to the user as the ``future | ||
| 263 | minibuffer history list'' (@pxref{Minibuffer History, future list,, | ||
| 264 | emacs, The GNU Emacs Manual}). | ||
| 265 | |||
| 266 | The optional argument @var{history}, if non-@code{nil}, is a symbol | ||
| 267 | specifying a minibuffer history list to use (@pxref{Minibuffer | ||
| 268 | History}). If it is omitted or @code{nil}, the history list defaults | ||
| 269 | to @code{regexp-history}. | ||
| 247 | @end defun | 270 | @end defun |
| 248 | 271 | ||
| 272 | @defvar read-regexp-defaults-function | ||
| 273 | The function @code{read-regexp} may use the value of this variable to | ||
| 274 | determine its list of default regular expressions. If non-@code{nil}, | ||
| 275 | the value of this variable should be either: | ||
| 276 | |||
| 277 | @itemize @minus | ||
| 278 | @item | ||
| 279 | The symbol @code{regexp-history-last}. | ||
| 280 | |||
| 281 | @item | ||
| 282 | A function of no arguments that returns either @code{nil}, a string, | ||
| 283 | or a list of strings. | ||
| 284 | @end itemize | ||
| 285 | |||
| 286 | @noindent | ||
| 287 | See @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 |
| 250 | If this variable is @code{nil}, then @code{read-from-minibuffer} | 291 | If this variable is @code{nil}, then @code{read-from-minibuffer} |
| 251 | and @code{read-string} strip all text properties from the minibuffer | 292 | and @code{read-string} strip all text properties from the minibuffer |
| @@ -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' |
| 1101 | as a function to call to provide default values. | 1102 | as a function to call to provide default values. |
| 1102 | 1103 | ||