summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/shortdoc.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-08-16 13:20:35 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-08-16 13:20:35 +0200
commit751f1707f009c714dbfe047ef43443a5c0c3df89 (patch)
treeaf4841befe93c09b6e28851fa5c20e57be9abbc5 /lisp/emacs-lisp/shortdoc.el
parent42be41657813ae606427aa53d2f0f0b7039d3ef1 (diff)
downloademacs-751f1707f009c714dbfe047ef43443a5c0c3df89.tar.gz
emacs-751f1707f009c714dbfe047ef43443a5c0c3df89.tar.bz2
emacs-751f1707f009c714dbfe047ef43443a5c0c3df89.zip
Add new functions to replace strings/regexp in a region
* doc/lispref/searching.texi (Search and Replace): Document them. * lisp/subr.el (replace-string-in-region) (replace-regexp-in-region): New functions. * lisp/emacs-lisp/shortdoc.el (regexp, buffer): Mention them.
Diffstat (limited to 'lisp/emacs-lisp/shortdoc.el')
-rw-r--r--lisp/emacs-lisp/shortdoc.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 1b0fbfdf715..7d4a69f42a9 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -700,6 +700,8 @@ There can be any number of :example/:result elements."
(match-substitute-replacement
:no-eval (match-substitute-replacement "new")
:eg-result "new")
+ (replace-regexp-in-region
+ :no-value (replace-regexp-in-region "[0-9]+" "Num \\&"))
"Utilities"
(regexp-quote
:eval (regexp-quote "foo.*bar"))
@@ -894,6 +896,10 @@ There can be any number of :example/:result elements."
:no-value (erase-buffer))
(insert
:no-value (insert "This string will be inserted in the buffer\n"))
+ (subst-char-in-region
+ :no-eval "(subst-char-in-region (point-min) (point-max) ?+ ?-)")
+ (replace-string-in-region
+ :no-value (replace-string-in-region "foo" "bar"))
"Locking"
(lock-buffer
:no-value (lock-buffer "/tmp/foo"))