In many versions of Emacs the sexp below (save-window-excursion (shell) (buffer-name (current-buffer))) returns "*shell*", but in some recent versions it returns the name of the current buffer instead. Let me be more precise. I ran the sexp below in the versions of Emacs that I have in my machine, (list emacs-version (save-window-excursion (shell) (buffer-name (current-buffer))) ) and collected the outputs, and got: ("24.5.1" "*shell*") ("25.1.1" "*shell*") ("26.3" "*shell*") ("27.0.50" "TODO") Here's the exact version of my "27.0.50". The output of PAGER=cat git log -1 --format=format:"%H%n%cd%n" was: 01ea96b5548a80e6aabc69428439113ce0a8c17e Mon Oct 14 08:47:02 2019 +0200 I don't know (yet) how to bisect versions to find exactly when the behavior changed, sorry... btw, this is a Debian box (on amd64). Cheers, Eduardo Ochs http://angg.twu.net/#eev