unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
       [not found] <E1VQKV4-0004YL-Qw@vcs.savannah.gnu.org>
@ 2013-09-30 18:36 ` Stefan Monnier
  2013-09-30 19:17   ` Jan Djärv
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-09-30 18:36 UTC (permalink / raw)
  To: Jan D.; +Cc: emacs-devel

> --- a/lisp/term/ns-win.el	2013-09-18 04:36:34 +0000
> +++ b/lisp/term/ns-win.el	2013-09-29 17:09:39 +0000
> @@ -912,6 +912,13 @@
>    ;; FIXME: This will surely lead to "MODIFIED OUTSIDE CUSTOM" warnings.
>    (menu-bar-mode (if (get-lisp-resource nil "Menus") 1 -1))
 
> +  ;; For NS nothing except UTF-8 makes sense.
> +  (add-hook 'before-init-hook
> +            #'(lambda ()
> +                (setq locale-coding-system 'utf-8-unix)
> +                (setq default-process-coding-system
> +                      '(utf-8-unix . utf-8-unix))))
> +
>    ;; OS X Lion introduces PressAndHold, which is unsupported by this port.
>    ;; See this thread for more details:
>    ;; http://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00505.html

Does this apply to any Darwin build and only to Darwin builds?
What about tty-only Darwin builds?  And what about GNUstep builds?


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-09-30 18:36 ` [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system Stefan Monnier
@ 2013-09-30 19:17   ` Jan Djärv
  2013-09-30 22:38     ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Djärv @ 2013-09-30 19:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

Hello. 

30 sep 2013 kl. 20:36 skrev Stefan Monnier <monnier@IRO.UMontreal.CA>:

> 
> Does this apply to any Darwin build and only to Darwin builds?

No. 

> What about tty-only Darwin builds?

What about them?  They can't be started from the Dock. 

> And what about GNUstep builds?

Applies to them. 

   Jan D. 



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-09-30 19:17   ` Jan Djärv
@ 2013-09-30 22:38     ` Stefan Monnier
  2013-10-01 18:28       ` Jan Djärv
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-09-30 22:38 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel@gnu.org

>> What about tty-only Darwin builds?
> What about them?  They can't be started from the Dock. 

But they should also use utf-8 for locale-coding-system and friends,
regardless of LANG settings, IIUC.

>> And what about GNUstep builds?
> Applies to them.

But should it?

IIUC this "utf-8 everywhere" is a property of the OS (Darwin) not of the
GUI/toolkit.  So it should apply to tty-only uses under Darwin and it
should not apply to GNUstep.


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-09-30 22:38     ` Stefan Monnier
@ 2013-10-01 18:28       ` Jan Djärv
  2013-10-02  0:43         ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Djärv @ 2013-10-01 18:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

Hello.

1 okt 2013 kl. 00:38 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

>>> What about tty-only Darwin builds?
>> What about them?  They can't be started from the Dock. 
> 
> But they should also use utf-8 for locale-coding-system and friends,
> regardless of LANG settings, IIUC.

No they should not IMHO.  As they must be started from a teminal, LANG is either correct or set to another value for some purpose.

> 
>>> And what about GNUstep builds?
>> Applies to them.
> 
> But should it?
> 
> IIUC this "utf-8 everywhere" is a property of the OS (Darwin) not of the
> GUI/toolkit.  So it should apply to tty-only uses under Darwin and it
> should not apply to GNUstep.
> 

Makes sense, fixed in trunk.

	Jan D.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-01 18:28       ` Jan Djärv
@ 2013-10-02  0:43         ` Stefan Monnier
  2013-10-02  3:12           ` Stephen J. Turnbull
  2013-10-02  6:29           ` Jan Djärv
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2013-10-02  0:43 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel@gnu.org

> No they should not IMHO.  As they must be started from a teminal, LANG is
> either correct or set to another value for some purpose.

IIUC the encoding used under Darwin for filenames is always utf-8.
More to the point it uses NFD canonicalization, performed by the OS when
needed; so pretending these are "byte sequences" that can use any
encoding you feel like, as is the case in POSIX, is not an option.

I guess it's OK to obey the user who wants to shot himself in the foot.
But I do wonder: is LANG really always set in a terminal?  IF so, why
and by whom?  Will LANG also be set properly if you use some other
terminal than Terminal.app (e.g. let's say you run `emacs -nw' inside
an Emacs.app started from the GUI)?

>> IIUC this "utf-8 everywhere" is a property of the OS (Darwin) not of the
>> GUI/toolkit.  So it should apply to tty-only uses under Darwin and it
>> should not apply to GNUstep.
> Makes sense, fixed in trunk.

Thanks,


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-02  0:43         ` Stefan Monnier
@ 2013-10-02  3:12           ` Stephen J. Turnbull
  2013-10-03  1:51             ` Stefan Monnier
  2013-10-02  6:29           ` Jan Djärv
  1 sibling, 1 reply; 13+ messages in thread
From: Stephen J. Turnbull @ 2013-10-02  3:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Jan Djärv, emacs-devel@gnu.org

Stefan Monnier writes:

 > IIUC the encoding used under Darwin for filenames is always utf-8.

In practice, yes, in theory, no.  *Darwin* is just a BSD *nix kernel
(more precisely, FreeBSD kernel functions wrapped around a Mach
microkernel), and at that level, they're just byte sequences.  Mac OS
X defaults to a file system which enforces UTF-8, that's all.  But
consider NFS mounts (whatever the remote system wants) and removable
media (most often VFAT with some bogus Microsoft encoding).

 > More to the point it uses NFD canonicalization, performed by the OS
 > when needed;

Sort of true, for values of "when needed" == "when the actual
filesystem is HFS+".




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-02  0:43         ` Stefan Monnier
  2013-10-02  3:12           ` Stephen J. Turnbull
@ 2013-10-02  6:29           ` Jan Djärv
  2013-10-03  1:53             ` Stefan Monnier
  1 sibling, 1 reply; 13+ messages in thread
From: Jan Djärv @ 2013-10-02  6:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

Hello.

2 okt 2013 kl. 02:43 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

>> No they should not IMHO.  As they must be started from a teminal, LANG is
>> either correct or set to another value for some purpose.
> 
> IIUC the encoding used under Darwin for filenames is always utf-8.
> More to the point it uses NFD canonicalization, performed by the OS when
> needed; so pretending these are "byte sequences" that can use any
> encoding you feel like, as is the case in POSIX, is not an option.

As pointed out, how about remote mounts?  I don't know.

> 
> I guess it's OK to obey the user who wants to shot himself in the foot.
> But I do wonder: is LANG really always set in a terminal?  IF so, why
> and by whom?  Will LANG also be set properly if you use some other
> terminal than Terminal.app (e.g. let's say you run `emacs -nw' inside
> an Emacs.app started from the GUI)?

It is Terminal.app that sets it based on system settings for language.
For other emulators, I don't know.  I don't know of any other emulators BTW.
For emacs -nw inside emacs started from GUI, LANG will not be set.

But that goes for many X11 setups as well. If LANG is set in /etc/profile or ~/.profile, it won't be set if you start Emacs from a panel and the parent session manager has not LANG set.


	Jan D.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-02  3:12           ` Stephen J. Turnbull
@ 2013-10-03  1:51             ` Stefan Monnier
  2013-10-03  7:48               ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-10-03  1:51 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Jan Djärv, emacs-devel@gnu.org

>> IIUC the encoding used under Darwin for filenames is always utf-8.
> In practice, yes, in theory, no.  *Darwin* is just a BSD *nix kernel
> (more precisely, FreeBSD kernel functions wrapped around a Mach
> microkernel), and at that level, they're just byte sequences.  Mac OS
> X defaults to a file system which enforces UTF-8, that's all.  But
> consider NFS mounts (whatever the remote system wants) and removable
> media (most often VFAT with some bogus Microsoft encoding).

Good to know, thanks.  I had the impression that the utf-8 coding was
imposed at the API level rather than the filesystem level.


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-02  6:29           ` Jan Djärv
@ 2013-10-03  1:53             ` Stefan Monnier
  2013-10-03 17:18               ` Jan Djärv
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-10-03  1:53 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel@gnu.org

> But that goes for many X11 setups as well. If LANG is set in /etc/profile or
> ~/.profile, it won't be set if you start Emacs from a panel and the parent
> session manager has not LANG set.

So maybe the better solution is to default to utf-8 if/when LANG is not set,
rather than try to distinguish the GUI-vs-tty case.


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-03  1:51             ` Stefan Monnier
@ 2013-10-03  7:48               ` Andreas Schwab
  2013-10-03  9:42                 ` Stephen J. Turnbull
  2013-10-03 14:39                 ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Andreas Schwab @ 2013-10-03  7:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Stephen J. Turnbull, Jan Djärv, emacs-devel@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Good to know, thanks.  I had the impression that the utf-8 coding was
> imposed at the API level rather than the filesystem level.

The HFS+ filesystem actually uses UTF-16.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-03  7:48               ` Andreas Schwab
@ 2013-10-03  9:42                 ` Stephen J. Turnbull
  2013-10-03 14:39                 ` Stefan Monnier
  1 sibling, 0 replies; 13+ messages in thread
From: Stephen J. Turnbull @ 2013-10-03  9:42 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Jan Djärv, Stefan Monnier, emacs-devel@gnu.org

Andreas Schwab writes:
 > Stefan Monnier <monnier@iro.umontreal.ca> writes:
 > 
 > > Good to know, thanks.  I had the impression that the utf-8 coding was
 > > imposed at the API level rather than the filesystem level.
 > 
 > The HFS+ filesystem actually uses UTF-16.

Sure, but the kernel VFS functions expect Unicode in UTF-8 format, and
output NFD.  I think that's what's relevant here, rather than what
happens inside the HFS+ drivers and on the hardware.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-03  7:48               ` Andreas Schwab
  2013-10-03  9:42                 ` Stephen J. Turnbull
@ 2013-10-03 14:39                 ` Stefan Monnier
  1 sibling, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2013-10-03 14:39 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Stephen J. Turnbull, Jan Djärv, emacs-devel@gnu.org

>> Good to know, thanks.  I had the impression that the utf-8 coding was
>> imposed at the API level rather than the filesystem level.
> The HFS+ filesystem actually uses UTF-16.

So, IIUC this UTF-16 is only used "on disk" but is converted to UTF-8 in
the hfsplus driver so the rest of the kernel sees UTF-8 coming from
HFS+ partitions.


        Stefan




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system
  2013-10-03  1:53             ` Stefan Monnier
@ 2013-10-03 17:18               ` Jan Djärv
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Djärv @ 2013-10-03 17:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

Hi.

3 okt 2013 kl. 03:53 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

>> But that goes for many X11 setups as well. If LANG is set in /etc/profile or
>> ~/.profile, it won't be set if you start Emacs from a panel and the parent
>> session manager has not LANG set.
> 
> So maybe the better solution is to default to utf-8 if/when LANG is not set,
> rather than try to distinguish the GUI-vs-tty case.
> 

... and LC_ALL and LC_CTYPE.  I think it is too much effort for practcally no benefit.

	Jan D.




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-10-03 17:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1VQKV4-0004YL-Qw@vcs.savannah.gnu.org>
2013-09-30 18:36 ` [Emacs-diffs] trunk r114483: * term/ns-win.el (ns-initialize-window-system): Set locale-coding-system Stefan Monnier
2013-09-30 19:17   ` Jan Djärv
2013-09-30 22:38     ` Stefan Monnier
2013-10-01 18:28       ` Jan Djärv
2013-10-02  0:43         ` Stefan Monnier
2013-10-02  3:12           ` Stephen J. Turnbull
2013-10-03  1:51             ` Stefan Monnier
2013-10-03  7:48               ` Andreas Schwab
2013-10-03  9:42                 ` Stephen J. Turnbull
2013-10-03 14:39                 ` Stefan Monnier
2013-10-02  6:29           ` Jan Djärv
2013-10-03  1:53             ` Stefan Monnier
2013-10-03 17:18               ` Jan Djärv

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).