branch: elpa/git-commit commit 09333d63a28d476cb036edd588013ac37b2484ac Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-save-repository-buffers: Rearrange and improve comments --- lisp/magit-mode.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el index 9a4585c..59b8fd0 100644 --- a/lisp/magit-mode.el +++ b/lisp/magit-mode.el @@ -1220,15 +1220,19 @@ argument (the prefix) non-nil means save all with no questions." ,@save-some-buffers-action-alist))) (save-some-buffers arg (lambda () - (and (not magit-inhibit-refresh-save) - buffer-file-name - ;; Avoid needlessly connecting to unrelated remotes. + (and buffer-file-name + ;; - Check whether refreshing is disabled. + (not magit-inhibit-refresh-save) + ;; - Check whether the visited file is either on the + ;; same remote as the repository, or both are on + ;; the local system. (equal (file-remote-p buffer-file-name) remote) - ;; For remote files this makes network requests and - ;; therefore has to come after the above to avoid - ;; unnecessarily waiting for unrelated hosts. - (file-writable-p buffer-file-name) - (equal (magit-rev-parse-safe "--show-toplevel") topdir))))))) + ;; Delayed checks that are more expensive for remote + ;; repositories, due to the required network access. + ;; - Check whether the file is inside the repository. + (equal (magit-rev-parse-safe "--show-toplevel") topdir) + ;; - Check whether the file is actually writable. + (file-writable-p buffer-file-name))))))) ;;; Restore Window Configuration