branch: elpa/llama commit 8fdcde4aafbd6d5768fa135d9e2a7bc1ae95b23a Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
llama--collect: Support % and & directly following ,unquote --- llama-test.el | 8 ++++++++ llama.el | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/llama-test.el b/llama-test.el index 792d32e48a..5db9123271 100644 --- a/llama-test.el +++ b/llama-test.el @@ -389,6 +389,14 @@ (lambda (%1 _%2 %3 %4 %5) `(,%1 %2 (,%3) ,%4 . ,%5)))) + (should (equal (##list `(,% ,@% %)) + (lambda (%) + (list `(,% ,@% %))))) + + (should (equal (##list `(% ,%2)) + (lambda (_%1 %2) + (list `(% ,%2))))) + (should (equal (##list `(,@%1 %2 ,%3 (,@%3 ,%1))) (lambda (%1 _%2 %3) (list `(,@%1 %2 ,%3 (,@%3 ,%1)))))) diff --git a/llama.el b/llama.el index dfd75de11f..2f2c42009b 100644 --- a/llama.el +++ b/llama.el @@ -183,7 +183,7 @@ to view this docstring.)" (defconst llama--unused-argument (make-symbol "llama--unused-argument")) -(defun llama--collect (expr args &optional fnpos backquoted) +(defun llama--collect (expr args &optional fnpos backquoted unquote) (cond ((memq (car-safe expr) (list (intern "") 'llama 'quote)) expr) ((and backquoted (symbolp expr)) expr) @@ -192,7 +192,7 @@ to view this docstring.)" (list backquote-unquote-symbol backquote-splice-symbol))) (list (car expr) - (llama--collect (cadr expr) args))) + (llama--collect (cadr expr) args nil nil t))) ((memq (car-safe expr) (list backquote-backquote-symbol backquote-splice-symbol)) @@ -208,7 +208,7 @@ to view this docstring.)" ((not pos) 1) ((string-to-number pos)))) (sym (aref args pos))) - (unless (and fnpos (memq expr '(% &))) + (unless (and fnpos (not unquote) (memq expr '(% &))) (when (and sym (not (equal expr sym))) (error "`%s' and `%s' are mutually exclusive" sym expr)) (aset args pos expr)))