Unlocking File: Invalid Argument Warning
Nov 28, 2025 05:41

This is one of those posts to remind me of a solution to a rarely occurring problem.

Emacs has a feature called interlocking to prevent two different users from modifying the same file. If, like me, you regularly use two different machines, this may occasionally present a problem. Most of the time, Emacs behaves nicely and gives the user some options to either steal the lock, proceed with the edit, or quit. Recently, though, I had a file that I needed to edit that Emacs simply wouldn’t let me open. Every time I tried, I just got this warning: Unlocking file: Invalid argument. I suspect this might have had something to do with a system crash that prevented Emacs from saving the file and clearing its locked status. Eventually, I stumbled on a solution: delete the lockfile, which is a file in the directory that contains a “#” in the filename.

Tagged: Emacs