21

Emacs 24 introduced the ability to disable the creation of the infamous .#file-name lock files.

Evaluating the following lisp form will completely disable Emacs ability to lock files to prevent concurrent changes.

Is there a way to set Emacs to save lock files in a dedicated directory, similarly to what happens with auto-save and backup files?

(setq create-lockfiles nil)

2 Answers 2

16

I'm afraid this is not straightforward to do considering F1 v create-lockfiles takes you to filelock.c which only exposes this variable and temporary-file-directory. So, to have this behaviour you'd either need to replace nearly all functions exposed in that file with your own Emacs Lisp functions or hand in a bug via M-x report-emacs-bug and hope for the best.

3
5

Emacs-28 can now put lock-files in different locations, see lock-file-name-transforms

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.