2013-06-06

Emacs: Stop Cursor Going into Minibuffer Prompt

Perm URL with updates: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html

in emacs minibuffer prompt, when you presses the left arrow key, the cursor will move back all the way over the prompt text. This is annoying because user often will hold down 【Alt+b】 to move back by word to edit, and when user starts to type something, emacs will say “This is read-only”. Then you have to manually move cursor out of the prompt. You can try it now by calling query-replace or shell-command.

Here's how to set the cursor not going into prompt:

;; don't let the cursor go into minibuffer prompt
(setq minibuffer-prompt-properties (quote (read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)))