+
+ ;; Set the default strings to display in mode line for end-of-line
+ ;; formats that aren't native to this platform. This should be
+ ;; done before calling set-locale-environment, as the latter might
+ ;; use these mnemonics.
+ (cond
+ ((memq system-type '(ms-dos windows-nt))
+ (setq eol-mnemonic-unix "(Unix)"
+ eol-mnemonic-mac "(Mac)"))
+ (t ; this is for Unix/GNU/Linux systems
+ (setq eol-mnemonic-dos "(DOS)"
+ eol-mnemonic-mac "(Mac)")))
+
+ (set-locale-environment nil)
+ ;; Decode all default-directory's (probably, only *scratch* exists
+ ;; at this point). default-directory of *scratch* is the basis
+ ;; for many other file-name variables and directory lists, so it
+ ;; is important to decode it ASAP.
+ (when locale-coding-system
+ (let ((coding (if (eq system-type 'windows-nt)
+ ;; MS-Windows build converts all file names to
+ ;; UTF-8 during startup.
+ 'utf-8
+ locale-coding-system)))
+ (save-excursion
+ (dolist (elt (buffer-list))
+ (set-buffer elt)
+ (if default-directory
+ (setq default-directory
+ (decode-coding-string default-directory coding t)))))
+
+ ;; Decode all the important variables and directory lists, now
+ ;; that we know the locale's encoding. This is because the
+ ;; values of these variables are until here unibyte undecoded
+ ;; strings created by build_unibyte_string. data-directory in
+ ;; particular is used to construct many other standard
+ ;; directory names, so it must be decoded ASAP. Note that
+ ;; charset-map-path cannot be decoded here, since we could
+ ;; then be trapped in infinite recursion below, when we load
+ ;; subdirs.el, because encoding a directory name might need to
+ ;; load a charset map, which will want to encode
+ ;; charset-map-path, which will want to load the same charset
+ ;; map... So decoding of charset-map-path is delayed until
+ ;; further down below.
+ (dolist (pathsym '(load-path exec-path))
+ (let ((path (symbol-value pathsym)))
+ (if (listp path)
+ (set pathsym (mapcar (lambda (dir)
+ (decode-coding-string dir coding t))
+ path)))))
+ (dolist (filesym '(data-directory doc-directory exec-directory
+ installation-directory
+ invocation-directory invocation-name
+ source-directory
+ shared-game-score-directory))
+ (let ((file (symbol-value filesym)))
+ (if (stringp file)
+ (set filesym (decode-coding-string file coding t)))))))
+
+ (let ((dir default-directory))
+ (with-current-buffer "*Messages*"
+ (messages-buffer-mode)
+ ;; Make it easy to do like "tail -f".
+ (set (make-local-variable 'window-point-insertion-type) t)
+ ;; Give *Messages* the same default-directory as *scratch*,
+ ;; just to keep things predictable.
+ (setq default-directory dir)))
+ ;; `user-full-name' is now known; reset its standard-value here.
+ (put 'user-full-name 'standard-value
+ (list (default-value 'user-full-name)))