help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Quotes do not display correctly


From: Bob Proulx
Subject: Re: Quotes do not display correctly
Date: Thu, 7 Apr 2016 21:38:25 -0600
User-agent: Mutt/1.5.24 (2015-08-30)

Nick Helm wrote:
> I'm on OS X and I launch Emacs using an Applescript script contained
> within an Automator bundle. At startup, it essentially does this 
>...

> Ok, more reading and it looks like it's determined by the default coding
> system and language environment that Emacs picks up from the system
> during startup. I have $LANG set in my environment, but for some reason
> the script isn't seeing it.

How are you setting LANG?  In a ~/.bashrc file?  I don't know anything
about Apple OS X but in regular X11 settings in ~/.bashrc files only
affect interactive shells and not other programs that are not
interactive bash shells.  In order to set the environment in X Windows
for example one way would be in a .xsessionrc file which is
specifically loaded by the window system.  I would guess it is similar
with other systems.

> Changing it to something like this:
> 
>   do shell script "export LANG=en_NZ.UTF-8; /Applications/Emacs.app/
>                    Contents/MacOS/Emacs -Q --daemon "

That line break and indent seems unintentional.  Mailer problem?  I
assume it was meant to be this.  Which I am going to comment upon.

> do shell script "export LANG=en_NZ.UTF-8; 
> /Applications/Emacs.app/Contents/MacOS/Emacs -Q --daemon "

> seems to fix the problem, at least standard-display-table remains
> unchanged, and the quote chars display correctly in my buffers (and the
> rest of Emacs it seems). text-quoting-style now seems to have its
> intended effect as well.
> 
> I'm not sure if this is the correct solution, but it seems work.

I wanted to comment upon the way you set the variable.  That works,
obviously.  But it isn't very idiomatic.  It is possible that the
inclusion of a ';' shell metacharacter in the string will require a
"/bin/sh -c" to be invoked in order to interpret the script.  Often
programs optimize the /bin/sh call out if there are no shell
meta-characters.  But the above requires it.

Better would be to use the "env" command to run something in a
modified environment.  It is one of the POSIX standard commands and
very portably found on systems.  This avoids the need for shell
meta-characters, may allow the system to optimize the shell out, and
allows very fine control of the environment.  With that it would be:

  env LANG=en_NZ.UTF-8 /Applications/Emacs.app/Contents/MacOS/Emacs -Q --daemon

Having said all of the above I am not sure this is the best solution.
This is simply the first environment variable you have set somewhere
(~/.bashrc ?) and you may run into other problems.  It might be better
to figure out how to get your environment set somewhere, such as in
the X11 ~/.xsessionrc file case, rather than play the wack-a-mole game
hitting individual environment variables one by one as you run into
problems not having them.

Good Luck and Happy Hacking,
Bob



reply via email to

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