I'm not sure if I fully understand the use-cases of recursive edit.
Nor am I sure if I worded this question correctly.

But every now and then when I'm doing something I'll look at the minibuffer and see that I'll be currently in a layer of recursive-edit, when I'm certain I didn't do anything explicitly to activate it.
(as shown in the screenshot below) enter image description here

Since this seems rather harmless, I'm wondering what the implications would be (or any problems I might run into) if I were to work in multiple layers of recursive-edit over the course of an editing session?
(as shown in the screenshot below) enter image description here

Obviously I would never do this, because it doesn't seem practical. But I'm wondering if any unexpected things would happen whilst editing?

1 Answer 1


The Emacs manual node Recursive Edit explains the phenomenon. In a way it's like having another editing session (typically temporarily), with the same buffers etc. available (for the most part).

That node of the manual gives one example of how or why you might use it: you can use C-r to pause aquery-replace, then make some editing changes or search around a bit, visit other buffers to check things, etc., and then end the recursive edit and resume query-replacing where you left off.

Another place you might run into it (well, it's mostly the same kind of thing) is in some commands that use the minibuffer. Some such commands might prompt you for something but let you use commands while you are in the minibuffer which, themselves, might ask you something. The second prompt opens another (recursive) minibuffer "on top" (in the same place as) the first one. Answering that second prompt exits that recursive minibuffer, returning you to the original minibuffer so you can finish answering its prompt.

If you find yourself in a deeply nested minibuffer, as is shown in your screenshot, it's an indication that you probably did something that accidentally opened a recursive minibuffer. For example, maybe you used C-r during query-replace and you never resumed that query-replace; then you started a new query-replace etc. (It's also possible that some code you are using mistakenly leaves you in a recursive edit.)

Because this can be confusing, especially for someone not used to it, variable enable-recursive-minibuffers is nil by default. But some commands bind it to non-nil while they ask for minibuffer input - again, to allow you to use keys/commands that might ask you something.

To jump back to the top level (no active minibuffer at all), you can use M-x top-level. To pop out of the current minibuffer level you can use C-] (abort-recursive-edit).

There's no requirement to end any given level of recursive minibuffer. You can stay in a recursive edit forever, until you quit Emacs, if you like. But there's generally no reason not to exit a recursive edit when you are done taking that side trip.

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.