Function: bindat-defmacro

bindat-defmacro is a macro defined in bindat.el.gz.

Signature

(bindat-defmacro NAME ARGS &rest BODY)

Documentation

Define a new Bindat type as a macro.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bindat.el.gz
(defmacro bindat-defmacro (name args &rest body)
  "Define a new Bindat type as a macro."
  (declare (indent 2) (doc-string 3) (debug (&define name sexp def-body)))
  (let ((leaders ()))
    (while (and (cdr body)
                (or (stringp (car body))
                    (memq (car-safe (car body)) '(:documentation declare))))
      (push (pop body) leaders))
    ;; FIXME: Add support for Edebug decls to those macros.
    `(eval-and-compile ;; Yuck!  But needed to define types where you use them!
       (setf (alist-get ',name bindat--macroenv)
             (lambda ,args ,@(nreverse leaders)
               (bindat--fun ,(macroexp-progn body)))))))