@end defun
@defun restore-buffer-modified-p flag
-Like @code{set-buffer-modified-p}, but does not force redisplay
-of mode lines. This function also allows a @var{flag} value of
-@code{autosaved}, which marks the buffer as having been autosaved
+Like @code{set-buffer-modified-p}, but does not force redisplay of
+mode lines. This function also allows a @var{flag} value of
+@code{autosaved}, which also marks the buffer as having been autosaved
after the last modification.
@end defun
Srestore_buffer_modified_p, 1, 1, 0,
doc: /* Like `set-buffer-modified-p', but doesn't redisplay buffer's mode line.
A nil FLAG means to mark the buffer as unmodified. A non-nil FLAG
-means mark the buffer as modified, but the special value
-`autosaved' will instead mark the buffer as having been
-autosaved since it was last modified.
+means mark the buffer as modified. A special value of `autosaved'
+will mark the buffer modified, and also as having been autosaved since
+it was last modified.
This function also locks or unlocks the file visited by the buffer,
if both `buffer-file-truename' and `buffer-file-name' are non-nil.
SAVE_MODIFF = MODIFF;
else
{
- if (EQ (flag, Qautosaved))
- BUF_AUTOSAVE_MODIFF (b) = MODIFF;
/* If SAVE_MODIFF == auto_save_modified == MODIFF, we can either
decrease SAVE_MODIFF and auto_save_modified or increase
MODIFF. */
- else if (SAVE_MODIFF >= MODIFF)
+ if (SAVE_MODIFF >= MODIFF)
SAVE_MODIFF = modiff_incr (&MODIFF);
+ if (EQ (flag, Qautosaved))
+ BUF_AUTOSAVE_MODIFF (b) = MODIFF;
}
return flag;
}
(should (eq (buffer-modified-p) 'autosaved))
(insert "zot")
(restore-buffer-modified-p 'autosaved)
+ (should (eq (buffer-modified-p) 'autosaved))))
+
+ (ert-with-temp-file file
+ (with-current-buffer (find-file file)
+ (auto-save-mode 1)
+ (should-not (buffer-modified-p))
+ (insert "foo")
+ (should (buffer-modified-p))
+ (should-not (eq (buffer-modified-p) 'autosaved))
+ (restore-buffer-modified-p 'autosaved)
(should (eq (buffer-modified-p) 'autosaved)))))
;;; buffer-tests.el ends here