In scratch buffer, Emacs can expand macros(C-c e; macrostep-expand). But once I expanded the macro, it seems to become a read-only buffer. I don't know how to end macro expansion and return to writable buffer.

It would be very helpful if you could tell me the solution.

My environment is below.

  • GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
  • WSL2


EDIT macro-expansion is a function of macrostep.el.

  • 1
    C-c e is reserved for end users, so whatever it is bound to, it should be you who defined that keybinding (hence we don't know what that might be). If something else has bound C-c e (or any C-c LETTER) then please report it as a bug, as that's in breach of the documented conventions. – phils May 24 at 12:00
  • Sorry for the lack of information. In my setting, C-c e is bound to macrostep-expand. – muon May 24 at 12:37
  • What is macrostep-expand, and where is it defined? I don't see it in Emacs 27.1 from emacs -Q. Please provide all relevant info in your question. – Drew May 24 at 18:03
  • Is this about keyboard macros or Elisp macros? The question is unclear. I suspect it might be the former, in which case the tags are wrong. Unless you clarify the question it should be closed, I think. – Drew May 24 at 18:04
  • 1
    macro-expand is a function of macrostep.el. – muon May 24 at 21:52

The solution was just to press q on the expanded macro.

according to M-x describe-bindings

q       macrostep-collapse-all
c       macrostep-collapse
u       macrostep-collapse
DEL     macrostep-collapse
n       macrostep-next-macro
p       macrostep-prev-macro
e       macrostep-expand
  • You didn't answer the questions in my comment, so the question (and answer) remain unclear. Based on the answer I'm guessing this is about keyboard macros, not Elisp macros, but you should provide a reference (link) for macrostep-*. – Drew May 24 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.