aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2013-12-09 19:33:01 +0200
committerEli Zaretskii2013-12-09 19:33:01 +0200
commita59f6567d06303117b5befc76988b4ace798ed8f (patch)
tree954471f69caf1882bfaba3697de3771224fd1209
parentcc24ef09f8c050808f9f4989e49122b206e8c934 (diff)
downloademacs-a59f6567d06303117b5befc76988b4ace798ed8f.tar.gz
emacs-a59f6567d06303117b5befc76988b4ace798ed8f.zip
Fix decoding of paths at startup.
-rw-r--r--lisp/startup.el89
1 files changed, 46 insertions, 43 deletions
diff --git a/lisp/startup.el b/lisp/startup.el
index a21695fe19a..bbcf5bda2d7 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -533,43 +533,45 @@ It is the default value of the variable `top-level'."
533 ;; for many other file-name variables and directory lists, so it 533 ;; for many other file-name variables and directory lists, so it
534 ;; is important to decode it ASAP. 534 ;; is important to decode it ASAP.
535 (when locale-coding-system 535 (when locale-coding-system
536 (save-excursion 536 (let ((coding (if (eq system-type 'windows-nt)
537 (dolist (elt (buffer-list)) 537 ;; MS-Windows build converts all file names to
538 (set-buffer elt) 538 ;; UTF-8 during startup.
539 (if default-directory 539 'utf-8
540 (setq default-directory 540 locale-coding-system)))
541 (decode-coding-string default-directory 541 (save-excursion
542 locale-coding-system t))))) 542 (dolist (elt (buffer-list))
543 543 (set-buffer elt)
544 ;; Decode all the important variables and directory lists, now 544 (if default-directory
545 ;; that we know the locale's encoding. This is because the 545 (setq default-directory
546 ;; values of these variables are until here unibyte undecoded 546 (decode-coding-string default-directory coding t)))))
547 ;; strings created by build_unibyte_string. data-directory in 547
548 ;; particular is used to construct many other standard directory 548 ;; Decode all the important variables and directory lists, now
549 ;; names, so it must be decoded ASAP. 549 ;; that we know the locale's encoding. This is because the
550 ;; Note that charset-map-path cannot be decoded here, since we 550 ;; values of these variables are until here unibyte undecoded
551 ;; could then be trapped in infinite recursion below, when we 551 ;; strings created by build_unibyte_string. data-directory in
552 ;; load subdirs.el, because encoding a directory name might need 552 ;; particular is used to construct many other standard
553 ;; to load a charset map, which will want to encode 553 ;; directory names, so it must be decoded ASAP. Note that
554 ;; charset-map-path, which will want to load the same charset 554 ;; charset-map-path cannot be decoded here, since we could
555 ;; map... So decoding of charset-map-path is delayed until 555 ;; then be trapped in infinite recursion below, when we load
556 ;; further down below. 556 ;; subdirs.el, because encoding a directory name might need to
557 (dolist (pathsym '(load-path exec-path)) 557 ;; load a charset map, which will want to encode
558 (let ((path (symbol-value pathsym))) 558 ;; charset-map-path, which will want to load the same charset
559 (if (listp path) 559 ;; map... So decoding of charset-map-path is delayed until
560 (set pathsym (mapcar (lambda (dir) 560 ;; further down below.
561 (decode-coding-string 561 (dolist (pathsym '(load-path exec-path))
562 dir 562 (let ((path (symbol-value pathsym)))
563 locale-coding-system t)) 563 (if (listp path)
564 path))))) 564 (set pathsym (mapcar (lambda (dir)
565 (dolist (filesym '(data-directory doc-directory exec-directory 565 (decode-coding-string dir coding t))
566 installation-directory 566 path)))))
567 invocation-directory invocation-name 567 (dolist (filesym '(data-directory doc-directory exec-directory
568 source-directory 568 installation-directory
569 shared-game-score-directory)) 569 invocation-directory invocation-name
570 (let ((file (symbol-value filesym))) 570 source-directory
571 (if (stringp file) 571 shared-game-score-directory))
572 (set filesym (decode-coding-string file locale-coding-system t)))))) 572 (let ((file (symbol-value filesym)))
573 (if (stringp file)
574 (set filesym (decode-coding-string file coding t)))))))
573 575
574 (let ((dir default-directory)) 576 (let ((dir default-directory))
575 (with-current-buffer "*Messages*" 577 (with-current-buffer "*Messages*"
@@ -599,12 +601,13 @@ It is the default value of the variable `top-level'."
599 ;; need for encoding them are already loaded, we are ready to 601 ;; need for encoding them are already loaded, we are ready to
600 ;; decode charset-map-path. 602 ;; decode charset-map-path.
601 (if (listp charset-map-path) 603 (if (listp charset-map-path)
602 (setq charset-map-path 604 (let ((coding (if (eq system-type 'windows-nt)
603 (mapcar (lambda (dir) 605 'utf-8
604 (decode-coding-string 606 locale-coding-system)))
605 dir 607 (setq charset-map-path
606 locale-coding-system t)) 608 (mapcar (lambda (dir)
607 charset-map-path))) 609 (decode-coding-string dir coding t))
610 charset-map-path))))
608 (setq default-directory (abbreviate-file-name default-directory)) 611 (setq default-directory (abbreviate-file-name default-directory))
609 (let ((old-face-font-rescale-alist face-font-rescale-alist)) 612 (let ((old-face-font-rescale-alist face-font-rescale-alist))
610 (unwind-protect 613 (unwind-protect