(if command-line-processed
(message "Back to top level.")
(setq command-line-processed t)
+
+ ;; 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
+ (save-excursion
+ (dolist (elt (buffer-list))
+ (set-buffer elt)
+ (if default-directory
+ (setq default-directory
+ (decode-coding-string default-directory
+ locale-coding-system 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
+ locale-coding-system 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 locale-coding-system t))))))
+
(let ((dir default-directory))
(with-current-buffer "*Messages*"
(messages-buffer-mode)
(setq process-environment
(delete (concat "PWD=" pwd)
process-environment)))))
+ ;; Now, that other directories were searched, and any charsets we
+ ;; need for encoding them are already loaded, we are ready to
+ ;; decode charset-map-path.
+ (if (listp charset-map-path)
+ (setq charset-map-path
+ (mapcar (lambda (dir)
+ (decode-coding-string
+ dir
+ locale-coding-system t))
+ charset-map-path)))
(setq default-directory (abbreviate-file-name default-directory))
(let ((old-face-font-rescale-alist face-font-rescale-alist))
(unwind-protect
;;! ;; Choose a good default value for split-window-keep-point.
;;! (setq split-window-keep-point (> baud-rate 2400))
- ;; Set the default strings to display in mode line for
- ;; end-of-line formats that aren't native to this platform.
- (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)
-
;; Convert preloaded file names in load-history to absolute.
(let ((simple-file-name
;; Look for simple.el or simple.elc and use their directory
load-history))))
;; Convert the arguments to Emacs internal representation.
- (let ((args (cdr command-line-args)))
+ (let ((args command-line-args))
(while args
(setcar args
(decode-coding-string (car args) locale-coding-system t))
(setq after-init-time (current-time))
(run-hooks 'after-init-hook)
- ;; Decode all default-directory.
- (if (and (default-value 'enable-multibyte-characters) locale-coding-system)
- (save-excursion
- (dolist (elt (buffer-list))
- (set-buffer elt)
- (if default-directory
- (setq default-directory
- (decode-coding-string default-directory
- locale-coding-system t))))
- (setq command-line-default-directory
- (decode-coding-string command-line-default-directory
- locale-coding-system t))))
-
;; If *scratch* exists and init file didn't change its mode, initialize it.
(if (get-buffer "*scratch*")
(with-current-buffer "*scratch*"