all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Proposed patch: allow user to disable lockfile creation
@ 2011-07-27  2:42 Dave Abrahams
  2011-07-27 15:32 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Dave Abrahams @ 2011-07-27  2:42 UTC (permalink / raw)
  To: emacs-devel; +Cc: John Wiegley

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]


Hi,

Those symlinks that emacs creates to help avoid collisions between users
editing simultaneously cause me lots of pain and no gain, so I propose
the enclosed patch that allows me to disable the feature.

I hereby place these changes in the public domain.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-a-customizable-option-that-disables-lockfile-cre.patch --]
[-- Type: text/x-patch, Size: 3431 bytes --]

From e79326938de1c2567ac2ab1cac2fea91482a59e7 Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dave@boostpro.com>
Date: Tue, 26 Jul 2011 22:32:13 -0400
Subject: [PATCH] Add a customizable option that disables lockfile creation

---
 ChangeLog            |    4 ++++
 doc/emacs/files.texi |    9 +++++----
 lisp/cus-start.el    |    1 +
 src/filelock.c       |    8 ++++++++
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e4a4754..87a3072 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-26  Dave Abrahams  <dave@boostpro.com>
+
+	* src/file_lock.c, lisp/cus-start.el: Add option to disable lockfile creation
+
 2011-06-19  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* lib/unistd.in.h, m4/getloadavg.m4: Merge from gnulib.
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 793a11e..3f94741 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -761,16 +761,17 @@ to change the file, and issues an immediate warning.  On all systems,
 Emacs checks when you save the file, and warns if you are about to
 overwrite another user's changes.  You can prevent loss of the other
 user's work by taking the proper corrective action instead of saving the
-file.
+file.  
 
 @findex ask-user-about-lock
 @cindex locking files
   When you make the first modification in an Emacs buffer that is
 visiting a file, Emacs records that the file is @dfn{locked} by you.
 (It does this by creating a specially-named symbolic link in the same
-directory.)  Emacs removes the lock when you save the changes.  The
-idea is that the file is locked whenever an Emacs buffer visiting it
-has unsaved changes.
+directory.  You can disable this behavior by setting the variable
+@code{create-lockfiles} to @code{nil}).  Emacs removes the lock when
+you save the changes.  The idea is that the file is locked whenever an
+Emacs buffer visiting it has unsaved changes.
 
 @cindex collision
   If you begin to modify the buffer while the visited file is locked by
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 389716b..1d8c908 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -183,6 +183,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
              (delete-by-moving-to-trash auto-save boolean "23.1")
 	     (auto-save-visited-file-name auto-save boolean)
 	     ;; filelock.c
+             (create-lockfiles files boolean)
 	     (temporary-file-directory
 	      ;; Darwin section added 24.1, does not seem worth :version bump.
 	      files directory nil
diff --git a/src/filelock.c b/src/filelock.c
index 13b27c7..8078a74 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -541,6 +541,10 @@ lock_file (Lisp_Object fn)
   lock_info_type lock_info;
   struct gcpro gcpro1;
 
+  /* Don't do locking if the user has opted out.  */
+  if (! Vcreate_lockfiles)
+    return;
+
   /* Don't do locking while dumping Emacs.
      Uncompressing wtmp files uses call-process, which does not work
      in an uninitialized Emacs.  */
@@ -709,6 +713,10 @@ syms_of_filelock (void)
 	       doc: /* The directory for writing temporary files.  */);
   Vtemporary_file_directory = Qnil;
 
+  DEFVAR_BOOL ("create-lockfiles", Vcreate_lockfiles,
+	       doc: /* Non-nil means use lockfiles to avoid editing collisions.  */);
+  Vcreate_lockfiles = 1;
+
 #ifdef CLASH_DETECTION
   defsubr (&Sunlock_buffer);
   defsubr (&Slock_buffer);
-- 
1.7.3.4


[-- Attachment #3: Type: text/plain, Size: 64 bytes --]



-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2011-07-31  2:22 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-27  2:42 Proposed patch: allow user to disable lockfile creation Dave Abrahams
2011-07-27 15:32 ` Andreas Schwab
2011-07-27 16:25   ` Dave Abrahams
2011-07-27 18:56     ` John Wiegley
2011-07-28  1:57       ` Stephen J. Turnbull
2011-07-28 16:46         ` Richard Stallman
2011-07-28 16:54           ` Lennart Borgman
2011-07-28 23:00             ` Richard Stallman
2011-07-29  0:12               ` Tim Cross
2011-07-29  0:51                 ` Dave Abrahams
2011-07-29 23:40                   ` Richard Stallman
2011-07-30  3:29                     ` Dave Abrahams
2011-07-30  7:21                       ` Eli Zaretskii
2011-07-30 12:32                         ` Dave Abrahams
2011-07-30 18:12                       ` Richard Stallman
2011-07-31  2:13                   ` Tim Cross
2011-07-29 23:40                 ` Richard Stallman
2011-07-30 12:46                   ` Dave Abrahams
2011-07-28 18:22           ` chad
2011-07-28 23:00             ` Richard Stallman
2011-07-28 19:21           ` Paul Eggert
2011-07-29 17:31             ` Richard Stallman
2011-07-29 19:59               ` David Kastrup
2011-07-30  4:35                 ` Richard Stallman
2011-07-30  7:36                   ` David Kastrup
2011-07-29  3:31           ` Stephen J. Turnbull
2011-07-28 21:20 ` Evil Boris
2011-07-30 14:20 ` Daniel Colascione
2011-07-30 18:12   ` Richard Stallman
2011-07-31  2:22     ` Tim Cross

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.