branch: elpa/llama commit 2aaf14c414d425ff28c72530786b958eb1777e15 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
llama--collect: Signal error on all argument conflicts The assert was needlessly limited to the first argument, to catch specifically `%1'vs`%' and `&1'vs`&' (but also, e.g., `%1'vs`_&'). Now be also detect `%N'vs`&N', `%N'vs`_%N' and even conflicts were multiple aspects differ (e.g., `%2'vs`_&2'). We could just use `%N' in the arglist when both `%N' and `_%N' appear in the body. Since `_%N' is dropped from the body, that wouldn't result in an unbound variable error, as would happen in other cases. But that would both complicate the implementation and hide a user mistake, which could be of consequence (e.g., if they actually meant `_%N+1'). --- llama.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/llama.el b/llama.el index 0576fa4c1d..9f06a9cf90 100644 --- a/llama.el +++ b/llama.el @@ -152,11 +152,10 @@ It also looks a bit like #\\='function." (let* ((pos (match-string 2 name)) (pos (cond ((equal pos "*") 0) ((not pos) 1) - ((string-to-number pos))))) - (when (and (= pos 1) - (aref args 1) - (not (equal expr (aref args 1)))) - (error "`%s' and `%s' are mutually exclusive" expr (aref args 1))) + ((string-to-number pos)))) + (sym (aref args pos))) + (when (and sym (not (equal expr sym))) + (error "`%s' and `%s' are mutually exclusive" expr sym)) (aset args pos expr)) (if (match-string 1 name) llama--unused-argument