20

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)
Drew
  • 75,699
  • 9
  • 109
  • 225

2 Answers2

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.

wasamasa
  • 21,803
  • 1
  • 65
  • 97
4

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

rpluim
  • 4,605
  • 8
  • 22