diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2024-09-15 18:29:32 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2024-09-15 18:29:32 +0200 |
| commit | aab72b513fc661ddc76abf55ab2437bc56f86202 (patch) | |
| tree | 3a589af95e368c9ca934f3a7f4f88377705179d0 | |
| parent | a5fb525684260dee7c3381740e61421f7bb0ecc3 (diff) | |
Support backquote construct in place of FN
| -rw-r--r-- | llama-test.el | 8 | ||||
| -rw-r--r-- | llama.el | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/llama-test.el b/llama-test.el index 6650c61..f3a9729 100644 --- a/llama-test.el +++ b/llama-test.el @@ -364,6 +364,14 @@ (should (equal (##list `(,%1 %2 (,%3) ,%4 . ,%5)) (lambda (%1 _%2 %3 %4 %5) (list `(,%1 %2 (,%3) ,%4 . ,%5))))) + + (should (equal (##`(,%1 %2 ,%3)) + (lambda (%1 _%2 %3) + `(,%1 %2 ,%3)))) + + (should (equal (##`(,%1 %2 (,%3) ,%4 . ,%5)) + (lambda (%1 _%2 %3 %4 %5) + `(,%1 %2 (,%3) ,%4 . ,%5)))) ) (ert-deftest llama-test-901-errors-first nil @@ -135,8 +135,13 @@ The name `##' was chosen because that allows (optionally) omitting the whitespace between it and the following symbol. If you dislike this trickery, you can alternatively use this macro under the name `llama'." - (unless (symbolp fn) - (signal 'wrong-type-argument (list 'symbolp fn))) + (cond ((symbolp fn)) + ((and (eq (car-safe fn) backquote-backquote-symbol) + (not body)) + (setq body (cdr fn)) + (setq fn backquote-backquote-symbol)) + ((signal 'wrong-type-argument + (list 'symbolp backquote-backquote-symbol fn)))) (let* ((args (make-vector 10 nil)) (body (cdr (llama--collect (cons fn body) args))) (rest (aref args 0)) |
