I am using emacs on a remote server in which I use ssh to connect to. My internet is sometimes unstable and admist working on the file my connection will break and the file I am working on will be renamed with enclosed #' as shown below when I ls. Is there a way I could resume editing the file after I connect back? and will the name change back to the name I have given it initially?

'#5-listfilesdigitonly#' README.md

1 Answer 1


That’s two or even three different questions, which you should really avoid. Still, I’ll try to help.

If Emacs is still running, all you have to do is save the file again. Emacs will try to save it, see that the connection was broken (might take 30 seconds to time out though), then open a new connection. Once it has a working connection, it will save the file.

The file you see that starts with # should be an autosave file, but the name is odd; it should reflect the original name of the file (if you were editing that README.md file, the autosave should have been #README.md#).

However, because you didn’t show us the exact file name, you might have made a mistake. Could it be a file whose name starts with .# instead? That would be a lock file instead.

Regardless, when you save the file again Emacs should clean up any such stray files that aren’t needed any more.

  • Thank you for taking the time to answer my question and sorry for not being so precise, this is actually my first time asking on StackExchange. With regards to the file am working on, this is the file 5-listfilesdigitonly and it got renamed to '#5-listfilesdigitonly#' even though the original file still remained. Once I get my connection back and try opening the original file, it won't show any of the changes I have made and the renamed file will never get cleared after I save the file. I will have to manually remove it Sep 5, 2023 at 17:43
  • That’s an autosave file then. You should read that chapter of the manual. An autosave file is just an ordinary file; it contains whatever the normal file would contain. You can recover the content from it by simply renaming it, copying it, opening it in Emacs, or by using the recover-file command. See chapter 19.6.3 Recovering Data from Auto-Saves. But again, as long as Emacs is still running the content of the file will still be in the buffer as usual, and all you have to do is save the file.
    – db48x
    Sep 5, 2023 at 21:41
  • Thanks, that's really helpful I appreciate it! Sep 6, 2023 at 9:03

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.