Skip to main content
edited tags
Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Source Link

How to open file with it being editable but not writeable?

I teach, and I like to use real files as examples in class. I want to be able to edit the buffer to show student things, but I don't want to risk accidentally writing the changes on the file.

What I currently do is to open them, run write-file and save them as a different file in a temp directory. But I wonder if there's a more elegant way. I tried find-file-read-only, but it doesn't allow me to edit. I couldn't find anything in the Manual, at least in the File Handling chapter.

I wonder if I can open a file in a buffer that acts like the Tutorial buffer. I can edit the buffer, but if I try to close it, it won't prompt me to save it. And even if I try to save it, it won't assume me the original file path/name as the place to write it on.

Any ideas?