Function: cider-macrostep-expand-all

cider-macrostep-expand-all is an autoloaded, interactive and byte-compiled function defined in cider-macrostep.el.

Signature

(cider-macrostep-expand-all)

Documentation

Fully expand the form before point, inline.

Unlike cider-macrostep-expand, which expands one level at a time, this expands the form all the way (macroexpand-all), so you needn't step through every level. Place point right after the form, as with M-x cider-eval-form (cider-eval-form).

Like cider-macrostep-expand, this starts a cider-macrostep-mode(var)/cider-macrostep-mode(fun) session when one isn't active, and expands the form of the expandable operator at point when n/p has landed there. It does not require the form's head to be a macro, since a fully-recursive expansion can reach macros in nested sub-forms.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-macrostep.el
;;;###autoload
(defun cider-macrostep-expand-all ()
  "Fully expand the form before point, inline.
Unlike `cider-macrostep-expand', which expands one level at a time, this
expands the form all the way (`macroexpand-all'), so you needn't step through
every level.  Place point right after the form, as with
`\\[cider-eval-form]'.

Like `cider-macrostep-expand', this starts a `cider-macrostep-mode' session
when one isn't active, and expands the form of the expandable operator at
point when `n'/`p' has landed there.  It does not require the form's head to
be a macro, since a fully-recursive expansion can reach macros in nested
sub-forms."
  (interactive)
  (cider-ensure-session)
  (pcase-let ((`(,beg . ,end) (or (cider-macrostep--expand-bounds)
                                  (user-error "No sexp before point to expand"))))
    (let* ((code (buffer-substring-no-properties beg end))
           (expansion (cider-macrostep--expand code "macroexpand-all")))
      (unless (and (stringp expansion) (not (string-blank-p expansion)))
        (user-error "No expansion returned"))
      ;; Compare with whitespace normalized, so the printer merely reindenting
      ;; an already-fully-expanded form still counts as "nothing to expand".
      (when (string= (replace-regexp-in-string "[ \t\n]+" " " (string-trim expansion))
                     (replace-regexp-in-string "[ \t\n]+" " " (string-trim code)))
        (user-error "Nothing to expand"))
      (cider-macrostep--expand-region beg end expansion)
      (cider-macrostep--refresh-overlays))))