4

M-x shell has been my friend for decades, and I've always been comfortable even sympathetic with his insistence on being a dumb terminal (i.e. TERM=dumb). But recently I've found my self setting LC_ALL by hand so that python won't default to ASCII on its standard streams. I vaguely recall having similar problems at other times with ruby and perl.

So, my question: What is a good approach to setting things up so I don't have to set LC_ALL by hand? For example, should I just slam this in shell-mode-hook?

Drew
  • 77,472
  • 10
  • 114
  • 243
Ben Hyde
  • 574
  • 3
  • 9

2 Answers2

1

Would setting TERM=emacs as part of the actual shell startup help? I have had

  [ "${INSIDE_EMACS}" != "" ] && export TERM=emacs

in my ~/.bashrc for longer than I can remember and (shell) has been part of my startup sequence for decades.

jwd630
  • 131
  • 4
0

Here's what I have been doing to address this.

(defun force-lc-all-for-shell ()
  "For the benefit of python we force LC_ALL to utf-8."
  (comint-send-string (get-buffer-process (current-buffer)) "LC_ALL=en_US.UTF-8\n"))

(add-hook 'shell-mode-hook 'force-lc-all-for-shell)

But it seems quite ad hoc, and obviously doesn't affect other ways of running programs from Emacs.

Constantine
  • 9,122
  • 1
  • 35
  • 50
Ben Hyde
  • 574
  • 3
  • 9