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: Eli Zaretskii
Subject: Re: Quotes do not display correctly
Date: Fri, 08 Apr 2016 10:21:14 +0300

> From: Nick Helm <nick@tenpoint.co.nz>
> Date: Fri, 8 Apr 2016 02:20:49 +0000
> 
> I'm on OS X and I launch Emacs using an Applescript script contained
> within an Automator bundle. At startup, it essentially does this 
> (with -Q added):
> 
>   do shell script "/Applications/Emacs.app/Contents/MacOS/Emacs -Q
>                    --daemon " 
>   do shell script "/Applications/Emacs.app/Contents/MacOS/bin/
>                    emacsclient -n -c "
> 
> The problem only occurs when I launch this way - that is, Emacs does not
> exhibit the quoting problem when I launch the /Applications/Emacs.app
> bundle directly via double click, nor when started on the command line
> using Emacs -Q --daemon and emacsclient -n -c, not even when starting 
> the script from the command line with oascript.
> 
> Rather than being a bug, is it possible Emacs isn't receiving the
> correct startup environment and is simply doing its best to display
> extended chars on what it thinks is a terminal with limited display
> capabilities?

Most probably, yes.

> On the other hand, I've used this launch method for years
> and this issue only surfaced recently. It's also interesting that other
> Unicode chars display without any problems. I tested on 25.0.92.1 and
> 25.1.50.1, which both have the issue, and 24.5.1, which does not.

The feature of displaying ‘..’ as `..' on less-capable displays is new
in Emacs 25.  Since Emacs now produces such characters when it
displays doc strings, it was important to make sure these characters
are always shown as something legible.

> A few more clues. Where quotes do not show correctly, I can see a
> different value for standard-display-table. Replacing this with a value
> from an Emacs that does show them correctly fixes the problem.

You can work around the problem by changing the value of
standard-display-table, indeed.

> I did a bit of reading and this led me to a new function named
> startup--setup-quote-display in startup.el, which seems to
> manipulate standard-display-table to let Emacs display Unicode quote
> char equivalents in terminals that only support ASCII chars. It
> looks like this function uses internal-char-font and
> char-displayable-p to determine what changes to make, but I can't
> figure out how these functions determine the capabilities of the
> terminal/display in the first place.

In a GUI session, they look at the standard fonts; in a TTY session,
they look at the locale's encoding.  So Bob's advice to set LANG
correctly might be a better solution than messing with
standard-display-table.

> 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. Changing it to something like this:
> 
>   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.

Setting LANG to a correct value is the correct solution.



reply via email to

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