Function: cl-macrolet

cl-macrolet is an autoloaded macro defined in cl-macs.el.gz.

Signature

(cl-macrolet ((NAME ARGLIST BODY...) ...) FORM...)

Documentation

Make temporary macro definitions.

This is like cl-flet, but for macros instead of functions.

View in manual

Probably introduced at or before Emacs version 29.1.

Aliases

macrolet (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-macs.el.gz
;; The following ought to have a better definition for use with newer
;; byte compilers.
;;;###autoload
(defmacro cl-macrolet (bindings &rest body)
  "Make temporary macro definitions.
This is like `cl-flet', but for macros instead of functions.

\(fn ((NAME ARGLIST BODY...) ...) FORM...)"
  (declare (indent 1)
           (debug (&interpose (&rest (&define [&name symbolp "@cl-macrolet@"]
                                              [&name [] gensym] ;Make it unique!
                                              cl-macro-list
                                              cl-declarations-or-string
                                              def-body))
                              cl--edebug-macrolet-interposer
                              cl-declarations body)))
  (if (cdr bindings)
      `(cl-macrolet (,(car bindings)) (cl-macrolet ,(cdr bindings) ,@body))
    (if (null bindings) (macroexp-progn body)
      (let* ((name (caar bindings))
	     (res (cl--transform-lambda (cdar bindings) name)))
	(macroexpand-all (macroexp-progn body)
			 (cons (cons name
                                     (eval `(function (lambda ,@res)) t))
			       macroexpand-all-environment))))))