]> git.eshelyaron.com Git - emacs.git/commitdiff
Make with-buffer-unmodified-if-unchanged more efficient
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 3 May 2022 20:06:31 +0000 (22:06 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 3 May 2022 20:06:31 +0000 (22:06 +0200)
* lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged):
Make more efficient.

lisp/emacs-lisp/subr-x.el

index a416059df6262ba9330cd929b619bfa648fdc0ef..298d370cb2554a14ad32f149948924e1ee80be9a 100644 (file)
@@ -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))))))))