Project author Jean-Philippe Paradis
Project type Library
Programming language Common Lisp
Status Ready-to-use
License Public Domain
Library type Visual macro
Project complexity Embarrassingly trivial
Latest release Version 1.0.1
Date 4 oct 2012
Quicklisp
(Oct 2012 dist and later)
Status Available
Version Latest

macro-level is an embarrassingly trivial convenience macro that saves on indentation while being more concise and direct.

(macro-level
  ...)
==
;; Canonical indentation. macro-level saves 11 spaces.
(macrolet ((m ()
             ...))
  (m))
==
;; "Miser" indentation. macro-level saves 5 spaces.
(macrolet
    ((m ()
       ...))
  (m))

When used as part of a macroexpansion, macro-level also conveniently relieves the macro implementor from naming and using a gensym for the one-shot macro when compared to writing out a macrolet by hand, in addition to the other advantages.

To use macro-level, simply (macro-level:macro-level ...) after loading the ASDF system, as this macro is not used that often and the length won't have any effect on the indentation:

(macro-level:macro-level
  ...)
;; VS
(macro-level
  ...)

Simply (:import-from #:macro-level #:macro-level) in your defpackage if you prefer the latter form. Don't (:use)!

Support could eventually be added to Slime so that interactive macroexpansion of macro-level calls with C-c C-m (slime-expand-1) would show the same expansion as interactively macroexpanding (m ...) after (defmacro m () ...), assuming the lexical context is not important.