7

A buffer can be made write-protected by toggling the read-only mode via M-x toggle-read-only. Is there a way to make a buffer read-only in a window, while editing it in another window?

1 Answer 1

8

In your original buffer, where you want to keep editing it :

M-x clone-indirect-buffer

This would create another buffer, and by default open it in another window too. Initially both of these are editable. But a buffer specific mode change can be made in the second one - which will now become read only after you do the following :

M-x read-only-mode

Now this second buffer is your buffer in read-only mode - same content as the earlier read-write buffer.

3
  • could you please add some explanation?
    – AlQuemist
    Commented Aug 17, 2018 at 10:25
  • Ah, ok, one min. Since you were using M-x and toggling modes already, I thought you would understand very easily.
    – Jeeves
    Commented Aug 17, 2018 at 10:26
  • Thanks. IMO, it is better to add some explanation along with the commands for the general audience.
    – AlQuemist
    Commented Aug 17, 2018 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.