From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs Subject: bug#22392: Emacs OS X GUI doesn't set locale Date: Wed, 27 Jan 2016 07:21:41 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1143f394bbd317052a4ad04c X-Trace: ger.gmane.org 1453875740 5084 80.91.229.3 (27 Jan 2016 06:22:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2016 06:22:20 +0000 (UTC) Cc: 22392@debbugs.gnu.org, emacs-devel To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 27 07:22:12 2016 Return-path: Envelope-to: geb-bug-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 1aOJUY-0005i9-Ei for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jan 2016 07:22:10 +0100 Original-Received: from localhost ([::1]:48279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOJUX-0000ls-Lb for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jan 2016 01:22:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOJUT-0000ii-76 for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2016 01:22:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOJUQ-0006W0-0K for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2016 01:22:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOJUP-0006Vw-U2 for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2016 01:22:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aOJUP-0005wG-Pe for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2016 01:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jan 2016 06:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22392 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22392-submit@debbugs.gnu.org id=B22392.145387570922810 (code B ref 22392); Wed, 27 Jan 2016 06:22:01 +0000 Original-Received: (at 22392) by debbugs.gnu.org; 27 Jan 2016 06:21:49 +0000 Original-Received: from localhost ([127.0.0.1]:38023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aOJUC-0005vp-R5 for submit@debbugs.gnu.org; Wed, 27 Jan 2016 01:21:49 -0500 Original-Received: from mail-vk0-f51.google.com ([209.85.213.51]:33891) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aOJUA-0005vc-UL for 22392@debbugs.gnu.org; Wed, 27 Jan 2016 01:21:47 -0500 Original-Received: by mail-vk0-f51.google.com with SMTP id e185so105165615vkb.1 for <22392@debbugs.gnu.org>; Tue, 26 Jan 2016 22:21:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xqEeLoGltrlwVLYYf4QbSWHZEvtgClfmUkF+oenzRE8=; b=piepn0AcSqEeVvgXllg56SLNFUUdzOJ3NHGPDO05S3h8OI4LZpi54GAdo4eKdrB1qS jQjrYYbKXdWX2XAZw/n9hCLZPyu13hQ1RJ/grMQgGj39rgovYXFg8/XaiTvVNX/hokRO hSsNaChioDFq7q5RVjsXiEw5HBC5OOsisMFai3HrrJB2b/iKnjrp836yufQqggQnezfV 4BzTZy+HXRHsxhuXk/0GmBHJgDGwFSAER1YVcryc1ft4mgvNcgGgs47DGfWVdggZSTUX J5G6pNvPsNLgGxuBK+J82VncSHqRfZWI4n7SQu/0PM4NTzAsbUE57ZI4B0e7zW1WTa8q oSSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=xqEeLoGltrlwVLYYf4QbSWHZEvtgClfmUkF+oenzRE8=; b=IVwy7pY7iFKreADPmdFK/qoa/k29MVlgIr9H1xGHoXpKleazLhuxLHCUTG7ClobcdR R7wqCtGDn07ymWfG+JIrlUR6sJkkpMFnRj/27yvQSE2ut1nHG5AWg6EOWmcBhjf940xT 4yVuc2OwLhsKAXH0xDQHPyg16rYU6/TuugW2/div9ufKANnkaimD/MDB5irAcFwRr4s5 AsUmvLtF9XI8P5PWU0OvyRjTqNXUYxG9mptSTqSLCPj2Yv7kV6i1FyjbYh/yK847aNnX XAdohHEVGYiXejzky0ETT/uII3h/0L/+Y3NcSk0D191QyVHvvEguzjZfumOpA4KxwOS8 IxAQ== X-Gm-Message-State: AG10YOQAgM/zU2fd0KryGHlrZ/uNly/q/mNSXRA7BfZyqbXzrRNh5j6BKhiga5PSf8LILh97/CuhvxmvRkZ90Q== X-Received: by 10.31.173.18 with SMTP id w18mr15080807vke.31.1453875701467; Tue, 26 Jan 2016 22:21:41 -0800 (PST) Original-Received: by 10.31.214.131 with HTTP; Tue, 26 Jan 2016 22:21:41 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:112023 Archived-At: --001a1143f394bbd317052a4ad04c Content-Type: text/plain; charset=UTF-8 > > > * Why a separate source file? Is there any technical reasons why this > > couldn't reside in, say, nsterm.m? > > No, I just wasn't sure what the deal was with including files like that > in emacs.c since there's quite a lot in it. If that's an acceptable way > to do it then I'd be happy to do so. > Ah, I see. Including "nsterm.h" from "emacs.c" sounds like a bad idea, as it would increase the rebuild times. In this case, introducing a new source file seems like the right choice. > > * Can you add a "NSTRACE" line to the function, so that it's clear > > when this function is called, when NSTRACE is enabled. > > I don't know what that means, but I'll look into it. > It's a simple printf-based macro that prints a call stack of all NS-related function calls. The resulting log looks like: nsterm.m : 1399: [ 70] x_make_frame_visible nsterm.m : 6569: [ 71] | [EmacsView windowDidBecomeKey] nsterm.m : 1360: [ 72] | | ns_frame_rehighlight nsterm.m : 2048: [ 73] | | | x_set_frame_alpha nsterm.m : 7775: [ 74] | [EmacsWindow constrainFrameRect:(X:0 Y:684)/(W:595 H:516) toScreen:] nsterm.m : 7123: [ 75] | | [EmacsView isFullscreen] ->> 0 Simply include "nsterm.h" and add the following line: NSTRACE ("init_environment"); You can enable tracing by uncommenting the line defining NSTRACE_ENABLED in nsterm.h. > * Have you considered populating `process-environment' instead of > > setting LANG in the Emacs process? Would there be any > > advantages/disadvantages with this approach? > > The problem is that Emacs itself doesn't know what the correct locale is > and therefore sets various encodings and things to "nil". As far as I > can tell process-environment is only for sub-processes, which doesn't > solve this particular problem. > OK, then setting "LANG" in the Emacs process is the correct way to do it. Thanks for finding and fixing this! -- Anders --001a1143f394bbd317052a4ad04c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
> * Why a separate source file? Is there a= ny technical reasons why this
> couldn't reside in, say, nsterm.m?

