diff options
| author | Richard Stallman | 2025-02-15 06:40:35 -0500 |
|---|---|---|
| committer | Richard Stallman | 2025-02-15 06:40:35 -0500 |
| commit | f3ef16f86ffbb0ab5b76fa11e85eda5b1eff4b4b (patch) | |
| tree | 04350a0b911bbc6c589f610ad7a33562649c513b | |
| parent | 0f768b8843bcdbbfa1c64aeee64d2de7d62c0d13 (diff) | |
| download | emacs-f3ef16f86ffbb0ab5b76fa11e85eda5b1eff4b4b.tar.gz emacs-f3ef16f86ffbb0ab5b76fa11e85eda5b1eff4b4b.zip | |
Change criteria for non-exit cualse: car s to or a bind*.
* lisp/emacs-lisp/cond-star.el (cond*-non-exit-clause-p):
Don't check for keywords; a clause is non-exit if it
starts with t or with a bind*.
| -rw-r--r-- | lisp/emacs-lisp/cond-star.el | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/cond-star.el b/lisp/emacs-lisp/cond-star.el index 50566c97e70..c955e14f548 100644 --- a/lisp/emacs-lisp/cond-star.el +++ b/lisp/emacs-lisp/cond-star.el | |||
| @@ -47,21 +47,22 @@ A `cond*' construct is a series of clauses, and a clause | |||
| 47 | normally has the form (CONDITION BODY...). | 47 | normally has the form (CONDITION BODY...). |
| 48 | 48 | ||
| 49 | CONDITION can be a Lisp expression, as in `cond'. | 49 | CONDITION can be a Lisp expression, as in `cond'. |
| 50 | Or it can be one of `(pcase* PATTERN DATUM)', | 50 | Or it can be one of`(bind* BINDINGS...)', `(match* PATTERN DATUM)', |
| 51 | `(bind* BINDINGS...)', or `(match* PATTERN DATUM)', | 51 | or `(pcase* PATTERN DATUM)', |
| 52 | |||
| 53 | `(bind* BINDINGS...)' means to bind BINDINGS (as if they were in `let*') | ||
| 54 | for the body of the clause, and all subsequent clauses, since the `bind*' | ||
| 55 | clause is always a non-exit clause. As a condition, it counts as true | ||
| 56 | and runs the body of the clause if the first binding's value is non-nil. | ||
| 57 | |||
| 58 | `(match* PATTERN DATUM)' means to match DATUM against the pattern PATTERN | ||
| 59 | For its patterns, see `match*'. | ||
| 60 | The condition counts as true if PATTERN matches DATUM. | ||
| 52 | 61 | ||
| 53 | `(pcase* PATTERN DATUM)' means to match DATUM against the | 62 | `(pcase* PATTERN DATUM)' means to match DATUM against the |
| 54 | pattern PATTERN, using the same pattern syntax as `pcase'. | 63 | pattern PATTERN, using the same pattern syntax as `pcase'. |
| 55 | The condition counts as true if PATTERN matches DATUM. | 64 | The condition counts as true if PATTERN matches DATUM. |
| 56 | 65 | ||
| 57 | `(bind* BINDINGS...)' means to bind BINDINGS (as if they were in `let*') | ||
| 58 | for the body of the clause. As a condition, it counts as true | ||
| 59 | if the first binding's value is non-nil. All the bindings are made | ||
| 60 | unconditionally for whatever scope they cover. | ||
| 61 | |||
| 62 | `(match* PATTERN DATUM)' is an alternative to `pcase*' that uses another | ||
| 63 | syntax for its patterns, see `match*'. | ||
| 64 | |||
| 65 | When a clause's condition is true, and it exits the `cond*' | 66 | When a clause's condition is true, and it exits the `cond*' |
| 66 | or is the last clause, the value of the last expression | 67 | or is the last clause, the value of the last expression |
| 67 | in its body becomes the return value of the `cond*' construct. | 68 | in its body becomes the return value of the `cond*' construct. |
| @@ -69,7 +70,7 @@ in its body becomes the return value of the `cond*' construct. | |||
| 69 | Non-exit clause: | 70 | Non-exit clause: |
| 70 | 71 | ||
| 71 | If a clause has only one element, or if its first element is | 72 | If a clause has only one element, or if its first element is |
| 72 | a `bind*' clause, this clause never exits the `cond*' construct. | 73 | t or a `bind*' clause, this clause never exits the `cond*' construct. |
| 73 | Instead, control always falls through to the next clause (if any). | 74 | Instead, control always falls through to the next clause (if any). |
| 74 | All bindings made in CONDITION for the BODY of the non-exit clause | 75 | All bindings made in CONDITION for the BODY of the non-exit clause |
| 75 | are passed along to the rest of the clauses in this `cond*' construct. | 76 | are passed along to the rest of the clauses in this `cond*' construct. |
| @@ -149,10 +150,9 @@ ATOM (meaning any other kind of non-list not described above) | |||
| 149 | (and (cdr-safe clause) | 150 | (and (cdr-safe clause) |
| 150 | ;; Starts with t. | 151 | ;; Starts with t. |
| 151 | (or (eq (car clause) t) | 152 | (or (eq (car clause) t) |
| 152 | ;; Begins with keyword. | 153 | ;; Starts with a `bind*' pseudo-form. |
| 153 | (keywordp (car clause)))) | 154 | (and (consp (car clause)) |
| 154 | ;; Ends with keyword. | 155 | (eq (caar clause) 'bind*)))))) |
| 155 | (keywordp (car (last clause))))) | ||
| 156 | 156 | ||
| 157 | (defun cond*-non-exit-clause-substance (clause) | 157 | (defun cond*-non-exit-clause-substance (clause) |
| 158 | "For a non-exit cond* clause CLAUSE, return its substance. | 158 | "For a non-exit cond* clause CLAUSE, return its substance. |