Function: cl--gv-adapt

cl--gv-adapt is a byte-compiled function defined in cl.el.gz.

Signature

(cl--gv-adapt CL-GV DO)

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/cl.el.gz
;; Generalized variables are provided by gv.el, but some details are
;; not 100% compatible: not worth the trouble to add them to cl-lib.el, but we
;; still need to support old users of cl.el.

(defun cl--gv-adapt (cl-gv do)
  ;; This function is used by all .elc files that use define-setf-expander and
  ;; were compiled with Emacs>=24.3.
  (let ((vars (nth 0 cl-gv))
        (vals (nth 1 cl-gv))
        (binds ())
        (substs ()))
    ;; Use cl-sublis as was done in cl-setf-do-modify.
    (while vars
      (if (macroexp-copyable-p (car vals))
          (push (cons (pop vars) (pop vals)) substs)
        (push (list (pop vars) (pop vals)) binds)))
    (macroexp-let*
     binds
     (funcall do (cl-sublis substs (nth 4 cl-gv))
              ;; We'd like to do something like
              ;; (lambda ,(nth 2 cl-gv) ,(nth 3 cl-gv)).
              (lambda (exp)
                (macroexp-let2 macroexp-copyable-p v exp
                  (cl-sublis (cons (cons (car (nth 2 cl-gv)) v)
                                   substs)
                             (nth 3 cl-gv))))))))