bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12392: emacs-gtk misinterprets floating-point numbers under certain


From: Holger Arnold
Subject: bug#12392: emacs-gtk misinterprets floating-point numbers under certain locales on openSUSE 12.2
Date: Fri, 21 Sep 2012 11:59:55 +0200

2012/9/13 Paul Eggert <eggert@cs.ucla.edu>:
> This particular problem looks like it's probably an OpenSUSE bug, but
> in general one cannot combine LC_NUMERIC=C with random encodings in
> LC_CTYPE.  It's safer if Emacs uses the C locale when parsing floating
> point numbers.

No, it's an Emacs bug, actually two of them:

1. Emacs changes the locale _after_ GTK has been initialized, which,
according to the GTK docs, "may produce inconsistent results and is
not really supported" (see
http://developer.gnome.org/gtk/stable/gtk-General.html#gtk-set-locale).

2. To make the parsing (and printing?) of number literals in Emacs
Lisp locale-dependent is the wrong approach.

What is happening here is that, after Emacs's second call to
fixup_locale() (after initializing GTK), a module implicitly loaded by
GTK (GStreamer in this case, accessed by GTK via libcanberra) calls
setlocale(LC_ALL, "") again.  The GTK docs explicitly say that such
things may happen.

Note that inserting gtk_disable_setlocale() before gtk_init() does not
help because this setting does not transcend to the loaded module.

A quick work-around is to start Emacs with LC_NUMERIC set to "C".

The long-term solution would be to fix Emacs's Lisp parser so that it
does not depend on the current locale.  Hard-setting the locale to "C"
is bad style because it ignores the user's interface preferences.





reply via email to

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