emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [OT] Encoding error when calling a ruby script from Emacs using


From: Marcelo de Moraes Serpa
Subject: Re: [O] [OT] Encoding error when calling a ruby script from Emacs using shell-command
Date: Sat, 1 Sep 2012 12:29:26 -0500

This is nonsense, may I suggest you read locale (1p)?  If you set
LC_ALL, this overrides the other two settings no matter what they are
set to (and you may prevent some scripts trying to set LC_COLLATE or
something like that from functioning correctly).  Unless you really need
such a big hammer, set LANG (this provides the default) and leave it at
that.

I had no idea it worked like that. Thanks for the heads up. 

I don't understand why such a hammer is needed at all

It was a simple labor of trial and error. I didn't want to spend more time on it, and since it worked, I left it as is, for now.

And in that case, how/why does it work from a terminal?

It works fine from the terminal (iTerm/zshell), and after I used setenv before the (shell-command), it worked just like it does from when ran from the terminal.  

I might get into it and try to figure out why emacs is not inheriting the setting from the shell (I'm using zshell on Mac OSX Lion, and emacs is "(GNU Emacs 23.4.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-01-29 on bob.porkrind.org)". But for now, I'll leave it as is, since it's working as expected.

Thanks!

- Marcelo.

On Sat, Sep 1, 2012 at 8:53 AM, Nick Dokos <address@hidden> wrote:
Achim Gratz <address@hidden> wrote:

> Marcelo de Moraes Serpa writes:
> > So, I did this:
> >
> > (defun test ()
> >  (setenv "LANG" "en_US.UTF-8")
> >  (setenv "LC_ALL" "en_US.UTF-8")
> >  (setenv "LC_CTYPE" "en_US.UTF-8")
> >  (shell-command "/Users/myself/.rvm/bin/rvm ruby-1.9.3-p194 do
> > /usr/bin/rubyscript"))
>
> This is nonsense, may I suggest you read locale (1p)?  If you set
> LC_ALL, this overrides the other two settings no matter what they are
> set to (and you may prevent some scripts trying to set LC_COLLATE or
> something like that from functioning correctly).  Unless you really need
> such a big hammer, set LANG (this provides the default) and leave it at
> that.
>

I don't understand why such a hammer is needed at all: if LANG (or
LC_ALL) is set in a login shell[fn:1] and exported, then all child
processes (including emacs and including any shells that emacs spawns)
will inherit the setting. So if setting it as above with setenv
(i.e. modifying the emacs environment and therefore the processes that
emacs spawns) makes a difference, that suggests that it is not set
globally. I doubt that that is a good idea in general. Even if you want
it just in the case of emacs, it's probably better to do the setenv
first thing in .emacs.

And in that case, how/why does it work from a terminal?

Nick

Footnotes:

[fn:1] Or some equivalent way for a graphical login.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]