From: Lars Ingebrigtsen Date: Tue, 3 May 2022 20:06:31 +0000 (+0200) Subject: Make with-buffer-unmodified-if-unchanged more efficient X-Git-Tag: emacs-29.0.90~1931^2~89 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0a2f0e7f8c1ba54d160322c52865feef3e67d79c;p=emacs.git Make with-buffer-unmodified-if-unchanged more efficient * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): Make more efficient. --- 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))))))))