I have a buffer in read-only mode.
Killing the buffer and reopening it does not do the job while restarting emacs does.
How to exit the read-only mode without restarting emacs?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityCalling read-only-mode
toggles between read-only and edit mode for the current buffer.
You can call this via M-x read-only-mode or with C-x C-q.
To add a bit to @Juancho's answer, which is correct:
The default value of read-only-mode
depends on the buffer. In particular, if it is visiting a file, and if the file itself is read-only, then the default value of read-only-mode
will be on.
You can toggle such a buffer, as @Juancho said, to turn off read-only-mode
. But if you try to save the buffer after changing it you'll be prompted to confirm, like this:
File foo.el is write-protected; try to save anyway? (yes or no)
And if you answer yes
you may be presented with an error such as this:
Opening output file: Permission denied, /path/to/foo.el
I like very much to click on the buffer-read-only
indicator %
in the mode line for that purpose. It is marked with a red ellipse in the following Figure.
It just feels natural to toggle the read only state where it is indicated.
Note that you can also toggle the buffer-modified-p
flag on the right side of the buffer-read-only
flag. This is sometimes handy when you just want to kill a modified buffer avoiding backup copies.