Function: llama--collect
llama--collect is a byte-compiled function defined in llama.el.
Signature
(llama--collect EXPR ARGS &optional FNPOS BACKQUOTED UNQUOTE)
Source Code
;; Defined in ~/.emacs.d/elpa/llama-20260301.1253/llama.el
(defun llama--collect (expr args &optional fnpos backquoted unquote)
(cond
((memq (car-safe expr) (list (intern "") 'llama 'quote)) expr)
((and backquoted (symbolp expr)) expr)
((and backquoted
(memq (car-safe expr)
(list backquote-unquote-symbol
backquote-splice-symbol)))
(list (car expr)
(llama--collect (cadr expr) args nil nil t)))
((memq (car-safe expr)
(list backquote-backquote-symbol
backquote-splice-symbol))
(list (car expr)
(llama--collect (cadr expr) args nil t)))
((symbolp expr)
(let ((name (symbol-name expr)))
(save-match-data
(cond
((string-match "\\`\\(_\\)?[%&]\\([1-9*]\\)?\\'" name)
(let* ((pos (match-string 2 name))
(pos (cond ((equal pos "*") 0)
((not pos) 1)
((string-to-number pos))))
(sym (aref args pos)))
(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)))
(if (match-string 1 name)
llama--unused-argument
expr))
(expr)))))
((or (listp expr)
(vectorp expr))
(let* ((vectorp (vectorp expr))
(expr (if vectorp (append expr ()) expr))
(fnpos (and (not vectorp)
(not backquoted)
(ignore-errors (length expr)))) ;proper-list-p
(ret ()))
(catch t
(while t
(let ((elt (llama--collect (car expr) args fnpos backquoted)))
(unless (eq elt llama--unused-argument)
(push elt ret)))
(setq fnpos nil)
(setq expr (cdr expr))
(unless (and expr
(listp expr)
(not (eq (car expr) backquote-unquote-symbol)))
(throw t nil))))
(setq ret (nreverse ret))
(when expr
(setcdr (last ret) (llama--collect expr args nil backquoted)))
(if vectorp (vconcat ret) ret)))
(expr)))