Subject: bug#15260: cannot build in a directory with non-ascii characters

From: Eli Zaretskii <[email-masked]>
Date: Sun, 27 Oct 2013 21:02:51 +0200

The first few problems that pop up when building from the source tree
whose parent has a non-ASCII name are solved by the changes below.

I'm not very fond of these changes, especially the last one: it all
looks very fragile and ad-hoc, and that's still on a system with a
UTF-8 locale, where things should be relatively easy.

After applying these changes, temacs comes up and dumps itself, but
fails to find simple.el and bytecomp.el when it proceeds to compiling
Lisp files.  I guess now load-path is the culprit.

Stay tuned.

=== modified file 'lisp/loadup.el'
--- lisp/loadup.el      2013-10-08 15:11:29 +0000
+++ lisp/loadup.el      2013-10-27 18:26:12 +0000
@@ -150,7 +150,9 @@
 (load "epa-hook")
 ;; Any Emacs Lisp source file (*.el) loaded here after can contain
 ;; multilingual text.
-(load "international/mule-cmds")
+(let ((dfn-coding default-file-name-coding-system))
+  (load "international/mule-cmds")
+  (setq default-file-name-coding-system dfn-coding))
 (load "case-table")
 ;; This file doesn't exist when building a development version of Emacs
 ;; from the repository.  It is generated just after temacs is built.
@@ -163,7 +165,9 @@
 (load "language/cyrillic")
 (load "language/indian")
 (load "language/sinhala")
-(load "language/english")
+(let ((dfn-coding default-file-name-coding-system))
+  (load "language/english")
+  (setq default-file-name-coding-system dfn-coding))
 (load "language/ethiopic")
 (load "language/european")
 (load "language/czech")

=== modified file 'src/emacs.c'
--- src/emacs.c 2013-10-26 13:43:58 +0000
+++ src/emacs.c 2013-10-27 18:48:51 +0000
@@ -2044,14 +2044,22 @@ You must run Emacs in batch mode in orde

   CHECK_STRING (filename);
   filename = Fexpand_file_name (filename, Qnil);
-  filename = ENCODE_FILE (filename);
+  if (NILP (Vfile_name_coding_system)
+      && NILP (Vdefault_file_name_coding_system))
+    filename = Fstring_to_unibyte (filename);
+  else
+    filename = ENCODE_FILE (filename);
   if (!NILP (symfile))
     {
       CHECK_STRING (symfile);
       if (SCHARS (symfile))
        {
          symfile = Fexpand_file_name (symfile, Qnil);
-         symfile = ENCODE_FILE (symfile);
+         if (NILP (Vfile_name_coding_system)
+             && NILP (Vdefault_file_name_coding_system))
+           symfile = Fstring_to_unibyte (symfile);
+         else
+           symfile = ENCODE_FILE (symfile);
        }
     }