As much as most of my daily workflow revolves around Emacs, I always have GNOME terminal ready to fly with Fish shell and tmux. I keep EShell next to me for quick tasks, but I have never relied on shell-mode or ansi-term for other CLI-intensive work.

I don’t know what happened to the lovely “Emacs Chat” series from Sacha Chua, but more than three years ago she interviewed Mickey Petersen. Mickey talked with great enthusiasm about shell-mode and at the time I admittedly made a mental note about giving it a try. Regretfully, I have only recently come back to that note.

My first M-x shell didn’t look that great. I haven’t debugged the compatibility issues with Fish, probably something related to my heavily customised config.fish. Anyway, falling back to Bash is enough.

(validate-setq explicit-shell-file-name "/bin/bash")

Note that I am using validate-setq as I have already explained.1

Another thing I have noticed is the lack of colours for the output of ls. Fortunately, Emacs StackExchange has an answer for that,2 so I have added this line to my .bash_aliases file:

alias ls="TERM=ansi ls --color=always"

The input echoing is easily turned off following the instructions on the manual.3 Also, the history is much cleaner and easier to navigate with counsel-shell-history.

(unbind-key "C-c C-l" shell-mode-map)
(bind-key "C-c C-l" #'counsel-shell-history shell-mode-map)

Note that unbind-key and bind-key are macros from bind-key.el, which is part of the fantastic use-package.

Last but not least, I like to have my shell buffer filling the whole window in the current frame. Thus, display-buffer-alist to the rescue.

(validate-setq
 display-buffer-alist
 `(
   ;; … other stuff …
   (,(rx bos "*shell")
    (display-buffer-same-window)
    (reusable-frames . nil))
   ;; … other stuff …
  ))