Function: add-to-list--anon-cmacro
add-to-list--anon-cmacro is a function defined in subr.el.gz.
Signature
(add-to-list--anon-cmacro EXP LIST-VAR ELEMENT &optional APPEND COMPARE-FN)
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
;; Closure converted to defun by helpful.
(defun add-to-list--anon-cmacro
(exp list-var element &optional append compare-fn)
(if
(or
(not
(eq 'quote
(car-safe list-var)))
(special-variable-p
(cadr list-var))
(not
(macroexp-const-p append)))
exp
(let*
((sym
(cadr list-var))
(append
(eval append))
(msg
(format-message "`add-to-list' can't use lexical var `%s'; use `push' or `cl-pushnew'" sym))
(warnfun
(lambda nil
(when
(assq sym byte-compile--lexical-environment)
(byte-compile-report-error msg :fill))))
(code
(macroexp-let2 macroexp-copyable-p x element
`(if ,(if compare-fn
(progn
(require 'cl-lib)
`(cl-member ,x ,sym :test ,compare-fn))
`(member ,x ,sym))
,sym ,(if append
`(setq ,sym
(append ,sym
(list ,x)))
`(push ,x ,sym))))))
(if
(not
(macroexp-compiling-p))
code
`(progn
(macroexp--funcall-if-compiled ',warnfun)
,code)))))