From cf0f47acf5fbd96c7e1f0c40f6efd075fb624481 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 27 Oct 2020 22:50:20 +0100 Subject: [PATCH] Add save-match-data and rx to regexp shortdoc group * lisp/emacs-lisp/shortdoc.el (regexp): Add save-match-data and rx to group. New section "Match Data". --- lisp/emacs-lisp/shortdoc.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index a2e5ce6e29..98994ed501 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -628,12 +628,6 @@ regexp (match-string :eval (and (string-match "^\\([fo]+\\)b" "foobar") (match-string 0 "foobar"))) - (match-beginning - :no-eval (match-beginning 1) - :eg-result 0) - (match-end - :no-eval (match-end 1) - :eg-result 3) "Looking in Buffers" (re-search-forward :no-eval (re-search-forward "^foo$" nil t) @@ -644,6 +638,15 @@ regexp (looking-at-p :no-eval (looking-at "f[0-9]") :eg-result t) + "Match Data" + (match-beginning + :no-eval (match-beginning 1) + :eg-result 0) + (match-end + :no-eval (match-end 1) + :eg-result 3) + (save-match-data + :no-eval (save-match-data ...)) "Replacing Match" (replace-match :no-eval (replace-match "new") @@ -659,7 +662,9 @@ regexp (regexp-opt-depth :eval (regexp-opt-depth "\\(a\\(b\\)\\)")) (regexp-opt-charset - :eval (regexp-opt-charset '(?a ?b ?c ?d ?e)))) + :eval (regexp-opt-charset '(?a ?b ?c ?d ?e))) + (rx + :eval (rx (| (* "f") (+ "o") (? "o")) (any "bar") (group "baz")))) (define-short-documentation-group sequence "Sequence Predicates" -- 2.28.0