Function: set-buffer-modified-p
set-buffer-modified-p is a function defined in buffer.c.
Signature
(set-buffer-modified-p FLAG)
Documentation
Mark current buffer as modified or unmodified according to FLAG.
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(var)/buffer-file-name(fun)
and buffer-file-truename are non-nil.
Source Code
// Defined in /usr/src/emacs/src/buffer.c
{
Frestore_buffer_modified_p (flag);
/* Set update_mode_lines only if buffer is displayed in some window.
Packages like jit-lock or lazy-lock preserve a buffer's modified
state by recording/restoring the state around blocks of code.
Setting update_mode_lines makes redisplay consider all windows
(on all frames). Stealth fontification of buffers not displayed
would incur additional redisplay costs if we'd set
update_modes_lines unconditionally.
Ideally, I think there should be another mechanism for fontifying
buffers without "modifying" buffers, or redisplay should be
smarter about updating the `*' in mode lines. --gerd */
return Fforce_mode_line_update (Qnil);
}