So I was working in emacs and the suddenly, the slime-repl sbcl says text is read only. Well that's great because now I can't type anything into it. How do I fix?
-
6`C-x C-q` is how to enable or disable read-only mode. I'm not yet comfortable posting it as an answer, however, because you may be more interested in knowing what may have caused that behavior and I'm unfamiliar with the library you mentioned. – lawlist Jul 04 '14 at 00:23
-
1@lawlist I'd say go ahead and suggest it as an answer, as to **how to disable read-only** in the buffer. The OP can always search more to find out why the buffer was suddenly made read-only. That's a separate question (at least until more info to answer it is provided here). – Drew Jul 04 '14 at 02:39
-
1If it says that "text" is read-only (rather than "buffer"), then there's probably a `read-only` text property in effect? – phils Jul 04 '14 at 04:55
-
@Drew "Buffer is read only" is much, much different from "text is read-only." The `C-x C-q` command toggles "buffer is read only" while nothing seems to change "text is read only," which I got into because my finger hit the wrong key (I don't know which key I hit). Now I have to restart SLIME and lose my work. :( – Throw Away Account Apr 21 '15 at 01:28
-
2Yes, if it said "text is read-only" (which means error `text-read-only`) then the text at point has a read-only text property on it. The Elisp manual, node [`Special Properties`](http://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Properties.html), says this: " Since changing properties counts as modifying the buffer, it is not possible to remove a `read-only` property unless you know the special trick: bind `inhibit-read-only` to a non-`nil` value and then remove the property. *Note Read Only Buffers." – Drew Apr 21 '15 at 01:36
6 Answers
"Buffer is read-only" can be cured by C-x C-q
but as Drew & phils said,
"Text is read-only" is very different -- it means
some part of the buffer has a read-only property.
Try moving away from the read-only part, e.g., to the end of the buffer.
Emacs Lisp Manual > elisp.info > Text > Text Properties > Special Properties
Since changing properties counts as modifying the buffer, it is not
possible to remove a `read-only' property unless you know the
special trick: bind `inhibit-read-only' to a non-`nil' value and
then remove the property. *Note Read Only Buffers::.
thus to erase the entire buffer regardless:
M-: (let ((inhibit-read-only t)) (erase-buffer)) RET
or to remove all properties:
(let ((inhibit-read-only t)) (set-text-properties (point-min) (point-max) ()))
-
8This is the only answer that understand that it's not a read-only buffer, so C-x C-q doesn't solve the issue at all. – JaviMerino Oct 05 '15 at 11:36
-
-
2For new emacs users, devon above is running command: eval-expression . Its default key definition is M-: (usually escape-colon). After running eval-expression, it prompts you to type in (or paste) your lisp expression into the mini-buffer and hit
– AAAfarmclub Jun 14 '17 at 06:38
I can't offer any insight into why you ended up with undesirable read-only text properties, but I occasionally encounter similar situations and so find the following command useful.
Select the region in question (or C-xh for the entire buffer), and run M-x set-region-writeable
to remove the read-only text properties.
(defun set-region-writeable (begin end)
"Removes the read-only text property from the marked region."
;; See http://stackoverflow.com/questions/7410125
(interactive "r")
(let ((modified (buffer-modified-p))
(inhibit-read-only t))
(remove-text-properties begin end '(read-only t))
(set-buffer-modified-p modified)))

- 71,335
- 11
- 153
- 198
-
I prefer this answer to the most popular one on this thread. This was really easy to open my *scratch* buffer, paste in this code, evaluate it, then switch back to the buffer that had the problem. Then mark the region, and then `M-x set-region-writable`. – taudep Feb 21 '20 at 15:27
-
See https://stackoverflow.com/a/20027146/324105 for a slightly improved version of this function. – phils Feb 21 '20 at 22:40
Possible cause of such a message may be this: you are trying to print something over the REPL prompt, for example CL-US|ER> (+ 1 2)
. This text in the SLIME buffer is read-only. Note the space after >
, it is the part of the prompt.

- 198
- 1
- 7
Try typing C-c M-o RET
(it will clear the console and add a new line), I had a problem similar to yours and for it fixed it.

- 3,210
- 2
- 27
- 46
I solved this by first opening two frames, one with a .lisp file opened and the other with the slime-repl.
From the frame with the .lisp file, I applied C-c C-j on a line of code (e.g (+ 1 2)).
This copied the line of code down to the slime-repl and evaluated it.
This also somehow solved the problem with the "text is read only" problem.
You can change read-only mode by doing: M-x
-> toggle-read-only
-> RET
(in other words press enter)

- 680
- 7
- 23