aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2014-03-25 21:14:44 -0400
committerGlenn Morris2014-03-25 21:14:44 -0400
commit11ee65afc20d41f1fc31fe2ead84b2203b4bfeb0 (patch)
treea3ae87b8d8d73968f293973444fbf3ae753d83f1 /src
parentdefd53bdc5ef9d75fa112487d76f4d7a4cb9fe92 (diff)
downloademacs-11ee65afc20d41f1fc31fe2ead84b2203b4bfeb0.tar.gz
emacs-11ee65afc20d41f1fc31fe2ead84b2203b4bfeb0.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/buffer.c7
-rw-r--r--src/emacs.c6
-rw-r--r--src/fileio.c14
-rw-r--r--src/filelock.c6
-rw-r--r--src/insdel.c14
6 files changed, 14 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 31d90663206..87c2d364b05 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12014-03-26 Glenn Morris <rgm@gnu.org>
2
3 * buffer.c (Frestore_buffer_modified_p, Fkill_buffer):
4 * emacs.c (shut_down_emacs):
5 * fileio.c (Finsert_file_contents, write_region):
6 * filelock.c (top-level, syms_of_filelock):
7 * insdel.c (prepare_to_modify_buffer_1):
8 CLASH_DETECTION is always defined now.
9
12014-03-25 Eli Zaretskii <eliz@gnu.org> 102014-03-25 Eli Zaretskii <eliz@gnu.org>
2 11
3 * w32.c (w32_delayed_load): Call DisableThreadLibraryCalls on the 12 * w32.c (w32_delayed_load): Call DisableThreadLibraryCalls on the
diff --git a/src/buffer.c b/src/buffer.c
index daafbcef0e4..5e923d26f3f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,7 +1,6 @@
1/* Buffer manipulation primitives for GNU Emacs. 1/* Buffer manipulation primitives for GNU Emacs.
2 2
3Copyright (C) 1985-1989, 1993-1995, 1997-2014 Free Software Foundation, 3Copyright (C) 1985-1989, 1993-1995, 1997-2014 Free Software Foundation, Inc.
4Inc.
5 4
6This file is part of GNU Emacs. 5This file is part of GNU Emacs.
7 6
@@ -1380,7 +1379,6 @@ It is not ensured that mode lines will be updated to show the modified
1380state of the current buffer. Use with care. */) 1379state of the current buffer. Use with care. */)
1381 (Lisp_Object flag) 1380 (Lisp_Object flag)
1382{ 1381{
1383#ifdef CLASH_DETECTION
1384 Lisp_Object fn; 1382 Lisp_Object fn;
1385 1383
1386 /* If buffer becoming modified, lock the file. 1384 /* If buffer becoming modified, lock the file.
@@ -1400,7 +1398,6 @@ state of the current buffer. Use with care. */)
1400 else if (already && NILP (flag)) 1398 else if (already && NILP (flag))
1401 unlock_file (fn); 1399 unlock_file (fn);
1402 } 1400 }
1403#endif /* CLASH_DETECTION */
1404 1401
1405 /* Here we have a problem. SAVE_MODIFF is used here to encode 1402 /* Here we have a problem. SAVE_MODIFF is used here to encode
1406 buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as 1403 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 1817
1821 /* Now there is no question: we can kill the buffer. */ 1818 /* Now there is no question: we can kill the buffer. */
1822 1819
1823#ifdef CLASH_DETECTION
1824 /* Unlock this buffer's file, if it is locked. */ 1820 /* Unlock this buffer's file, if it is locked. */
1825 unlock_buffer (b); 1821 unlock_buffer (b);
1826#endif /* CLASH_DETECTION */
1827 1822
1828 GCPRO1 (buffer); 1823 GCPRO1 (buffer);
1829 kill_buffer_processes (buffer); 1824 kill_buffer_processes (buffer);
diff --git a/src/emacs.c b/src/emacs.c
index 50efcbfb60c..9d070bda51b 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,7 +1,7 @@
1/* Fully extensible Emacs, running on Unix, intended for GNU. 1/* Fully extensible Emacs, running on Unix, intended for GNU.
2 2
3Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2014 Free Software 3Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2014
4Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -2032,9 +2032,7 @@ shut_down_emacs (int sig, Lisp_Object stuff)
2032 kill_buffer_processes (Qnil); 2032 kill_buffer_processes (Qnil);
2033 Fdo_auto_save (Qt, Qnil); 2033 Fdo_auto_save (Qt, Qnil);
2034 2034
2035#ifdef CLASH_DETECTION
2036 unlock_all_files (); 2035 unlock_all_files ();
2037#endif
2038 2036
2039 /* There is a tendency for a SIGIO signal to arrive within exit, 2037 /* There is a tendency for a SIGIO signal to arrive within exit,
2040 and cause a SIGHUP because the input descriptor is already closed. */ 2038 and cause a SIGHUP because the input descriptor is already closed. */
diff --git a/src/fileio.c b/src/fileio.c
index fb0a33b39db..152b7a8a8ed 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4079,13 +4079,11 @@ by calling `format-decode', which see. */)
4079 4079
4080 if (NILP (visit) && total > 0) 4080 if (NILP (visit) && total > 0)
4081 { 4081 {
4082#ifdef CLASH_DETECTION
4083 if (!NILP (BVAR (current_buffer, file_truename)) 4082 if (!NILP (BVAR (current_buffer, file_truename))
4084 /* Make binding buffer-file-name to nil effective. */ 4083 /* Make binding buffer-file-name to nil effective. */
4085 && !NILP (BVAR (current_buffer, filename)) 4084 && !NILP (BVAR (current_buffer, filename))
4086 && SAVE_MODIFF >= MODIFF) 4085 && SAVE_MODIFF >= MODIFF)
4087 we_locked_file = 1; 4086 we_locked_file = 1;
4088#endif /* CLASH_DETECTION */
4089 prepare_to_modify_buffer (GPT, GPT, NULL); 4087 prepare_to_modify_buffer (GPT, GPT, NULL);
4090 } 4088 }
4091 4089
@@ -4185,10 +4183,8 @@ by calling `format-decode', which see. */)
4185 4183
4186 if (inserted == 0) 4184 if (inserted == 0)
4187 { 4185 {
4188#ifdef CLASH_DETECTION
4189 if (we_locked_file) 4186 if (we_locked_file)
4190 unlock_file (BVAR (current_buffer, file_truename)); 4187 unlock_file (BVAR (current_buffer, file_truename));
4191#endif
4192 Vdeactivate_mark = old_Vdeactivate_mark; 4188 Vdeactivate_mark = old_Vdeactivate_mark;
4193 } 4189 }
4194 else 4190 else
@@ -4337,14 +4333,12 @@ by calling `format-decode', which see. */)
4337 SAVE_MODIFF = MODIFF; 4333 SAVE_MODIFF = MODIFF;
4338 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; 4334 BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
4339 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 4335 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4340#ifdef CLASH_DETECTION
4341 if (NILP (handler)) 4336 if (NILP (handler))
4342 { 4337 {
4343 if (!NILP (BVAR (current_buffer, file_truename))) 4338 if (!NILP (BVAR (current_buffer, file_truename)))
4344 unlock_file (BVAR (current_buffer, file_truename)); 4339 unlock_file (BVAR (current_buffer, file_truename));
4345 unlock_file (filename); 4340 unlock_file (filename);
4346 } 4341 }
4347#endif /* CLASH_DETECTION */
4348 if (not_regular) 4342 if (not_regular)
4349 xsignal2 (Qfile_error, 4343 xsignal2 (Qfile_error,
4350 build_string ("not a regular file"), orig_filename); 4344 build_string ("not a regular file"), orig_filename);
@@ -4814,13 +4808,11 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4814 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display))) 4808 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4815 coding.mode |= CODING_MODE_SELECTIVE_DISPLAY; 4809 coding.mode |= CODING_MODE_SELECTIVE_DISPLAY;
4816 4810
4817#ifdef CLASH_DETECTION
4818 if (open_and_close_file && !auto_saving) 4811 if (open_and_close_file && !auto_saving)
4819 { 4812 {
4820 lock_file (lockname); 4813 lock_file (lockname);
4821 file_locked = 1; 4814 file_locked = 1;
4822 } 4815 }
4823#endif /* CLASH_DETECTION */
4824 4816
4825 encoded_filename = ENCODE_FILE (filename); 4817 encoded_filename = ENCODE_FILE (filename);
4826 fn = SSDATA (encoded_filename); 4818 fn = SSDATA (encoded_filename);
@@ -4842,10 +4834,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4842 if (desc < 0) 4834 if (desc < 0)
4843 { 4835 {
4844 int open_errno = errno; 4836 int open_errno = errno;
4845#ifdef CLASH_DETECTION
4846 if (file_locked) 4837 if (file_locked)
4847 unlock_file (lockname); 4838 unlock_file (lockname);
4848#endif /* CLASH_DETECTION */
4849 UNGCPRO; 4839 UNGCPRO;
4850 report_file_errno ("Opening output file", filename, open_errno); 4840 report_file_errno ("Opening output file", filename, open_errno);
4851 } 4841 }
@@ -4860,10 +4850,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4860 if (ret < 0) 4850 if (ret < 0)
4861 { 4851 {
4862 int lseek_errno = errno; 4852 int lseek_errno = errno;
4863#ifdef CLASH_DETECTION
4864 if (file_locked) 4853 if (file_locked)
4865 unlock_file (lockname); 4854 unlock_file (lockname);
4866#endif /* CLASH_DETECTION */
4867 UNGCPRO; 4855 UNGCPRO;
4868 report_file_errno ("Lseek error", filename, lseek_errno); 4856 report_file_errno ("Lseek error", filename, lseek_errno);
4869 } 4857 }
@@ -5006,10 +4994,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
5006 4994
5007 unbind_to (count, Qnil); 4995 unbind_to (count, Qnil);
5008 4996
5009#ifdef CLASH_DETECTION
5010 if (file_locked) 4997 if (file_locked)
5011 unlock_file (lockname); 4998 unlock_file (lockname);
5012#endif /* CLASH_DETECTION */
5013 4999
5014 /* Do this before reporting IO error 5000 /* Do this before reporting IO error
5015 to avoid a "file has changed on disk" warning on 5001 to avoid a "file has changed on disk" warning on
diff --git a/src/filelock.c b/src/filelock.c
index 5252db09104..cc5c821cadd 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -55,8 +55,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
55#include "w32.h" /* for dostounix_filename */ 55#include "w32.h" /* for dostounix_filename */
56#endif 56#endif
57 57
58#ifdef CLASH_DETECTION
59
60#ifdef HAVE_UTMP_H 58#ifdef HAVE_UTMP_H
61#include <utmp.h> 59#include <utmp.h>
62#endif 60#endif
@@ -837,8 +835,6 @@ t if it is locked by you, else a string saying which user has locked it. */)
837 return ret; 835 return ret;
838} 836}
839 837
840#endif /* CLASH_DETECTION */
841
842void 838void
843syms_of_filelock (void) 839syms_of_filelock (void)
844{ 840{
@@ -850,9 +846,7 @@ syms_of_filelock (void)
850 doc: /* Non-nil means use lockfiles to avoid editing collisions. */); 846 doc: /* Non-nil means use lockfiles to avoid editing collisions. */);
851 create_lockfiles = 1; 847 create_lockfiles = 1;
852 848
853#ifdef CLASH_DETECTION
854 defsubr (&Sunlock_buffer); 849 defsubr (&Sunlock_buffer);
855 defsubr (&Slock_buffer); 850 defsubr (&Slock_buffer);
856 defsubr (&Sfile_locked_p); 851 defsubr (&Sfile_locked_p);
857#endif
858} 852}
diff --git a/src/insdel.c b/src/insdel.c
index 1c9bafd6004..5bd97f98613 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1,6 +1,6 @@
1/* Buffer insertion/deletion and gap motion for GNU Emacs. 1/* Buffer insertion/deletion and gap motion for GNU Emacs.
2 Copyright (C) 1985-1986, 1993-1995, 1997-2014 Free Software 2
3 Foundation, Inc. 3Copyright (C) 1985-1986, 1993-1995, 1997-2014 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -1829,21 +1829,11 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end,
1829 else 1829 else
1830 base_buffer = current_buffer; 1830 base_buffer = current_buffer;
1831 1831
1832#ifdef CLASH_DETECTION
1833 if (!NILP (BVAR (base_buffer, file_truename)) 1832 if (!NILP (BVAR (base_buffer, file_truename))
1834 /* Make binding buffer-file-name to nil effective. */ 1833 /* Make binding buffer-file-name to nil effective. */
1835 && !NILP (BVAR (base_buffer, filename)) 1834 && !NILP (BVAR (base_buffer, filename))
1836 && SAVE_MODIFF >= MODIFF) 1835 && SAVE_MODIFF >= MODIFF)
1837 lock_file (BVAR (base_buffer, file_truename)); 1836 lock_file (BVAR (base_buffer, file_truename));
1838#else
1839 /* At least warn if this file has changed on disk since it was visited. */
1840 if (!NILP (BVAR (base_buffer, filename))
1841 && SAVE_MODIFF >= MODIFF
1842 && NILP (Fverify_visited_file_modtime (Fcurrent_buffer ()))
1843 && !NILP (Ffile_exists_p (BVAR (base_buffer, filename))))
1844 call1 (intern ("ask-user-about-supersession-threat"),
1845 BVAR (base_buffer,filename));
1846#endif /* not CLASH_DETECTION */
1847 1837
1848 /* If `select-active-regions' is non-nil, save the region text. */ 1838 /* If `select-active-regions' is non-nil, save the region text. */
1849 /* FIXME: Move this to Elisp (via before-change-functions). */ 1839 /* FIXME: Move this to Elisp (via before-change-functions). */