aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2019-10-09 13:08:01 +0300
committerEli Zaretskii2019-10-09 13:08:01 +0300
commit8e0761c842b61b67da648d9ac295d42f4654792d (patch)
tree73df7c72dd57175a449795558969803af5b09ee4
parent87d999a2f4dd0f0906e0b44a0f271b72f0e2e0e9 (diff)
downloademacs-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)
-rw-r--r--lisp/replace.el36
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.
179Prompt with PROMT. REGEXP-FLAG non-nil means the response should be a regexp.
179The return value can also be a pair (FROM . TO) indicating that the user 180The return value can also be a pair (FROM . TO) indicating that the user
180wants to replace FROM with TO." 181wants 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.
257REGEXP-FLAG non-nil means TO is a regexp.
256Returns a list suitable for `perform-replace' if necessary, 258Returns a list suitable for `perform-replace' if necessary,
257the original string if not." 259the 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.
299Prompt 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
627enabled and the mark is active, operates on the contents of the region; 630enabled and the mark is active, operates on the contents of the region;
628otherwise from point to the end of the buffer's accessible portion. 631otherwise from point to the end of the buffer's accessible portion.
629 632
633Arguments BACKWARD and REGION-NONCONTIGUOUS-P are passed
634to `perform-replace' (which see).
635
630Use \\<minibuffer-local-map>\\[next-history-element] \ 636Use \\<minibuffer-local-map>\\[next-history-element] \
631to pull the last incremental search string to the minibuffer 637to pull the last incremental search string to the minibuffer
632that reads FROM-STRING. 638that reads FROM-STRING.
@@ -682,6 +688,9 @@ replace backward.
682 688
683Fourth and fifth arg START and END specify the region to operate on. 689Fourth and fifth arg START and END specify the region to operate on.
684 690
691Arguments BACKWARD and REGION-NONCONTIGUOUS-P are passed
692to `perform-replace' (which see).
693
685In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP, 694In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP,
686and `\\=\\N' (where N is a digit) stands for whatever matched 695and `\\=\\N' (where N is a digit) stands for whatever matched
687the Nth `\\(...\\)' (1-based) in REGEXP. 696the 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.
1245If 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.
1302Compatibility function for \\[next-error] invocations." 1312RESET non-nil means rewind to the first match.
1313This 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*.
1411Here `original-buffer-name' is the buffer name where Occur was originally run. 1422Here `original-buffer-name' is the buffer name where Occur was originally run.
1412When given the prefix argument, or called non-interactively, the renaming 1423If UNIQUE-P is non-nil (interactively, the prefix argument), or called
1413will not clobber the existing buffer(s) of that name, but use 1424non-interactively with INTERACTIVE-P nil, the renaming will not clobber
1414`generate-new-buffer-name' instead. You can add this to `occur-hook' 1425the existing buffer(s) of that name, but will use `generate-new-buffer-name'
1415if you always want a separate *Occur* buffer for each buffer where you 1426instead.
1416invoke `occur'." 1427You 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.
1498Optional argument NLINES specifies the number of context lines to show
1499with each match, see `list-matching-lines-default-context-lines'.
1486This function acts on multiple buffers; otherwise, it is exactly like 1500This 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
1488the buffer names that you want, one by one. 1502the 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.
1511Normally BUFREGEXP matches against each buffer's visited file name, 1525Normally BUFREGEXP matches against each buffer's visited file name,
1512but if you specify a prefix argument, it matches against the buffer name. 1526but ALLBUFS non-nil (interactively, if you specify a prefix argument),
1527it matches against the buffer name and includes also buffers that
1528don't visit files.
1513See also `multi-occur'." 1529See also `multi-occur'."
1514 (interactive 1530 (interactive
1515 (cons 1531 (cons