Commit 11ee65af authored by Glenn Morris's avatar Glenn Morris

Remove the build-time option CLASH_DETECTION

Every platform supports it, and the runtime option `create-lockfiles'
replaces it.

* configure.ac (CLASH_DETECTION): Remove option.

* lisp/files.el (lock-buffer, unlock-buffer, file-locked-p):
Remove fallback aliases, since they are always defined now.

* src/buffer.c (Frestore_buffer_modified_p, Fkill_buffer):
* src/emacs.c (shut_down_emacs):
* src/fileio.c (Finsert_file_contents, write_region):
* src/filelock.c (top-level, syms_of_filelock):
* src/insdel.c (prepare_to_modify_buffer_1):
CLASH_DETECTION is always defined now.

* admin/CPP-DEFINES: Remove CLASH_DETECTION.
parent defd53bd
2014-03-26 Glenn Morris <rgm@gnu.org>
* configure.ac (CLASH_DETECTION): Remove option. Every platform
supports it, and the runtime option `create-lockfiles' replaces it.
2014-03-23 Daniel Colascione <dancol@dancol.org> 2014-03-23 Daniel Colascione <dancol@dancol.org>
* configure.ac: (Bug#17069) Include GFILENOTIFY objects in glib * configure.ac: (Bug#17069) Include GFILENOTIFY objects in glib check.
check.
2014-03-22 Glenn Morris <rgm@gnu.org> 2014-03-22 Glenn Morris <rgm@gnu.org>
......
...@@ -86,7 +86,6 @@ BROKEN_FIONREAD ...@@ -86,7 +86,6 @@ BROKEN_FIONREAD
BROKEN_GET_CURRENT_DIR_NAME BROKEN_GET_CURRENT_DIR_NAME
BROKEN_NON_BLOCKING_CONNECT BROKEN_NON_BLOCKING_CONNECT
BROKEN_PTY_READ_AFTER_EAGAIN BROKEN_PTY_READ_AFTER_EAGAIN
CLASH_DETECTION
DATA_SEG_BITS DATA_SEG_BITS
DEFAULT_SOUND_DEVICE DEFAULT_SOUND_DEVICE
DEVICE_SEP DEVICE_SEP
......
...@@ -3897,14 +3897,6 @@ if test "${opsys}" != "mingw32"; then ...@@ -3897,14 +3897,6 @@ if test "${opsys}" != "mingw32"; then
in the full name stands for the login id.]) in the full name stands for the login id.])
fi fi
dnl Every platform that uses configure supports this.
dnl There is a create-lockfiles option you can
dnl customize if you do not want the lock files to be written.
dnl So it is not clear that this #define still needs to exist.
AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written,
so that Emacs can tell instantly when you try to modify a file that
someone else has modified in his/her Emacs.])
dnl Everybody supports this, except MS. dnl Everybody supports this, except MS.
dnl Seems like the kind of thing we should be testing for, though. dnl Seems like the kind of thing we should be testing for, though.
## Note: PTYs are broken on darwin <6. Use at your own risk. ## Note: PTYs are broken on darwin <6. Use at your own risk.
......
2014-03-26 Glenn Morris <rgm@gnu.org>
* files.el (lock-buffer, unlock-buffer, file-locked-p):
Remove fallback aliases, since they are always defined now.
2014-03-24 Daniel Colascione <dancol@dancol.org> 2014-03-24 Daniel Colascione <dancol@dancol.org>
* emacs-lisp/cl-macs.el (cl--do-arglist): Use `plist-member' * emacs-lisp/cl-macs.el (cl--do-arglist): Use `plist-member'
......
...@@ -559,14 +559,6 @@ A value of nil means ignore them; anything else means query." ...@@ -559,14 +559,6 @@ A value of nil means ignore them; anything else means query."
(other :tag "Query" other)) (other :tag "Query" other))
:group 'find-file) :group 'find-file)
;; Avoid losing in versions where CLASH_DETECTION is disabled.
(or (fboundp 'lock-buffer)
(defalias 'lock-buffer 'ignore))
(or (fboundp 'unlock-buffer)
(defalias 'unlock-buffer 'ignore))
(or (fboundp 'file-locked-p)
(defalias 'file-locked-p 'ignore))
(defcustom view-read-only nil (defcustom view-read-only nil
"Non-nil means buffers visiting files read-only do so in view mode. "Non-nil means buffers visiting files read-only do so in view mode.
In fact, this means that all read-only buffers normally have In fact, this means that all read-only buffers normally have
......
2014-03-26 Glenn Morris <rgm@gnu.org>
* buffer.c (Frestore_buffer_modified_p, Fkill_buffer):
* emacs.c (shut_down_emacs):
* fileio.c (Finsert_file_contents, write_region):
* filelock.c (top-level, syms_of_filelock):
* insdel.c (prepare_to_modify_buffer_1):
CLASH_DETECTION is always defined now.
2014-03-25 Eli Zaretskii <eliz@gnu.org> 2014-03-25 Eli Zaretskii <eliz@gnu.org>
* w32.c (w32_delayed_load): Call DisableThreadLibraryCalls on the * w32.c (w32_delayed_load): Call DisableThreadLibraryCalls on the
......
/* Buffer manipulation primitives for GNU Emacs. /* Buffer manipulation primitives for GNU Emacs.
Copyright (C) 1985-1989, 1993-1995, 1997-2014 Free Software Foundation, Copyright (C) 1985-1989, 1993-1995, 1997-2014 Free Software Foundation, Inc.
Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
...@@ -1380,7 +1379,6 @@ It is not ensured that mode lines will be updated to show the modified ...@@ -1380,7 +1379,6 @@ It is not ensured that mode lines will be updated to show the modified
state of the current buffer. Use with care. */) state of the current buffer. Use with care. */)
(Lisp_Object flag) (Lisp_Object flag)
{ {
#ifdef CLASH_DETECTION
Lisp_Object fn; Lisp_Object fn;
/* If buffer becoming modified, lock the file. /* If buffer becoming modified, lock the file.
...@@ -1400,7 +1398,6 @@ state of the current buffer. Use with care. */) ...@@ -1400,7 +1398,6 @@ state of the current buffer. Use with care. */)
else if (already && NILP (flag)) else if (already && NILP (flag))
unlock_file (fn); unlock_file (fn);
} }
#endif /* CLASH_DETECTION */
/* Here we have a problem. SAVE_MODIFF is used here to encode /* Here we have a problem. SAVE_MODIFF is used here to encode
buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as
...@@ -1820,10 +1817,8 @@ cleaning up all windows currently displaying the buffer to be killed. */) ...@@ -1820,10 +1817,8 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* Now there is no question: we can kill the buffer. */ /* Now there is no question: we can kill the buffer. */
#ifdef CLASH_DETECTION
/* Unlock this buffer's file, if it is locked. */ /* Unlock this buffer's file, if it is locked. */
unlock_buffer (b); unlock_buffer (b);
#endif /* CLASH_DETECTION */
GCPRO1 (buffer); GCPRO1 (buffer);
kill_buffer_processes (buffer); kill_buffer_processes (buffer);
......
/* Fully extensible Emacs, running on Unix, intended for GNU. /* Fully extensible Emacs, running on Unix, intended for GNU.
Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2014 Free Software Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2014
Foundation, Inc. Free Software Foundation, Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
...@@ -2032,9 +2032,7 @@ shut_down_emacs (int sig, Lisp_Object stuff) ...@@ -2032,9 +2032,7 @@ shut_down_emacs (int sig, Lisp_Object stuff)
kill_buffer_processes (Qnil); kill_buffer_processes (Qnil);
Fdo_auto_save (Qt, Qnil); Fdo_auto_save (Qt, Qnil);
#ifdef CLASH_DETECTION
unlock_all_files (); unlock_all_files ();
#endif
/* There is a tendency for a SIGIO signal to arrive within exit, /* There is a tendency for a SIGIO signal to arrive within exit,
and cause a SIGHUP because the input descriptor is already closed. */ and cause a SIGHUP because the input descriptor is already closed. */
......
...@@ -4079,13 +4079,11 @@ by calling `format-decode', which see. */) ...@@ -4079,13 +4079,11 @@ by calling `format-decode', which see. */)
if (NILP (visit) && total > 0) if (NILP (visit) && total > 0)
{ {
#ifdef CLASH_DETECTION
if (!NILP (BVAR (current_buffer, file_truename)) if (!NILP (BVAR (current_buffer, file_truename))
/* Make binding buffer-file-name to nil effective. */ /* Make binding buffer-file-name to nil effective. */
&& !NILP (BVAR (current_buffer, filename)) && !NILP (BVAR (current_buffer, filename))
&& SAVE_MODIFF >= MODIFF) && SAVE_MODIFF >= MODIFF)
we_locked_file = 1; we_locked_file = 1;
#endif /* CLASH_DETECTION */
prepare_to_modify_buffer (GPT, GPT, NULL); prepare_to_modify_buffer (GPT, GPT, NULL);
} }
...@@ -4185,10 +4183,8 @@ by calling `format-decode', which see. */) ...@@ -4185,10 +4183,8 @@ by calling `format-decode', which see. */)
if (inserted == 0) if (inserted == 0)
{ {
#ifdef CLASH_DETECTION
if (we_locked_file) if (we_locked_file)
unlock_file (BVAR (current_buffer, file_truename)); unlock_file (BVAR (current_buffer, file_truename));
#endif
Vdeactivate_mark = old_Vdeactivate_mark; Vdeactivate_mark = old_Vdeactivate_mark;
} }
else else
...@@ -4337,14 +4333,12 @@ by calling `format-decode', which see. */) ...@@ -4337,14 +4333,12 @@ by calling `format-decode', which see. */)
SAVE_MODIFF = MODIFF; SAVE_MODIFF = MODIFF;
BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
#ifdef CLASH_DETECTION
if (NILP (handler)) if (NILP (handler))
{ {
if (!NILP (BVAR (current_buffer, file_truename))) if (!NILP (BVAR (current_buffer, file_truename)))
unlock_file (BVAR (current_buffer, file_truename)); unlock_file (BVAR (current_buffer, file_truename));
unlock_file (filename); unlock_file (filename);
} }
#endif /* CLASH_DETECTION */
if (not_regular) if (not_regular)
xsignal2 (Qfile_error, xsignal2 (Qfile_error,
build_string ("not a regular file"), orig_filename); build_string ("not a regular file"), orig_filename);
...@@ -4814,13 +4808,11 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ...@@ -4814,13 +4808,11 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display))) if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
coding.mode |= CODING_MODE_SELECTIVE_DISPLAY; coding.mode |= CODING_MODE_SELECTIVE_DISPLAY;
#ifdef CLASH_DETECTION
if (open_and_close_file && !auto_saving) if (open_and_close_file && !auto_saving)
{ {
lock_file (lockname); lock_file (lockname);
file_locked = 1; file_locked = 1;
} }
#endif /* CLASH_DETECTION */
encoded_filename = ENCODE_FILE (filename); encoded_filename = ENCODE_FILE (filename);
fn = SSDATA (encoded_filename); fn = SSDATA (encoded_filename);
...@@ -4842,10 +4834,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ...@@ -4842,10 +4834,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
if (desc < 0) if (desc < 0)
{ {
int open_errno = errno; int open_errno = errno;
#ifdef CLASH_DETECTION
if (file_locked) if (file_locked)
unlock_file (lockname); unlock_file (lockname);
#endif /* CLASH_DETECTION */
UNGCPRO; UNGCPRO;
report_file_errno ("Opening output file", filename, open_errno); report_file_errno ("Opening output file", filename, open_errno);
} }
...@@ -4860,10 +4850,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ...@@ -4860,10 +4850,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
if (ret < 0) if (ret < 0)
{ {
int lseek_errno = errno; int lseek_errno = errno;
#ifdef CLASH_DETECTION
if (file_locked) if (file_locked)
unlock_file (lockname); unlock_file (lockname);
#endif /* CLASH_DETECTION */
UNGCPRO; UNGCPRO;
report_file_errno ("Lseek error", filename, lseek_errno); report_file_errno ("Lseek error", filename, lseek_errno);
} }
...@@ -5006,10 +4994,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ...@@ -5006,10 +4994,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
unbind_to (count, Qnil); unbind_to (count, Qnil);
#ifdef CLASH_DETECTION
if (file_locked) if (file_locked)
unlock_file (lockname); unlock_file (lockname);
#endif /* CLASH_DETECTION */
/* Do this before reporting IO error /* Do this before reporting IO error
to avoid a "file has changed on disk" warning on to avoid a "file has changed on disk" warning on
......
...@@ -55,8 +55,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ ...@@ -55,8 +55,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "w32.h" /* for dostounix_filename */ #include "w32.h" /* for dostounix_filename */
#endif #endif
#ifdef CLASH_DETECTION
#ifdef HAVE_UTMP_H #ifdef HAVE_UTMP_H
#include <utmp.h> #include <utmp.h>
#endif #endif
...@@ -837,8 +835,6 @@ t if it is locked by you, else a string saying which user has locked it. */) ...@@ -837,8 +835,6 @@ t if it is locked by you, else a string saying which user has locked it. */)
return ret; return ret;
} }
#endif /* CLASH_DETECTION */
void void
syms_of_filelock (void) syms_of_filelock (void)
{ {
...@@ -850,9 +846,7 @@ syms_of_filelock (void) ...@@ -850,9 +846,7 @@ syms_of_filelock (void)
doc: /* Non-nil means use lockfiles to avoid editing collisions. */); doc: /* Non-nil means use lockfiles to avoid editing collisions. */);
create_lockfiles = 1; create_lockfiles = 1;
#ifdef CLASH_DETECTION
defsubr (&Sunlock_buffer); defsubr (&Sunlock_buffer);
defsubr (&Slock_buffer); defsubr (&Slock_buffer);
defsubr (&Sfile_locked_p); defsubr (&Sfile_locked_p);
#endif
} }
/* Buffer insertion/deletion and gap motion for GNU Emacs. /* Buffer insertion/deletion and gap motion for GNU Emacs.
Copyright (C) 1985-1986, 1993-1995, 1997-2014 Free Software
Foundation, Inc. Copyright (C) 1985-1986, 1993-1995, 1997-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
...@@ -1829,21 +1829,11 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, ...@@ -1829,21 +1829,11 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end,
else else
base_buffer = current_buffer; base_buffer = current_buffer;
#ifdef CLASH_DETECTION
if (!NILP (BVAR (base_buffer, file_truename)) if (!NILP (BVAR (base_buffer, file_truename))
/* Make binding buffer-file-name to nil effective. */ /* Make binding buffer-file-name to nil effective. */
&& !NILP (BVAR (base_buffer, filename)) && !NILP (BVAR (base_buffer, filename))
&& SAVE_MODIFF >= MODIFF) && SAVE_MODIFF >= MODIFF)
lock_file (BVAR (base_buffer, file_truename)); lock_file (BVAR (base_buffer, file_truename));
#else
/* At least warn if this file has changed on disk since it was visited. */
if (!NILP (BVAR (base_buffer, filename))
&& SAVE_MODIFF >= MODIFF
&& NILP (Fverify_visited_file_modtime (Fcurrent_buffer ()))
&& !NILP (Ffile_exists_p (BVAR (base_buffer, filename))))
call1 (intern ("ask-user-about-supersession-threat"),
BVAR (base_buffer,filename));
#endif /* not CLASH_DETECTION */
/* If `select-active-regions' is non-nil, save the region text. */ /* If `select-active-regions' is non-nil, save the region text. */
/* FIXME: Move this to Elisp (via before-change-functions). */ /* FIXME: Move this to Elisp (via before-change-functions). */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment