From fcfc70c136848d6844eef6247ef270f266444ef3 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Thu, 2 Oct 2008 01:18:25 +0300 Subject: [PATCH] Avoid some unnecessary refreshes. * magit.el (magit-refresh-wrapper): Only revert files and refresh status buffer when there is at least one buffer in need of refresh. --- magit.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/magit.el b/magit.el index 302d0b5a..2d891785 100644 --- a/magit.el +++ b/magit.el @@ -987,14 +987,16 @@ Please see the manual for a complete description of Magit. (defun magit-refresh-wrapper (func) (if magit-refresh-pending (funcall func) - (let ((magit-refresh-needing-buffers - (list (magit-find-buffer 'status default-directory))) + (let ((status-buffer (magit-find-buffer 'status default-directory)) + (magit-refresh-needing-buffers nil) (magit-refresh-pending t)) (unwind-protect (funcall func) - (magit-revert-buffers) - (dolist (b magit-refresh-needing-buffers) - (magit-refresh-buffer b)))))) + (when magit-refresh-needing-buffers + (magit-revert-buffers) + (dolist (b (adjoin status-buffer + magit-refresh-needing-buffers)) + (magit-refresh-buffer b))))))) (defun magit-need-refresh (&optional buffer) (let ((buffer (or buffer (current-buffer))))