File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,8 @@ Return black process the exit code."
121
121
Show black output, if black exit abnormally and DISPLAY is t."
122
122
(interactive (list t ))
123
123
(let* ((original-buffer (current-buffer ))
124
+ (original-point (point ))
125
+ (original-window-pos (window-start ))
124
126
(tmpbuf (get-buffer-create " *blacken*" ))
125
127
(errbuf (get-buffer-create " *blacken-error*" )))
126
128
; ; This buffer can be left after previous black invocation. It
@@ -132,7 +134,10 @@ Show black output, if black exit abnormally and DISPLAY is t."
132
134
(if (not (zerop (blacken-call-bin original-buffer tmpbuf errbuf)))
133
135
(error " Black failed, see %s buffer for details " (buffer-name errbuf))
134
136
(unless (eq (compare-buffer-substrings tmpbuf nil nil original-buffer nil nil ) 0 )
135
- (with-current-buffer original-buffer (replace-buffer-contents tmpbuf)))
137
+ (with-current-buffer tmpbuf
138
+ (copy-to-buffer original-buffer (point-min ) (point-max )))
139
+ (goto-char original-point)
140
+ (set-window-start (selected-window ) original-window-pos))
136
141
(mapc 'kill-buffer (list tmpbuf errbuf)))
137
142
(error (message " %s " (error-message-string err))
138
143
(when display
You can’t perform that action at this time.
0 commit comments