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?

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.