summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-10-18 11:26:59 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-10-18 12:40:47 -0700
commit58a51e7a29d271d7356af86df9a16c168fcd4d9e (patch)
tree7ca6e673aedefbf7c55766c3c48963dfb148dc83
parent5b165f7a3b8ca561debd4920356ceeaa923fccfb (diff)
downloaddotfiles-58a51e7a29d271d7356af86df9a16c168fcd4d9e.tar.gz
spw/diff-discard-hunk: use save-window-excursion w/ diff-apply-hunk
-rw-r--r--.emacs.d/init.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index ad2c90d5..f7419764 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -3585,7 +3585,11 @@ mutt's review view, after exiting EDITOR."
(diff-advance-after-apply-hunk t)
(buffer (car (diff-find-source-location)))
(to-save (and (not (buffer-modified-p buffer)) buffer)))
- (diff-apply-hunk t)
+ ;; We cannot just bind `display-buffer-no-window' into
+ ;; `display-buffer-overriding-action' because `diff-apply-hunk' assumes
+ ;; `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))