windows 10, Emacs 25.1, Helm

I open buffer scratch

and execute 3 commands sequence:

  1. M-x I-search
  2. helm-occur
  3. replace-string

here sreenshots: enter image description here enter image description here enter image description here

Nice. It's work fine. But now I want to show in list all of this commands in stack mode.

Smt like this:


And then I want to select one of them (e.g. I-search) and execute them.

How I can do this?

3 Answers 3


If you are looking to have commands that you previously entered at the M-x prompt available as completion candidates, then Icicles can help.

There are several ways in which you can use completion against candidates from minibuffer histories. One simple one is to use M-h. For example, M-x M-h shows your M-x inputs in buffer *Completions*. You can type text to complete or just cycle to the command you want, etc.

UPDATE to reply to comment question:

You can download Icicles from EmacsWiki. See Downloading Icicles Libraries.

  • Where I can download package "icicles"? In MELPA it not found Sep 1, 2018 at 12:09
  • 1
    @Alexei: Updated answer to provide that info. Thx.
    – Drew
    Sep 1, 2018 at 14:57

Looks like you already use helm - as you gave the example of helm-occur. Helm comes with helm-minibuffer-history - try

M-x helm-minibuffer-history

The usual way of selecting helm candidates works here too.

  • 2
    I get error: helm-M-x: Error: Attempt to use minibuffer history outside a minibuffer Aug 17, 2018 at 16:12
  • Known bug : github.com/emacs-helm/helm/issues/1655. Update your helm, restart emacs to be sure, and then try again.
    – Jeeves
    Aug 17, 2018 at 16:43
  • Doesn't work for me either. Even with an updated helm and a restarted Emacs, I still get the same error as @a_subscriber.
    – kotchwane
    Mar 18, 2021 at 12:51

There are any number of minibuffer histories, each recording minibuffer input for various calls to completing-read.

You seem to be looking for the history of commands entered at the M-x prompt. Variable extended-command-history records that history. So just use C-h v extended-command-history to see the list in *Help*, or just evaluate extended-command-history in Lisp to get the list.

  • No customizable group, face, or option matching (extended-command-history) Aug 28, 2018 at 7:16
  • Minibuffer history variables, and extended-command-history, are not user options. They are used to record minibuffer input. You or Lisp code can use them (including reset any of them) at any time. C-h v shows a list value for extended-command-history: the commands you invoked using M-x. In the example you cite, you apparently invoked (only) those 4 commands using M-x.
    – Drew
    Aug 28, 2018 at 13:58
  • I want to select command from list (like helm do). Not like this: extended-command-history is a variable defined in ‘simple.el’. Its value is ("helm-occur" "yafolding-hide-element" "json-pretty-print" "yafolding-show-element" "highlight-symbol-remove-all" "magit-status" "customize-variable" "rename-buffer" "magit-list-repositories" "new-frame") Aug 28, 2018 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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