Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Previous: Minibuffer History, Up: Minibuffer


9.5 Repeating Minibuffer Commands

Every command that uses the minibuffer at least once is recorded on a special history list, together with the values of its arguments, so that you can repeat the entire command. In particular, every use of M-x is recorded there, since M-x uses the minibuffer to read the command name.

C-x <ESC> <ESC>
Re-execute a recent minibuffer command (repeat-complex-command).
M-x list-command-history
Display the entire command history, showing all the commands C-x <ESC> <ESC> can repeat, most recent first.

C-x <ESC> <ESC> is used to re-execute a recent minibuffer-using command. With no argument, it repeats the last such command. A numeric argument specifies which command to repeat; one means the last one, and larger numbers specify earlier ones.

C-x <ESC> <ESC> works by turning the previous command into a Lisp expression and then entering a minibuffer initialized with the text for that expression. If you type just <RET>, the command is repeated as before. You can also change the command by editing the Lisp expression. Whatever expression you finally submit is what will be executed. The repeated command is added to the front of the command history unless it is identical to the most recently executed command already there.

Even if you don't understand Lisp syntax, it will probably be obvious which command is displayed for repetition. If you do not change the text, it will repeat exactly as before.

Once inside the minibuffer for C-x <ESC> <ESC>, you can use the minibuffer history commands (M-p, M-n, M-r, M-s; see Minibuffer History) to move through the history list of saved entire commands. After finding the desired previous command, you can edit its expression as usual and then resubmit it by typing <RET> as usual.

Incremental search does not, strictly speaking, use the minibuffer, but it does something similar. Although it behaves like a complex command, it normally does not appear in the history list for C-x <ESC> <ESC>. You can make it appear in the history by setting isearch-resume-in-command-history to a non-nil value. See Incremental Search.

The list of previous minibuffer-using commands is stored as a Lisp list in the variable command-history. Each element is a Lisp expression which describes one command and its arguments. Lisp programs can re-execute a command by calling eval with the command-history element.


 
 
  Published under the terms of the GNU General Public License Design by Interspire