diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2017-11-04 14:28:00 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2017-11-05 21:33:57 +0100 |
| commit | ead60dbcdd8746db35a2e95a554f63e7d381366b (patch) | |
| tree | 99da4ab6297cf39135d358ef3c79644840a65208 /lisp/magit-diff.el | |
| parent | 0fefe6719b5f7541dbcc45458555b726f2fea237 (diff) | |
magit-diff-while-committing: cosmetics
`user-error' is a non-local exit anyway, so we
might as well make things a bit easier to read.
Diffstat (limited to 'lisp/magit-diff.el')
| -rw-r--r-- | lisp/magit-diff.el | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index 09b974a..97c440e 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -859,23 +859,23 @@ While amending, invoking the command again toggles between showing just the new changes or all the changes that will be committed." (interactive (list (car (magit-diff-arguments)))) + (unless (magit-commit-message-buffer) + (user-error "No commit in progress")) (let ((magit-display-buffer-noselect t) (toplevel (magit-toplevel)) (diff-buf (magit-mode-get-buffer 'magit-diff-mode))) - (if (magit-commit-message-buffer) - (if (and (or ;; most likely an explicit amend - (not (magit-anything-staged-p)) - ;; explicitly toggled from within diff - (and (eq (current-buffer) diff-buf))) - (or (not diff-buf) - (with-current-buffer diff-buf - (or ;; default to include last commit - (not (equal (magit-toplevel) toplevel)) - ;; toggle to include last commit - (not (car magit-refresh-args)))))) - (magit-diff-while-amending args) - (magit-diff-staged nil args)) - (user-error "No commit in progress")))) + (if (and (or ;; most likely an explicit amend + (not (magit-anything-staged-p)) + ;; explicitly toggled from within diff + (and (eq (current-buffer) diff-buf))) + (or (not diff-buf) + (with-current-buffer diff-buf + (or ;; default to include last commit + (not (equal (magit-toplevel) toplevel)) + ;; toggle to include last commit + (not (car magit-refresh-args)))))) + (magit-diff-while-amending args) + (magit-diff-staged nil args)))) (define-key git-commit-mode-map (kbd "C-c C-d") 'magit-diff-while-committing) |
