From 0a2f0e7f8c1ba54d160322c52865feef3e67d79c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 3 May 2022 22:06:31 +0200 Subject: Make with-buffer-unmodified-if-unchanged more efficient * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): Make more efficient. --- lisp/emacs-lisp/subr-x.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index a416059df62..298d370cb25 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -439,9 +439,9 @@ modification status: ;; If we didn't change anything in the buffer (and the buffer ;; was previously unmodified), then flip the modification status ;; back to "unchanged". - (when (buffer-live-p ,buffer) + (when (and ,hash (buffer-live-p ,buffer)) (with-current-buffer ,buffer - (when (and ,hash (buffer-modified-p) + (when (and (buffer-modified-p) (equal ,hash (buffer-hash))) (restore-buffer-modified-p nil)))))))) -- cgit v1.2.3