Disassociate file from buffer reddit / emacs ---------------------------------------------------------------------- jojohohanon · 2022-07-01 18:55 I have a buffer (shell) with useful history, but by mistake I have now saved the buffer, creating a "shell" file in the directory, which confuses other tooling. Deleting the file is easy, but of course emacs recreates #shell# for me. How can I remove the association from buffer to the file, turning it back into a file-less shell buffer? I've found searching for this leads only suggestions to kill the buffer (sure, but there has to be a better way) or very basic how-to for file and buffer deletion. ---------------------------------------------------------------------- bram85 · 2022-07-02 05:22 Try evaluating `(set-visited-file-name nil)` in the shell buffer. I wrapped this call in a function and bound it to a key. Sometimes there are files I want to modify (e.g. sort lines) but prevent I actually write the modifications back to the file. ---------------------------------------------------------------------- jojohohanon · 2022-07-02 19:15 This worked quite well, from initial testing. Thanks!