From 6bc76cee212aab0a2c02f8c28213fc842cc7880f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 8 Apr 2014 21:48:07 -0400 Subject: [PATCH] * src/insdel.c (prepare_to_modify_buffer_1): Cancel lock-file checks and region handling (and don't call signal_before_change) if inhibit_modification_hooks is set. (signal_before_change): Don't check inhibit_modification_hooks any more. * lisp/subr.el (with-silent-modifications): Don't bind deactivate-mark, buffer-file-name, and buffer-file-truename any more. --- etc/NEWS | 3 +++ lisp/ChangeLog | 5 +++++ lisp/subr.el | 7 +------ src/ChangeLog | 7 +++++++ src/insdel.c | 9 ++++----- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index f78199b97d..706d25925e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -71,6 +71,9 @@ protocols as well as for "telnet" and "ftp" are passed to Tramp. * Incompatible Lisp Changes in Emacs 24.5 +** inhibit-modification-hooks now also inhibits lock-file checks as well as +active region handling. + * Lisp Changes in Emacs 24.5 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6161051faf..26bcb7fd66 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-04-09 Stefan Monnier + + * subr.el (with-silent-modifications): Don't bind deactivate-mark, + buffer-file-name, and buffer-file-truename any more. + 2014-04-08 Leo Liu Use lexical-binding and require cl-lib. diff --git a/lisp/subr.el b/lisp/subr.el index 5de69d92e3..6cfece1045 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3174,12 +3174,7 @@ not really affect the buffer's content." `(let* ((,modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) - (inhibit-modification-hooks t) - deactivate-mark - ;; Avoid setting and removing file locks and checking - ;; buffer's uptodate-ness w.r.t the underlying file. - buffer-file-name - buffer-file-truename) + (inhibit-modification-hooks t)) (unwind-protect (progn ,@body) diff --git a/src/ChangeLog b/src/ChangeLog index ea32a480a6..531d1f646c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-04-09 Stefan Monnier + + * insdel.c (prepare_to_modify_buffer_1): Cancel lock-file checks and + region handling (and don't call signal_before_change) if + inhibit_modification_hooks is set. + (signal_before_change): Don't check inhibit_modification_hooks any more. + 2014-04-08 Daniel Colascione * alloc.c (sweep_symbols, mark_object): Assert that symbol diff --git a/src/insdel.c b/src/insdel.c index 9f9fcbd041..15cdaf6f91 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1804,6 +1804,9 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, else base_buffer = current_buffer; + if (inhibit_modification_hooks) + return; + if (!NILP (BVAR (base_buffer, file_truename)) /* Make binding buffer-file-name to nil effective. */ && !NILP (BVAR (base_buffer, filename)) @@ -1813,7 +1816,6 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, /* If `select-active-regions' is non-nil, save the region text. */ /* FIXME: Move this to Elisp (via before-change-functions). */ if (!NILP (BVAR (current_buffer, mark_active)) - && !inhibit_modification_hooks && XMARKER (BVAR (current_buffer, mark))->buffer && NILP (Vsaved_region_selection) && (EQ (Vselect_active_regions, Qonly) @@ -1924,9 +1926,6 @@ signal_before_change (ptrdiff_t start_int, ptrdiff_t end_int, ptrdiff_t count = SPECPDL_INDEX (); struct rvoe_arg rvoe_arg; - if (inhibit_modification_hooks) - return; - start = make_number (start_int); end = make_number (end_int); preserve_marker = Qnil; @@ -1937,7 +1936,7 @@ signal_before_change (ptrdiff_t start_int, ptrdiff_t end_int, specbind (Qinhibit_modification_hooks, Qt); /* If buffer is unmodified, run a special hook for that case. The - check for Vfirst_change_hook is just a minor optimization. */ + check for Vfirst_change_hook is just a minor optimization. */ if (SAVE_MODIFF >= MODIFF && !NILP (Vfirst_change_hook)) { -- 2.20.1