summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-05-10 03:38:01 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-05-10 03:46:43 +0200
commit0bee4cda881f7db4113cba541b684c334e828c4a (patch)
tree4873dc599fb34e07c5e967ea5d91cb867c151c1b /lisp
parent0b2f550e3229c7a1b001fb1a09e7a5b4e3ecfb3e (diff)
downloademacs-0bee4cda881f7db4113cba541b684c334e828c4a.tar.gz
Reimplement recent with-silent-modifications auto-save changes
* doc/lispref/buffers.texi (Buffer Modification): Document buffer-modified-p returning `autosaved'. * lisp/subr.el (with-silent-modifications): Use restore-buffer-modified-p instead of altering the buffer modiff (since this has other side effects like not updating after async `display' changes. * src/buffer.c (Fbuffer_modified_p): Allow returning whether the buffer has been autosaved after changes. (Frestore_buffer_modified_p): Allow adjusting whether the buffer has been autosaved after changes. * src/fileio.c (Fdo_auto_save): Refill the doc string.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/subr.el12
1 files changed, 4 insertions, 8 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 01549cc6f74..54c9f35264d 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4594,21 +4594,17 @@ like `buffer-modified-p', checking whether the file is locked by
someone else, running buffer modification hooks, and other things
of that nature."
(declare (debug t) (indent 0))
- (let ((modified (make-symbol "modified"))
- (tick (make-symbol "tick")))
+ (let ((modified (make-symbol "modified")))
`(let* ((,modified (buffer-modified-p))
- (,tick (buffer-modified-tick))
(buffer-undo-list t)
(inhibit-read-only t)
(inhibit-modification-hooks t))
(unwind-protect
(progn
,@body)
- ;; We restore the buffer tick count, too, because otherwise
- ;; we'll trigger a new auto-save.
- (internal--set-buffer-modified-tick ,tick)
- (unless ,modified
- (restore-buffer-modified-p nil))))))
+ (when (or (not ,modified)
+ (eq ,modified 'autosaved))
+ (restore-buffer-modified-p ,modified))))))
(defmacro with-output-to-string (&rest body)
"Execute BODY, return the text it sent to `standard-output', as a string."