Function: gnus--let-eval

gnus--let-eval is a macro defined in gnus-salt.el.gz.

Signature

(gnus--let-eval BINDINGS EVALSYM &rest BODY)

Documentation

Build an environment in which to evaluate expressions.

BINDINGS is a let-style list of bindings to use for the environment. EVALSYM is then bound in BODY to a function that takes a sexp and evaluates it in the environment specified by BINDINGS.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-salt.el.gz
(defmacro gnus--let-eval (bindings evalsym &rest body)
  "Build an environment in which to evaluate expressions.
BINDINGS is a `let'-style list of bindings to use for the environment.
EVALSYM is then bound in BODY to a function that takes a sexp and evaluates
it in the environment specified by BINDINGS."
  (declare (indent 2) (debug ((&rest (sym form)) sym body)))
  (if (ignore-errors (let ((x 3)) (eq (eval '(- x 1) '((x . 4))) x)))
      ;; Use lexical vars if possible.
      `(let* ((env (list ,@(mapcar (lambda (binding)
                                     `(cons ',(car binding) ,(cadr binding)))
                                   bindings)))
             (,evalsym (lambda (exp) (eval exp env))))
         ,@body)
    `(let (,@bindings (,evalsym #'eval)) ,@body)))