Say I want to create a file. Then I was asked to enter the name. I want to use the date as the name of file. I want to use M-x insert date (I define myself)
. How can I do that?
Asked
Active
Viewed 101 times
3

yuxuan
- 417
- 5
- 16
1 Answers
4
Set (or bind, depending on the context) variable enable-recursive-minibuffers
to non-nil
(e.g. t
), before the first entry into the minibuffer.
That lets you use actions, such as M-x
which themselves activate the minibuffer, from within a minibuffer. The second activation takes place in a recursive minibuffer. When it ends (e.g. you hit RET
after replying to the M-x
prompt), things continue as they were, with the initial minibuffer still active.

Drew
- 29,895
- 7
- 74
- 104
-
3yuxuan: I recommend also using `(minibuffer-depth-indicate-mode 1)` so that you can see when you're in a recursive minibuffer. Without this it can get confusing. – phils Nov 02 '15 at 06:25
-
I second @phils suggestion. See also library [`mbdepth+.el`](http://www.emacswiki.org/emacs/download/mb-depth%2b.el), which lets you customize the indicator. I also use [`oneonone.el`](http://www.emacswiki.org/emacs/download/oneonone.el), which makes it even more obvious when a recursive minibuffer is entered. – Drew Nov 02 '15 at 15:14
-
And, don't forget about `M-x abort-recursive-edit` or `C-]` in case you get deep into the recursive edit and want to jump out of the stack. – Trey Jackson Nov 02 '15 at 18:36
-
@TreyJackson: Yes. Also, `C-g` acts normally in the minibuffer, but at top-level of the minibuffer (i.e., not within some command), it too pops up a recursive level. – Drew Nov 02 '15 at 18:49