From 81b1028b63b7d56a9483606fc7c656dd5cee28af Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 28 Dec 2017 19:23:34 +0200 Subject: Improve documentation of 'inhibit-modification-hooks' and friends * src/buffer.c (Fset_buffer_modified_p) (Frestore_buffer_modified_p): Doc fixes. * src/insdel.c (syms_of_insdel) : Document in the doc string that this variable also inhibits file locks and active region handling. (Bug#29846) --- src/buffer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 7ae889decf7..bcde2c80989 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1320,7 +1320,12 @@ menu bar menus and the frame title. */) DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, 1, 1, 0, doc: /* Mark current buffer as modified or unmodified according to FLAG. -A non-nil FLAG means mark the buffer modified. */) +A non-nil FLAG means mark the buffer modified. +In addition, this function unconditionally forces redisplay of the +mode lines of the windows that display the current buffer, and also +locks or unlocks the file visited by the buffer, depending on whether +the function's argument is non-nil, but only if both `buffer-file-name' +and `buffer-file-truename' are non-nil. */) (Lisp_Object flag) { Frestore_buffer_modified_p (flag); @@ -1341,7 +1346,10 @@ A non-nil FLAG means mark the buffer modified. */) DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, Srestore_buffer_modified_p, 1, 1, 0, - doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. + doc: /* Like `set-buffer-modified-p', but doesn't redisplay buffer's mode line. +This function also locks and unlocks the file visited by the buffer, +if both `buffer-file-truename' and `buffer-file-name' are non-nil. + It is not ensured that mode lines will be updated to show the modified state of the current buffer. Use with care. */) (Lisp_Object flag) -- cgit v1.2.1 From e879a5444a86e8fc030bbef69fbb8d84e9961fa3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 28 Dec 2017 14:03:07 -0500 Subject: * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846 Don't mess with the lock file when inhibit_modification_hooks is set, just like we do in prepare_to_modify_buffer_1. --- src/buffer.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index bcde2c80989..7ed21f0e327 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1354,7 +1354,6 @@ It is not ensured that mode lines will be updated to show the modified state of the current buffer. Use with care. */) (Lisp_Object flag) { - Lisp_Object fn; /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ @@ -1363,15 +1362,18 @@ state of the current buffer. Use with care. */) ? current_buffer->base_buffer : current_buffer; - fn = BVAR (b, file_truename); - /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (BVAR (b, filename))) + if (!inhibit_modification_hooks) { - bool already = SAVE_MODIFF < MODIFF; - if (!already && !NILP (flag)) - lock_file (fn); - else if (already && NILP (flag)) - unlock_file (fn); + Lisp_Object fn = BVAR (b, file_truename); + /* Test buffer-file-name so that binding it to nil is effective. */ + if (!NILP (fn) && ! NILP (BVAR (b, filename))) + { + bool already = SAVE_MODIFF < MODIFF; + if (!already && !NILP (flag)) + lock_file (fn); + else if (already && NILP (flag)) + unlock_file (fn); + } } /* Here we have a problem. SAVE_MODIFF is used here to encode -- cgit v1.2.1 From 5c7dd8a783fa2503f042f6671279e5fca38c35cb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 1 Jan 2018 00:21:42 -0800 Subject: Update copyright year to 2018 Run admin/update-copyright. --- src/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 7ed21f0e327..9b54e4b7787 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1,6 +1,6 @@ /* Buffer manipulation primitives for GNU Emacs. -Copyright (C) 1985-1989, 1993-1995, 1997-2017 Free Software Foundation, +Copyright (C) 1985-1989, 1993-1995, 1997-2018 Free Software Foundation, Inc. This file is part of GNU Emacs. -- cgit v1.2.1