Search code examples
macosfileemacsterminalautosave

hidden autosave file error: no such file or directory


I was editing an emacs file abc, and prior to saving, had a crash. There is now a file .#abc, and I would like to find out what is in that file, to perhaps recover what I was working on.

I know the file is there because when I type

ls -a

it lists

.#abc

However, when I type

more ".#abc"

or simply

more .#abc

I get the error

.#abc: No such file or directory

The same error occurs with cp in place of more.

How do I see what is in that file? Why does ls list it and then other commands can't find the file?

(Is .#abc actually an alias file? If so, how would I know that? And how, nevertheless, do I see the content of it, even if this is only what it is an alias to?)

[Note: I do not want to use emacs to try to find out what is in the file or restore it, because the situation is somewhat more complicated than described: the above is all occurring inside a Time Machine backup, which I need to access because of an emacs autosave overwrite problem on the primary file. I don't want to have the same problem occur on the backup of the autosave file!]

This is all on Mac OS10.8.4.


Solution

  • Whereas autosave files use a tilde ~, lock-files use a dot number-sign .#:

    http://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html

    Creation of lock-files can be disabled with the following setting:

    (setq create-lockfiles nil)
    

    https://stackoverflow.com/a/12974060/2112489