branch: elpa/llama commit aab72b513fc661ddc76abf55ab2437bc56f86202 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Support backquote construct in place of FN --- llama-test.el | 8 ++++++++ llama.el | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/llama-test.el b/llama-test.el index 6650c61e6f..f3a9729121 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 diff --git a/llama.el b/llama.el index 44a66c0a95..e80f7d4f31 100644 --- a/llama.el +++ b/llama.el @@ -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))