diff options
author | Thien-Thi Nguyen <ttn@gnu.org> | 2018-05-21 17:16:31 +0200 |
---|---|---|
committer | Thien-Thi Nguyen <ttn@gnu.org> | 2018-05-27 10:36:35 +0200 |
commit | 4d7e54acff0869d42bfb5b95014f7e6b988666d5 (patch) | |
tree | 16bbdbb623f314dd0cf595280147e2885f67c364 /lisp | |
parent | 7e8227ed68357dd05cb7a4ce931e5cafe6c9dd5a (diff) | |
download | emacs-4d7e54acff0869d42bfb5b95014f7e6b988666d5.tar.gz emacs-4d7e54acff0869d42bfb5b95014f7e6b988666d5.tar.bz2 emacs-4d7e54acff0869d42bfb5b95014f7e6b988666d5.zip |
Use EXPVAL in docstrings of patterns defined using pcase-defmacro
Suggested by Drew Adams (Bug#31311).
* lisp/emacs-lisp/cl-macs.el (cl-struct): ...here.
* lisp/emacs-lisp/eieio.el (eieio): Likewise.
* lisp/emacs-lisp/radix-tree.el (radix-tree-leaf): Likewise.
* lisp/emacs-lisp/rx.el (rx): Likewise.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 8 | ||||
-rw-r--r-- | lisp/emacs-lisp/eieio.el | 8 | ||||
-rw-r--r-- | lisp/emacs-lisp/radix-tree.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/rx.el | 2 |
4 files changed, 11 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 971f4f926bd..9c47ceae18e 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2887,10 +2887,10 @@ non-nil value, that slot cannot be set via `setf'. ;;;###autoload (pcase-defmacro cl-struct (type &rest fields) - "Pcase patterns to match cl-structs. -Elements of FIELDS can be of the form (NAME PAT) in which case the contents of -field NAME is matched against PAT, or they can be of the form NAME which -is a shorthand for (NAME NAME)." + "Pcase patterns that match cl-struct EXPVAL of type TYPE. +Elements of FIELDS can be of the form (NAME PAT) in which case the +contents of field NAME is matched against PAT, or they can be of +the form NAME which is a shorthand for (NAME NAME)." (declare (debug (sexp &rest [&or (sexp pcase-PAT) sexp]))) `(and (pred (pcase--flip cl-typep ',type)) ,@(mapcar diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 78275acd9c2..b95f7486f76 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -346,10 +346,10 @@ variable name of the same name as the slot." index)))) (pcase-defmacro eieio (&rest fields) - "Pcase patterns to match EIEIO objects. -Elements of FIELDS can be of the form (NAME PAT) in which case the contents of -field NAME is matched against PAT, or they can be of the form NAME which -is a shorthand for (NAME NAME)." + "Pcase patterns that match EIEIO object EXPVAL. +Elements of FIELDS can be of the form (NAME PAT) in which case the +contents of field NAME is matched against PAT, or they can be of + the form NAME which is a shorthand for (NAME NAME)." (declare (debug (&rest [&or (sexp pcase-PAT) sexp]))) (let ((is (make-symbol "table"))) ;; FIXME: This generates a horrendous mess of redundant let bindings. diff --git a/lisp/emacs-lisp/radix-tree.el b/lisp/emacs-lisp/radix-tree.el index 8946560d3ba..d76bf024d0a 100644 --- a/lisp/emacs-lisp/radix-tree.el +++ b/lisp/emacs-lisp/radix-tree.el @@ -196,6 +196,8 @@ If not found, return nil." (eval-and-compile (pcase-defmacro radix-tree-leaf (vpat) + "Build a `pcase' pattern that matches radix-tree leaf EXPVAL. +VPAT is a `pcase' pattern to extract the value." ;; FIXME: We'd like to use a negative pattern (not consp), but pcase ;; doesn't support it. Using `atom' works but generates sub-optimal code. `(or `(t . ,,vpat) (and (pred atom) ,vpat)))) diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index c4f6d4f70ea..302ee23db6a 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1177,7 +1177,7 @@ enclosed in `(and ...)'. (pcase-defmacro rx (&rest regexps) "Build a `pcase' pattern matching `rx' regexps. The REGEXPS are interpreted as by `rx'. The pattern matches if -the regular expression so constructed matches the object, as if +the regular expression so constructed matches EXPVAL, as if by `string-match'. In addition to the usual `rx' constructs, REGEXPS can contain the |