From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Quotes do not display correctly Date: Fri, 08 Apr 2016 10:21:14 +0300 Message-ID: <83y48ok1lh.fsf@gnu.org> References: <83k2k9l9ym.fsf@gnu.org> <7C71F821-C50E-4E5A-B959-A99C53820080@tenpoint.co.nz> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1460100108 27059 80.91.229.3 (8 Apr 2016 07:21:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Apr 2016 07:21:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 08 09:21:48 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aoQjk-0007Pa-Ac for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Apr 2016 09:21:48 +0200 Original-Received: from localhost ([::1]:54551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoQjj-0002bE-EY for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Apr 2016 03:21:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoQjY-0002ZF-76 for help-gnu-emacs@gnu.org; Fri, 08 Apr 2016 03:21:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoQjV-0003cm-16 for help-gnu-emacs@gnu.org; Fri, 08 Apr 2016 03:21:36 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoQjU-0003ci-U2 for help-gnu-emacs@gnu.org; Fri, 08 Apr 2016 03:21:32 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3849 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aoQjT-0003zk-Jx for help-gnu-emacs@gnu.org; Fri, 08 Apr 2016 03:21:32 -0400 In-reply-to: <7C71F821-C50E-4E5A-B959-A99C53820080@tenpoint.co.nz> (message from Nick Helm on Fri, 8 Apr 2016 02:20:49 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:109735 Archived-At: > From: Nick Helm > 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.