When This is reproducible in emacs -Q
in my version of GNU Emacs running on my Ubuntu machine:
GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian
The steps below are intended to allow me to "select" (mark) all of the text in the default value of any minibuffer prompt, and immediately start typing which should erase the marked text (M-x delete-selection-mode
), but not error out with the "Text is read-only" error because I've also marked the prompt part of the minibuffer text:
- Type:
M-x eval-expression
- Type:
(read-string "foo")
- Type:
C-x h
which runs the command mark-whole-buffer which positions point at(point-min)
in the minibuffer, which is just to the left of the read-only text - Type:
x
(or any character that would insert that character) - See the error:
Text is read-only
What I expect to happen is that only the writable text is selected by C-x h
and not the read-only prompt text.
I don't want to have to play games with hook functions that I replace the C-x h binding to (e.g., using text properties such as given in https://emacs.stackexchange.com/a/2133/15483), unless there isn't a cleaner way.
I tried to use the tips suggested in http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html but that does not inhibit motion back to (point-min)
, that is, this does not work:
(setq minibuffer-prompt-properties (quote (read-only t cursor-intangible t face minibuffer-prompt)))
I suspect there is some special property (https://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Properties.html) that prevents the cursor from "hopping over" the read-only prompt part of the minibuffer, but I can't figure out just what it might be.