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: Nick Helm
Subject: Re: Quotes do not display correctly
Date: Fri, 8 Apr 2016 02:20:49 +0000

> On 8/04/2016, at 3:22 AM, Eli Zaretskii <address@hidden> wrote:
> 
>> The quotes also appear to have a display table and face applied, but I
>> don’t understand the significance of this information, or if it’s a clue to
>> solving my problem.
> 
> It _is_ a clue.  But to understand what goes wrong, more information
> is needed, because Emacs was supposed to set up the display table only
> if your display is unable to show the Unicode quote characters.
> 
> So please make a bug report, and include there the details about how
> you started Emacs.  Also, please make sure you try reproducing the
> problem with the latest emacs-25 branch of the Emacs repository, or at
> least with the latest pretest of Emacs 25, because it's possible that
> this problem was already solved.

Thanks for the suggestions everyone,

Reproducing this from Emacs -Q has been difficult, but I think I've
narrowed it down. It's quite specific.

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? 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.

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. 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.

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.












reply via email to

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