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
  • 4
    I submitted a bug report at debbugs.gnu.org/cgi/bugreport.cgi?bug=31908. Commented Jun 20, 2018 at 4:44
  • Definitely helps. Webpack keeps failing because of these lock files. Commented Jun 2, 2020 at 13:40
  • 1
    Submit a bug report for webpack? (Why would it think these were files of interest?) Commented Apr 5, 2022 at 21:03
6

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