diff --git a/lisp/simple.el b/lisp/simple.el index 3ac6b86381..4f6708dbc1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3552,8 +3552,7 @@ shell-command (lambda (process _string) (let ((buf (process-buffer process))) (when (and (zerop (buffer-size buf)) - (string= (buffer-name buf) - bname)) + (eq buf buffer)) (display-buffer buf)))))))) ;; Otherwise, command is executed synchronously. (shell-command-on-region (point) (point) command