Skip to content

Commit c0fb1b4

Browse files
jrosdahlproofit404
authored andcommitted
Only restore point and window start when needed (#17)
This seems to fix #16 for me, although I’m not really sure why.
1 parent d6929cf commit c0fb1b4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

blacken.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ Show black output, if black exit abnormally and DISPLAY is t."
136136
(error "Black failed, see %s buffer for details" (buffer-name errbuf))
137137
(unless (eq (compare-buffer-substrings tmpbuf nil nil original-buffer nil nil) 0)
138138
(with-current-buffer tmpbuf
139-
(copy-to-buffer original-buffer (point-min) (point-max))))
140-
(mapc 'kill-buffer (list tmpbuf errbuf))
141-
(goto-char original-point)
142-
(set-window-start (selected-window) original-window-pos))
139+
(copy-to-buffer original-buffer (point-min) (point-max)))
140+
(goto-char original-point)
141+
(set-window-start (selected-window) original-window-pos))
142+
(mapc 'kill-buffer (list tmpbuf errbuf)))
143143
(error (message "%s" (error-message-string err))
144144
(when display
145145
(pop-to-buffer errbuf))))))

0 commit comments

Comments
 (0)