aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/control.texi3
-rw-r--r--lisp/emacs-lisp/pcase.el7
2 files changed, 7 insertions, 3 deletions
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index f85ee947790..adec632da6a 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -317,7 +317,8 @@ list of the form @code{(@var{pattern} @var{body-forms}@dots{})}.
317@var{pattern} of each clause, in textual order. If the value matches, 317@var{pattern} of each clause, in textual order. If the value matches,
318the clause succeeds; @code{pcase} then evaluates its @var{body-forms}, 318the clause succeeds; @code{pcase} then evaluates its @var{body-forms},
319and returns the value of the last of @var{body-forms}. Any remaining 319and returns the value of the last of @var{body-forms}. Any remaining
320@var{clauses} are ignored. 320@var{clauses} are ignored. If no clauses match, then the @code{pcase}
321form evaluates to @code{nil}.
321 322
322The @var{pattern} part of a clause can be of one of two types: 323The @var{pattern} part of a clause can be of one of two types:
323@dfn{QPattern}, a pattern quoted with a backquote; or a 324@dfn{QPattern}, a pattern quoted with a backquote; or a
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 6cfd074cf0b..ce148c9e1a9 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -118,7 +118,9 @@ two element list, binding its elements to symbols named `foo' and
118 118
119A significant difference from `cl-destructuring-bind' is that, if 119A significant difference from `cl-destructuring-bind' is that, if
120a pattern match fails, the next case is tried until either a 120a pattern match fails, the next case is tried until either a
121successful match is found or there are no more cases. 121successful match is found or there are no more cases. The CODE
122expression corresponding to the matching pattern determines the
123return value. If there is no match the returned value is nil.
122 124
123Another difference is that pattern elements may be quoted, 125Another difference is that pattern elements may be quoted,
124meaning they must match exactly: The pattern \\='(foo bar) 126meaning they must match exactly: The pattern \\='(foo bar)
@@ -211,7 +213,8 @@ Emacs Lisp manual for more information and examples."
211 213
212;;;###autoload 214;;;###autoload
213(defmacro pcase-exhaustive (exp &rest cases) 215(defmacro pcase-exhaustive (exp &rest cases)
214 "The exhaustive version of `pcase' (which see)." 216 "The exhaustive version of `pcase' (which see).
217If EXP fails to match any of the patterns in CASES, an error is signaled."
215 (declare (indent 1) (debug pcase)) 218 (declare (indent 1) (debug pcase))
216 (let* ((x (gensym "x")) 219 (let* ((x (gensym "x"))
217 (pcase--dontwarn-upats (cons x pcase--dontwarn-upats))) 220 (pcase--dontwarn-upats (cons x pcase--dontwarn-upats)))