diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-10-18 11:28:04 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-10-18 12:41:09 -0700 |
commit | 48c82e829dfe5792ffc9ac9636719bc1ee36cb94 (patch) | |
tree | f5ff1fbac04bc556690becd1c836d9fd361a9c4d | |
parent | 58a51e7a29d271d7356af86df9a16c168fcd4d9e (diff) | |
download | dotfiles-48c82e829dfe5792ffc9ac9636719bc1ee36cb94.tar.gz |
spw/diff-discard-hunk: attempt to simplify
-rw-r--r-- | .emacs.d/init.el | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index f7419764..e66dd3ad 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -3581,8 +3581,7 @@ mutt's review view, after exiting EDITOR." ;; Save only buffers that weren't already modified. (defun spw/diff-discard-hunk () (interactive) - (let* ((beg (point)) - (diff-advance-after-apply-hunk t) + (let* (diff-advance-after-apply-hunk (buffer (car (diff-find-source-location))) (to-save (and (not (buffer-modified-p buffer)) buffer))) ;; We cannot just bind `display-buffer-no-window' into @@ -3590,9 +3589,7 @@ mutt's review view, after exiting EDITOR." ;; `display-buffer' returns non-nil. See docstring for ;; `display-buffer-no-window'. (save-window-excursion (diff-apply-hunk t)) - (unless (= beg (point)) - (diff-hunk-next -1) - (diff-hunk-kill)) + (diff-hunk-kill) (when to-save (with-current-buffer to-save (basic-save-buffer))))) |