[slime-devel] [Feature Request:] keeping history for several macroexpansions in a row

Tobias C. Rittweiler tcr at freebits.de
Sat Jan 21 17:25:24 UTC 2006


Hi Slime-hackers,

I'd like to suggest keeping a stack-like history for several
macroexpansions in a row such that you can easily go back one
macroexpansion after you've macroexpanded a form /inside/ the
macroexpansion buffer. Erm, yeah, sure, here's a small example:

Let's say you have two macros like these:

  (defmacro with-foo (() &body body)
    `(flet ((foo (arg) arg))
       , at body))

  (defmacro with-bar ((arg) &body body)
    `(with-foo ()
       (prog1 (foo ,arg) , at body)))

Ah, well, hopefully yours will do something less stupid. Anyway, let's
further say that you want to macroexpand (`C-c RET') the following form:

  (with-bar ('foobar)
    (let ((x 1))
      (* x x)))

the macroexpansion buffer should pop up containing something like

  (WITH-FOO NIL
    (PROG1 (FOO 'FOOBAR)
      (LET ((X 1))
        (* X X))))

Now you want to expand that form as well, so you place point before
`(WITH-FOO' and press `C-c RET' again, now the old expansion buffer
disappears and instead a new one pops up in some other window. While
it's cool that macroexpansion works from within the macroexpansion
buffer, the current behaviour is unfortunately somewhat annoying,
because upon exit from the expansion buffer (via pressing `q'), -- while
the old buffer constellation is nicely recovered as of before any
macroexpansion --, the point won't afterwards be in the same window
where you started macroexpansion.

(Split your emacs horizentally, on top the REPL, on the bottom the
slime-scratch buffer; now paste the above form in the REPL and do a
macroexpansion there, slime-scratch will be replaced by the expansion
buffer; now expand again from inside the macroexpansion buffer, a new
expansion buffer will be placed into the REPL window; there press `q'
and the point will be within slime-scratch although you started from the
REPL.)

I suggest a slightly different behaviour when expanding a form from
within the macroexpansion buffer: the old buffer should be reused and
you should be able to go back to the previous macroexpansion (like what
`l' does in the inspector.)


Additionally I'd like to suggest a way to macroexpand into a newly
created macroexpansion buffer that's independant from a possibly other
expansion buffer that got created prior. The purpose is simply for
side-by-side comparasions of the same macro but that was modified in
between.


Finally, I'm often hit by not releasing the control-key fast enough such
that a `C-c C-RET' key sequence is generated. Maybe that could be made
an alias for `C-c RET'?


Keep up the great work!

  -*- tcr





More information about the slime-devel mailing list