aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2013-11-04 19:30:33 +0200
committerEli Zaretskii2013-11-04 19:30:33 +0200
commitd0065ff1244871c9eb40420b88fc89f9f008b587 (patch)
treea869fa565b559c7b0a9390fd6045d7d827d001ec /lisp
parent7397c58760779a3aa83ff58164455761d77cd642 (diff)
downloademacs-d0065ff1244871c9eb40420b88fc89f9f008b587.tar.gz
emacs-d0065ff1244871c9eb40420b88fc89f9f008b587.zip
Fix bug #15260 with building and installing Emacs in non-ASCII directories.
src/xdisp.c (message3_nolog, message_with_string): Encode the string before writing it to the terminal in a non-interactive session. src/lread.c (openp): If both FILENAME and SUFFIX are unibyte, make sure we concatenate them into a unibyte string. src/fileio.c (make_temp_name): Encode PREFIX, and decode the resulting temporary name before returning it to the caller. (Fexpand_file_name): If NAME is pure-ASCII and DEFAULT_DIRECTORY is a unibyte string, convert NAME to a unibyte string to ensure that the result is also a unibyte string. src/emacs.c (init_cmdargs): Use build_unibyte_string to make sure we create unibyte strings from default paths and directory/file names. src/coding.h (ENCODE_FILE): Do not attempt to encode a unibyte string. src/callproc.c (init_callproc): Use build_unibyte_string to make sure we create unibyte strings from default paths and directory/file names. src/buffer.c (init_buffer): Don't store default-directory of *scratch* in multibyte form. The original problem which led to that is described in http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-11/msg00532.html, but it was solved long ago. lisp/startup.el (normal-top-level): Move setting eol-mnemonic-unix, eol-mnemonic-mac, eol-mnemonic-dos, and also setup of the locale environment and decoding all of the default-directory's to here from command-line. (command-line): Decode also argv[0]. lisp/loadup.el: Error out if default-directory is a multibyte string when we are dumping. lisp/Makefile.in (emacs): Don't set LC_ALL=C. leim/Makefile.in (RUN_EMACS): Don't set LC_ALL=C. configure.ac: Don't disallow builds in non-ASCII directories.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/Makefile.in2
-rw-r--r--lisp/loadup.el14
-rw-r--r--lisp/startup.el94
4 files changed, 96 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4ef439a43c1..965a62668ed 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12013-11-04 Eli Zaretskii <eliz@gnu.org>
2
3 * startup.el (normal-top-level): Move setting eol-mnemonic-unix,
4 eol-mnemonic-mac, eol-mnemonic-dos, and also setup of the locale
5 environment and decoding all of the default-directory's to here
6 from command-line.
7 (command-line): Decode also argv[0].
8
9 * loadup.el: Error out if default-directory is a multibyte string
10 when we are dumping.
11
12 * Makefile.in (emacs): Don't set LC_ALL=C. (Bug#15260)
13
12013-11-04 Teodor Zlatanov <tzz@lifelogs.com> 142013-11-04 Teodor Zlatanov <tzz@lifelogs.com>
2 15
3 * emacs-lisp/package.el (package-menu-mode) 16 * emacs-lisp/package.el (package-menu-mode)
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 7b0206a623d..9733495403c 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -106,7 +106,7 @@ COMPILE_FIRST = \
106 106
107# The actual Emacs command run in the targets below. 107# The actual Emacs command run in the targets below.
108# Prevent any setting of EMACSLOADPATH in user environment causing problems. 108# Prevent any setting of EMACSLOADPATH in user environment causing problems.
109emacs = unset EMACSLOADPATH; LC_ALL=C "$(EMACS)" $(EMACSOPT) 109emacs = unset EMACSLOADPATH; "$(EMACS)" $(EMACSOPT)
110 110
111# Common command to find subdirectories 111# Common command to find subdirectories
112setwins=subdirs=`find . -type d -print`; \ 112setwins=subdirs=`find . -type d -print`; \
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 27148ceea75..98e3b877144 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -286,6 +286,20 @@
286;For other systems, you must edit ../src/Makefile.in. 286;For other systems, you must edit ../src/Makefile.in.
287(load "site-load" t) 287(load "site-load" t)
288 288
289;; Make sure default-directory is unibyte when dumping. This is
290;; because we cannot decode and encode it correctly (since the locale
291;; environment is not, and should not be, set up). default-directory
292;; is used every time we call expand-file-name, which we do in every
293;; file primitive. So the only workable solution to support building
294;; in non-ASCII directories is to manipulate unibyte strings in the
295;; current locale's encoding.
296(if (and (or (equal (nth 3 command-line-args) "dump")
297 (equal (nth 4 command-line-args) "dump")
298 (equal (nth 3 command-line-args) "bootstrap")
299 (equal (nth 4 command-line-args) "bootstrap"))
300 (multibyte-string-p default-directory))
301 (error "default-directory must be unibyte when dumping Emacs!"))
302
289;; Determine which last version number to use 303;; Determine which last version number to use
290;; based on the executables that now exist. 304;; based on the executables that now exist.
291(if (and (or (equal (nth 3 command-line-args) "dump") 305(if (and (or (equal (nth 3 command-line-args) "dump")
diff --git a/lisp/startup.el b/lisp/startup.el
index e93c3fa5826..963ee687a3b 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -489,6 +489,63 @@ It is the default value of the variable `top-level'."
489 (if command-line-processed 489 (if command-line-processed
490 (message "Back to top level.") 490 (message "Back to top level.")
491 (setq command-line-processed t) 491 (setq command-line-processed t)
492
493 ;; Set the default strings to display in mode line for end-of-line
494 ;; formats that aren't native to this platform. This should be
495 ;; done before calling set-locale-environment, as the latter might
496 ;; use these mnemonics.
497 (cond
498 ((memq system-type '(ms-dos windows-nt))
499 (setq eol-mnemonic-unix "(Unix)"
500 eol-mnemonic-mac "(Mac)"))
501 (t ; this is for Unix/GNU/Linux systems
502 (setq eol-mnemonic-dos "(DOS)"
503 eol-mnemonic-mac "(Mac)")))
504
505 (set-locale-environment nil)
506 ;; Decode all default-directory's (probably, only *scratch* exists
507 ;; at this point). default-directory of *scratch* is the basis
508 ;; for many other file-name variables and directory lists, so it
509 ;; is important to decode it ASAP.
510 (when locale-coding-system
511 (save-excursion
512 (dolist (elt (buffer-list))
513 (set-buffer elt)
514 (if default-directory
515 (setq default-directory
516 (decode-coding-string default-directory
517 locale-coding-system t)))))
518
519 ;; Decode all the important variables and directory lists, now
520 ;; that we know the locale's encoding. This is because the
521 ;; values of these variables are until here unibyte undecoded
522 ;; strings created by build_unibyte_string. data-directory in
523 ;; particular is used to construct many other standard directory
524 ;; names, so it must be decoded ASAP.
525 ;; Note that charset-map-path cannot be decoded here, since we
526 ;; could then be trapped in infinite recursion below, when we
527 ;; load subdirs.el, because encoding a directory name might need
528 ;; to load a charset map, which will want to encode
529 ;; charset-map-path, which will want to load the same charset
530 ;; map... So decoding of charset-map-path is delayed until
531 ;; further down below.
532 (dolist (pathsym '(load-path exec-path))
533 (let ((path (symbol-value pathsym)))
534 (if (listp path)
535 (set pathsym (mapcar (lambda (dir)
536 (decode-coding-string
537 dir
538 locale-coding-system t))
539 path)))))
540 (dolist (filesym '(data-directory doc-directory exec-directory
541 installation-directory
542 invocation-directory invocation-name
543 source-directory
544 shared-game-score-directory))
545 (let ((file (symbol-value filesym)))
546 (if (stringp file)
547 (set filesym (decode-coding-string file locale-coding-system t))))))
548
492 (let ((dir default-directory)) 549 (let ((dir default-directory))
493 (with-current-buffer "*Messages*" 550 (with-current-buffer "*Messages*"
494 (messages-buffer-mode) 551 (messages-buffer-mode)
@@ -536,6 +593,16 @@ It is the default value of the variable `top-level'."
536 (setq process-environment 593 (setq process-environment
537 (delete (concat "PWD=" pwd) 594 (delete (concat "PWD=" pwd)
538 process-environment))))) 595 process-environment)))))
596 ;; Now, that other directories were searched, and any charsets we
597 ;; need for encoding them are already loaded, we are ready to
598 ;; decode charset-map-path.
599 (if (listp charset-map-path)
600 (setq charset-map-path
601 (mapcar (lambda (dir)
602 (decode-coding-string
603 dir
604 locale-coding-system t))
605 charset-map-path)))
539 (setq default-directory (abbreviate-file-name default-directory)) 606 (setq default-directory (abbreviate-file-name default-directory))
540 (let ((old-face-font-rescale-alist face-font-rescale-alist)) 607 (let ((old-face-font-rescale-alist face-font-rescale-alist))
541 (unwind-protect 608 (unwind-protect
@@ -756,18 +823,6 @@ Amongst another things, it parses the command-line arguments."
756 ;;! ;; Choose a good default value for split-window-keep-point. 823 ;;! ;; Choose a good default value for split-window-keep-point.
757 ;;! (setq split-window-keep-point (> baud-rate 2400)) 824 ;;! (setq split-window-keep-point (> baud-rate 2400))
758 825
759 ;; Set the default strings to display in mode line for
760 ;; end-of-line formats that aren't native to this platform.
761 (cond
762 ((memq system-type '(ms-dos windows-nt))
763 (setq eol-mnemonic-unix "(Unix)"
764 eol-mnemonic-mac "(Mac)"))
765 (t ; this is for Unix/GNU/Linux systems
766 (setq eol-mnemonic-dos "(DOS)"
767 eol-mnemonic-mac "(Mac)")))
768
769 (set-locale-environment nil)
770
771 ;; Convert preloaded file names in load-history to absolute. 826 ;; Convert preloaded file names in load-history to absolute.
772 (let ((simple-file-name 827 (let ((simple-file-name
773 ;; Look for simple.el or simple.elc and use their directory 828 ;; Look for simple.el or simple.elc and use their directory
@@ -801,7 +856,7 @@ please check its value")
801 load-history)))) 856 load-history))))
802 857
803 ;; Convert the arguments to Emacs internal representation. 858 ;; Convert the arguments to Emacs internal representation.
804 (let ((args (cdr command-line-args))) 859 (let ((args command-line-args))
805 (while args 860 (while args
806 (setcar args 861 (setcar args
807 (decode-coding-string (car args) locale-coding-system t)) 862 (decode-coding-string (car args) locale-coding-system t))
@@ -1211,19 +1266,6 @@ the `--debug-init' option to view a complete error backtrace."
1211 (setq after-init-time (current-time)) 1266 (setq after-init-time (current-time))
1212 (run-hooks 'after-init-hook) 1267 (run-hooks 'after-init-hook)
1213 1268
1214 ;; Decode all default-directory.
1215 (if (and (default-value 'enable-multibyte-characters) locale-coding-system)
1216 (save-excursion
1217 (dolist (elt (buffer-list))
1218 (set-buffer elt)
1219 (if default-directory
1220 (setq default-directory
1221 (decode-coding-string default-directory
1222 locale-coding-system t))))
1223 (setq command-line-default-directory
1224 (decode-coding-string command-line-default-directory
1225 locale-coding-system t))))
1226
1227 ;; If *scratch* exists and init file didn't change its mode, initialize it. 1269 ;; If *scratch* exists and init file didn't change its mode, initialize it.
1228 (if (get-buffer "*scratch*") 1270 (if (get-buffer "*scratch*")
1229 (with-current-buffer "*scratch*" 1271 (with-current-buffer "*scratch*"