What's wrong with `(add-to-list 'process-coding-system-alist '("zsh" . utf-8))`?

4

1

In Emacs, I routinely use an inferior shell, invoked with M-x shell. I often need to specifically set its coding system, which I do with C-x RET p followed by utf-8 (twice).

I want to do this once and for all in my .emacs file. The documentation says that the default coding system for shells started via M-x shell comes from process-coding-system-alist. After consulting the documentation for this variable, I tried

(add-to-list 'process-coding-system-alist '("zsh" . utf-8))

...since zsh is my default shell. (According to the docs, the first element of the added pair is interpreted as a regex matching the shell program's name, so the string shown above should work.)

This, however, fails to produce the desired result. (E.g. some characters are not properly displayed in stdout in a freshly started *shell*; nevertheless, these characters are properly displayed once I execute C-x RET p, etc., as described above. This means that, whatever my add-to-list command is doing, it is not doing what I want it to do.)

My question is simply, why doesn't'

(add-to-list 'process-coding-system-alist '("zsh" . utf-8))

work?

NB: there may be other ways to achieve the same result, but here I am specifically interested in understanding why what I tried did not work, and fix it.

kjo

Posted 2012-05-15T00:24:34.273

Reputation: 733

Did you try starting emacs with "Toggle debug on error" to check if it correctly reads that line? – T. Verron – 2012-05-16T22:15:07.097

Answers

0

On my system, C-hv on the variable showed that it was initialized to: ("[pP][lL][iI][nN][kK]" . #1=(undecided-dos . undecided-dos))

So to get cygwin bash working, I added: (add-to-list 'process-coding-system-alist '("[bB][aA][sS][hH]" . (undecided-unix . undecided-unix)))

By extension I'd think that this would work: (add-to-list 'process-coding-system-alist '("zsh" . (utf-8 . utf)))

A Gern

Posted 2012-05-15T00:24:34.273

Reputation: 1

0

I'm not sure about this and I don't really have a way to replicate it, but are you not missing a pair of parentheses, around utf-8?

(add-to-list 'process-coding-system-alist '("zsh" . (utf-8)))

terdon

Posted 2012-05-15T00:24:34.273

Reputation: 45 216