diff options
| author | Eli Zaretskii | 2019-10-09 13:08:01 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-10-09 13:08:01 +0300 |
| commit | 8e0761c842b61b67da648d9ac295d42f4654792d (patch) | |
| tree | 73df7c72dd57175a449795558969803af5b09ee4 /lisp | |
| parent | 87d999a2f4dd0f0906e0b44a0f271b72f0e2e0e9 (diff) | |
| download | emacs-8e0761c842b61b67da648d9ac295d42f4654792d.tar.gz emacs-8e0761c842b61b67da648d9ac295d42f4654792d.zip | |
Improve doc strings in replace.el
* lisp/replace.el (query-replace-read-from)
(query-replace-compile-replacement, query-replace-read-to)
(replace-string, replace-regexp, occur-mode-goto-occurrence)
(occur-next-error, occur-rename-buffer, multi-occur)
(multi-occur-in-matching-buffers): Describe all arguments in
doc strings. (Bug#31207)
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/replace.el | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 5c0616e25f0..d81eba3c7ab 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -176,6 +176,7 @@ See `replace-regexp' and `query-replace-regexp-eval'.") | |||
| 176 | 176 | ||
| 177 | (defun query-replace-read-from (prompt regexp-flag) | 177 | (defun query-replace-read-from (prompt regexp-flag) |
| 178 | "Query and return the `from' argument of a query-replace operation. | 178 | "Query and return the `from' argument of a query-replace operation. |
| 179 | Prompt with PROMT. REGEXP-FLAG non-nil means the response should be a regexp. | ||
| 179 | The return value can also be a pair (FROM . TO) indicating that the user | 180 | The return value can also be a pair (FROM . TO) indicating that the user |
| 180 | wants to replace FROM with TO." | 181 | wants to replace FROM with TO." |
| 181 | (if query-replace-interactive | 182 | (if query-replace-interactive |
| @@ -253,6 +254,7 @@ wants to replace FROM with TO." | |||
| 253 | 254 | ||
| 254 | (defun query-replace-compile-replacement (to regexp-flag) | 255 | (defun query-replace-compile-replacement (to regexp-flag) |
| 255 | "Maybe convert a regexp replacement TO to Lisp. | 256 | "Maybe convert a regexp replacement TO to Lisp. |
| 257 | REGEXP-FLAG non-nil means TO is a regexp. | ||
| 256 | Returns a list suitable for `perform-replace' if necessary, | 258 | Returns a list suitable for `perform-replace' if necessary, |
| 257 | the original string if not." | 259 | the original string if not." |
| 258 | (if (and regexp-flag | 260 | (if (and regexp-flag |
| @@ -293,7 +295,8 @@ the original string if not." | |||
| 293 | 295 | ||
| 294 | 296 | ||
| 295 | (defun query-replace-read-to (from prompt regexp-flag) | 297 | (defun query-replace-read-to (from prompt regexp-flag) |
| 296 | "Query and return the `to' argument of a query-replace operation." | 298 | "Query and return the `to' argument of a query-replace operation. |
| 299 | Prompt with PROMPT. REGEXP-FLAG non-nil means the response should a regexp." | ||
| 297 | (query-replace-compile-replacement | 300 | (query-replace-compile-replacement |
| 298 | (save-excursion | 301 | (save-excursion |
| 299 | (let* ((history-add-new-input nil) | 302 | (let* ((history-add-new-input nil) |
| @@ -627,6 +630,9 @@ to the end of the buffer). Interactively, if Transient Mark mode is | |||
| 627 | enabled and the mark is active, operates on the contents of the region; | 630 | enabled and the mark is active, operates on the contents of the region; |
| 628 | otherwise from point to the end of the buffer's accessible portion. | 631 | otherwise from point to the end of the buffer's accessible portion. |
| 629 | 632 | ||
| 633 | Arguments BACKWARD and REGION-NONCONTIGUOUS-P are passed | ||
| 634 | to `perform-replace' (which see). | ||
| 635 | |||
| 630 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 636 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 631 | to pull the last incremental search string to the minibuffer | 637 | to pull the last incremental search string to the minibuffer |
| 632 | that reads FROM-STRING. | 638 | that reads FROM-STRING. |
| @@ -682,6 +688,9 @@ replace backward. | |||
| 682 | 688 | ||
| 683 | Fourth and fifth arg START and END specify the region to operate on. | 689 | Fourth and fifth arg START and END specify the region to operate on. |
| 684 | 690 | ||
| 691 | Arguments BACKWARD and REGION-NONCONTIGUOUS-P are passed | ||
| 692 | to `perform-replace' (which see). | ||
| 693 | |||
| 685 | In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP, | 694 | In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP, |
| 686 | and `\\=\\N' (where N is a digit) stands for whatever matched | 695 | and `\\=\\N' (where N is a digit) stands for whatever matched |
| 687 | the Nth `\\(...\\)' (1-based) in REGEXP. | 696 | the Nth `\\(...\\)' (1-based) in REGEXP. |
| @@ -1232,7 +1241,8 @@ To return to ordinary Occur mode, use \\[occur-cease-edit]." | |||
| 1232 | 1241 | ||
| 1233 | (defalias 'occur-mode-mouse-goto 'occur-mode-goto-occurrence) | 1242 | (defalias 'occur-mode-mouse-goto 'occur-mode-goto-occurrence) |
| 1234 | (defun occur-mode-goto-occurrence (&optional event) | 1243 | (defun occur-mode-goto-occurrence (&optional event) |
| 1235 | "Go to the occurrence on the current line." | 1244 | "Go to the occurrence specified by EVENT, a mouse click. |
| 1245 | If not invoked by a mouse click, go to occurrence on the current line." | ||
| 1236 | (interactive (list last-nonmenu-event)) | 1246 | (interactive (list last-nonmenu-event)) |
| 1237 | (let ((buffer (when event (current-buffer))) | 1247 | (let ((buffer (when event (current-buffer))) |
| 1238 | (pos | 1248 | (pos |
| @@ -1298,8 +1308,9 @@ To return to ordinary Occur mode, use \\[occur-cease-edit]." | |||
| 1298 | (occur-find-match n #'previous-single-property-change "No earlier matches")) | 1308 | (occur-find-match n #'previous-single-property-change "No earlier matches")) |
| 1299 | 1309 | ||
| 1300 | (defun occur-next-error (&optional argp reset) | 1310 | (defun occur-next-error (&optional argp reset) |
| 1301 | "Move to the Nth (default 1) next match in an Occur mode buffer. | 1311 | "Move to the ARGPth (default 1) next match in an Occur mode buffer. |
| 1302 | Compatibility function for \\[next-error] invocations." | 1312 | RESET non-nil means rewind to the first match. |
| 1313 | This is a compatibility function for \\[next-error] invocations." | ||
| 1303 | (interactive "p") | 1314 | (interactive "p") |
| 1304 | (goto-char (cond (reset (point-min)) | 1315 | (goto-char (cond (reset (point-min)) |
| 1305 | ((< argp 0) (line-beginning-position)) | 1316 | ((< argp 0) (line-beginning-position)) |
| @@ -1409,11 +1420,12 @@ which means to discard all text properties." | |||
| 1409 | (defun occur-rename-buffer (&optional unique-p interactive-p) | 1420 | (defun occur-rename-buffer (&optional unique-p interactive-p) |
| 1410 | "Rename the current *Occur* buffer to *Occur: original-buffer-name*. | 1421 | "Rename the current *Occur* buffer to *Occur: original-buffer-name*. |
| 1411 | Here `original-buffer-name' is the buffer name where Occur was originally run. | 1422 | Here `original-buffer-name' is the buffer name where Occur was originally run. |
| 1412 | When given the prefix argument, or called non-interactively, the renaming | 1423 | If UNIQUE-P is non-nil (interactively, the prefix argument), or called |
| 1413 | will not clobber the existing buffer(s) of that name, but use | 1424 | non-interactively with INTERACTIVE-P nil, the renaming will not clobber |
| 1414 | `generate-new-buffer-name' instead. You can add this to `occur-hook' | 1425 | the existing buffer(s) of that name, but will use `generate-new-buffer-name' |
| 1415 | if you always want a separate *Occur* buffer for each buffer where you | 1426 | instead. |
| 1416 | invoke `occur'." | 1427 | You can add this to `occur-hook' if you always want a separate |
| 1428 | *Occur* buffer for each buffer where you invoke `occur'." | ||
| 1417 | (interactive "P\np") | 1429 | (interactive "P\np") |
| 1418 | (with-current-buffer | 1430 | (with-current-buffer |
| 1419 | (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) | 1431 | (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) |
| @@ -1483,6 +1495,8 @@ is not modified." | |||
| 1483 | 1495 | ||
| 1484 | (defun multi-occur (bufs regexp &optional nlines) | 1496 | (defun multi-occur (bufs regexp &optional nlines) |
| 1485 | "Show all lines in buffers BUFS containing a match for REGEXP. | 1497 | "Show all lines in buffers BUFS containing a match for REGEXP. |
| 1498 | Optional argument NLINES specifies the number of context lines to show | ||
| 1499 | with each match, see `list-matching-lines-default-context-lines'. | ||
| 1486 | This function acts on multiple buffers; otherwise, it is exactly like | 1500 | This function acts on multiple buffers; otherwise, it is exactly like |
| 1487 | `occur'. When you invoke this command interactively, you must specify | 1501 | `occur'. When you invoke this command interactively, you must specify |
| 1488 | the buffer names that you want, one by one. | 1502 | the buffer names that you want, one by one. |
| @@ -1509,7 +1523,9 @@ See also `multi-occur-in-matching-buffers'." | |||
| 1509 | (defun multi-occur-in-matching-buffers (bufregexp regexp &optional allbufs) | 1523 | (defun multi-occur-in-matching-buffers (bufregexp regexp &optional allbufs) |
| 1510 | "Show all lines matching REGEXP in buffers specified by BUFREGEXP. | 1524 | "Show all lines matching REGEXP in buffers specified by BUFREGEXP. |
| 1511 | Normally BUFREGEXP matches against each buffer's visited file name, | 1525 | Normally BUFREGEXP matches against each buffer's visited file name, |
| 1512 | but if you specify a prefix argument, it matches against the buffer name. | 1526 | but ALLBUFS non-nil (interactively, if you specify a prefix argument), |
| 1527 | it matches against the buffer name and includes also buffers that | ||
| 1528 | don't visit files. | ||
| 1513 | See also `multi-occur'." | 1529 | See also `multi-occur'." |
| 1514 | (interactive | 1530 | (interactive |
| 1515 | (cons | 1531 | (cons |