diff options
| author | Gerd Moellmann <gerd@gnu.org> | 2000-04-09 10:47:46 +0000 |
|---|---|---|
| committer | Gerd Moellmann <gerd@gnu.org> | 2000-04-09 10:47:46 +0000 |
| commit | a8c21b482ffc1ce36f861cb8be0712bb4ffe8314 (patch) | |
| tree | e8d1e3526da3cfb5c50aa22aa983239c53e4ae32 | |
| parent | 3f923efebf0612da750734cc1b3f6f60137c6b12 (diff) | |
| download | emacs-a8c21b482ffc1ce36f861cb8be0712bb4ffe8314.tar.gz | |
(Frestore_buffer_modified_p): New function.
(syms_of_buffer): Defsubr it.
| -rw-r--r-- | src/buffer.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 848e9990776..37e0894af94 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -845,6 +845,36 @@ A non-nil FLAG means mark the buffer modified.") return flag; } +DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, + Srestore_buffer_modified_p, 1, 1, 0, + "Like `set-buffer-modified-p', with a differences concerning redisplay.\n\ +It is not ensured that mode lines will be updated to show the modified\n\ +state of the current buffer. Use with care.") + (flag) + Lisp_Object flag; +{ +#ifdef CLASH_DETECTION + Lisp_Object fn; + + /* If buffer becoming modified, lock the file. + If buffer becoming unmodified, unlock the file. */ + + fn = current_buffer->file_truename; + /* Test buffer-file-name so that binding it to nil is effective. */ + if (!NILP (fn) && ! NILP (current_buffer->filename)) + { + int already = SAVE_MODIFF < MODIFF; + if (!already && !NILP (flag)) + lock_file (fn); + else if (already && NILP (flag)) + unlock_file (fn); + } +#endif /* CLASH_DETECTION */ + + SAVE_MODIFF = NILP (flag) ? MODIFF : 0; + return flag; +} + DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, Sbuffer_modified_tick, 0, 1, 0, "Return BUFFER's tick counter, incremented for each change in text.\n\ @@ -4773,6 +4803,7 @@ Values are interpreted as follows:\n\ defsubr (&Soverlay_lists); defsubr (&Soverlay_get); defsubr (&Soverlay_put); + defsubr (&Srestore_buffer_modified_p); } void |