No, I just wasn't sure what the deal was with including files li= ke that
in emacs.c since there's quite a lot in it. If that's an acceptable= way
to do it then I'd be happy to do so.

Ah, I see. Including "nsterm.h" from "emacs.c" sounds= like a bad idea, as it would increase the rebuild times. In this case, int= roducing a new source file seems like the right choice.

=C2=A0
> * Can you add a &q= uot;NSTRACE" line to the function, so that it's clear
> when this function is called, when NSTRACE is enabled.

I don't know what that means, but I'll look into it.

It's a simple printf-based macro that prin= ts a call stack of all NS-related function calls. The resulting log looks l= ike:

nsterm.m =C2=A0: 1399: [ =C2=A0 70] =C2=A0x_make_frame_visible
nsterm.m =C2=A0: 6569:= [ =C2=A0 71] =C2=A0| [EmacsView windowDidBecomeKey]
nsterm.m =C2=A0: 1360: [ =C2=A0 72] =C2=A0| = | ns_frame_rehighlight
nsterm.m =C2=A0: 2048: [ =C2=A0 73] =C2=A0| | | x_set_frame_alpha
nsterm.m =C2=A0: 7775: [ =C2= =A0 74] =C2=A0| [EmacsWindow constrainFrameRect:(X:0 Y:684)/(W:595 H:516) t= oScreen:]
nsterm.m =C2= =A0: 7123: [ =C2=A0 75] =C2=A0| | [EmacsView isFullscreen] ->> 0

Simply include "nsterm.h" and a= dd the following line:

=C2=A0 =C2=A0 =C2=A0 NSTRAC= E ("init_environment");

You can enable t= racing by uncommenting the line defining NSTRACE_ENABLED in nsterm.h.
=


> * Have you considered populating `process-environment' instead of<= br> > setting LANG in the Emacs process? Would there be any
> advantages/disadvantages with this approach?

The problem is that Emacs itself doesn't know what the correct l= ocale is
and therefore sets various encodings and things to "nil". As far = as I
can tell process-environment is only for sub-processes, which doesn't solve this particular problem.

OK, then= setting "LANG" in the Emacs process is the correct way to do it.=



Thanks for finding = and fixing this!

=C2=A0 =C2=A0 -- Anders

--001a1143f394bbd317052a4ad04c--