]> git.eshelyaron.com Git - sweep.git/commitdiff
FIXED: workaround Emacs incompatibility with certain locales
authorEshel Yaron <me@eshelyaron.com>
Wed, 10 Apr 2024 17:34:53 +0000 (19:34 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 10 Apr 2024 17:34:53 +0000 (19:34 +0200)
The Emacs Elisp reader only works with locales that have "." as their
decimal separator, but Prolog initialization sets up the locale
according to the environment variables.  Therefore we need to reset
the locale after initializing Prolog in case the environment
prescribes a locale with a different decimal separator, such as fr_FR.
See also https://github.com/SWI-Prolog/packages-sweep/issues/1

sweeprolog.el

index d2352a92489d514c52842d4798c268f97dacabda..475ff62fcd637607721de4ce621d04f1ba8ddf7c 100644 (file)
@@ -253,6 +253,11 @@ inserted to the input history in `sweeprolog-top-level-mode' buffers."
          "--no-signals"
          "-g"
          "create_prolog_flag(sweep,true,[access(read_only),type(boolean)])"
+         ;; SWI-Prolog does its own locale initialization, but Emacs's
+         ;; Elisp reader only works with certain values of LC_NUMERIC,
+         ;; so we need to reset it after loading Prolog.  This is
+         ;; basically emulating fixup_locale from src/emacs.c:
+         "-g" "setlocale(numeric, _, 'C')"
          "-O"
          "-l"
          (expand-file-name