comparison lisp/startup.el @ 26084:804cba424b64

Fix bootstrapping problems. Use the system locale to specify Emacs locale defaults. * international/mule-cmds.el (global-map): Do not use backquote, because that makes a bootstrapping problem if you need to recompile all Lisp files using interpreted code. * international/mule.el (charset-id, charset-bytes, charset-dimension, charset-chars, charset-width, charset-direction, charset-iso-final-char, charset-iso-graphic-plane, charset-reverse-charset, charset-short-name, charset-long-name, charset-description, charset-plist): Likewise. * subr.el (save-match-data): Likewise. * international/mule-cmds.el (set-display-table-and-terminal-coding-system): New function, containing code migrated out of set-language-environment. (set-language-environment, set-locale-environment): Use it. (locale-translation-file-name): Moved here from startup.el. (locale-language-names, locale-preferred-coding-systems): New vars. (locale-name-match, set-locale-environment): New functions. * language/japan-util.el (setup-japanese-environment-internal): Prefer japanese-iso-8bit if the system-type is usg-unix-v. * startup.el (iso-8859-n-locale-regexp): Remove. (locale-translation-file-name): Move to mule-cmds.el. (command-line): Move locale-stuff into set-locale-environment.
author Paul Eggert <eggert@twinsun.com>
date Tue, 19 Oct 1999 07:18:58 +0000
parents 27732f03c976
children 185120634897
comparison
equal deleted inserted replaced
26083:134b57acef68 26084:804cba424b64
294 but inhibiting `site-start.el' requires `--no-site-file', which 294 but inhibiting `site-start.el' requires `--no-site-file', which
295 is less convenient." 295 is less convenient."
296 :type '(choice (const :tag "none" nil) string) 296 :type '(choice (const :tag "none" nil) string)
297 :group 'initialization) 297 :group 'initialization)
298 298
299 (defconst iso-8859-n-locale-regexp "8859[-_]?\\([1-49]\\|1[45]\\)\\>"
300 "Regexp that specifies when to enable an ISO 8859-N character set.
301 We do that if this regexp matches the locale name specified by
302 one of the environment variables LC_ALL, LC_CTYPE, or LANG.
303 The paren group in the regexp should match the specific character
304 set number, N. Currently only Latin-[1234589] are supported.
305 \(Note that Latin-5 is ISO 8859-9, because 8859-[678] are non-Latin
306 alphabets; hence, supported values of N are 1, 2, 3, 4, 9, 14 and 15.\)")
307
308 (defcustom mail-host-address nil 299 (defcustom mail-host-address nil
309 "*Name of this machine, for purposes of naming users." 300 "*Name of this machine, for purposes of naming users."
310 :type '(choice (const nil) string) 301 :type '(choice (const nil) string)
311 :group 'mail) 302 :group 'mail)
312 303
328 Set this to nil if you want to prevent `auto-save-list-file-name' 319 Set this to nil if you want to prevent `auto-save-list-file-name'
329 from being initialized." 320 from being initialized."
330 :type '(choice (const :tag "Don't record a session's auto save list" nil) 321 :type '(choice (const :tag "Don't record a session's auto save list" nil)
331 string) 322 string)
332 :group 'auto-save) 323 :group 'auto-save)
333
334 (defvar locale-translation-file-name
335 (let ((files '("/usr/lib/X11/locale/locale.alias" ; e.g. X11R6.4
336 "/usr/X11R6/lib/X11/locale/locale.alias" ; e.g. RedHat 4.2
337 "/usr/openwin/lib/locale/locale.alias" ; e.g. Solaris 2.6
338 ;;
339 ;; The following name appears after the X-related names above,
340 ;; since the X-related names are what X actually uses.
341 "/usr/share/locale/locale.alias" ; GNU/Linux sans X
342 )))
343 (while (and files (not (file-exists-p (car files))))
344 (setq files (cdr files)))
345 (car files))
346 "*File name for the system's file of locale-name aliases, or nil if none.")
347 324
348 (defvar init-file-debug nil) 325 (defvar init-file-debug nil)
349 326
350 (defvar init-file-had-error nil) 327 (defvar init-file-had-error nil)
351 328
519 (setq version-control nil)) 496 (setq version-control nil))
520 ((or (string= vc "never") 497 ((or (string= vc "never")
521 (string= vc "simple")) 498 (string= vc "simple"))
522 (setq version-control 'never)))) 499 (setq version-control 'never))))
523 500
524 (let ((ctype 501 (set-locale-environment nil)
525 ;; Use the first of these three envvars that has a nonempty value.
526 (or (let ((string (getenv "LC_ALL")))
527 (and (not (equal string "")) string))
528 (let ((string (getenv "LC_CTYPE")))
529 (and (not (equal string "")) string))
530 (let ((string (getenv "LANG")))
531 (and (not (equal string "")) string)))))
532 ;; Translate "swedish" into "sv_SE.ISO-8859-1", and so on,
533 ;; using the translation file that GNU/Linux systems have.
534 (and ctype
535 locale-translation-file-name
536 (not (string-match iso-8859-n-locale-regexp ctype))
537 (with-temp-buffer
538 (insert-file-contents locale-translation-file-name)
539 (if (re-search-forward
540 (concat "^" (regexp-quote ctype) ":?[ \t]+") nil t)
541 (setq ctype (buffer-substring (point) (line-end-position))))))
542 ;; Now see if the locale specifies an ISO 8859 character set.
543 (when (and ctype
544 (string-match iso-8859-n-locale-regexp ctype))
545 (let* ((which (match-string 1 ctype))
546 (latin (cdr (assoc which '(("9" . "5") ("14" . "8")
547 ("15" . "9")))))
548 charset)
549 (if latin (setq which latin))
550 (setq charset (concat "latin-" which))
551 (when (string-match "latin-[1-589]" charset)
552 ;; Set up for this character set.
553 ;; This is now the right way to do it
554 ;; for both unibyte and multibyte modes.
555 (set-language-environment charset)
556 (unless (or noninteractive (eq window-system 'x))
557 ;; Send those codes literally to a non-X terminal.
558 (when default-enable-multibyte-characters
559 ;; If this is nil, we are using single-byte characters,
560 ;; so the terminal coding system is irrelevant.
561 (set-terminal-coding-system
562 (intern (downcase charset)))))
563 (standard-display-european-internal)))))
564 502
565 ;;! This has been commented out; I currently find the behavior when 503 ;;! This has been commented out; I currently find the behavior when
566 ;;! split-window-keep-point is nil disturbing, but if I can get used 504 ;;! split-window-keep-point is nil disturbing, but if I can get used
567 ;;! to it, then it would be better to eliminate the option. 505 ;;! to it, then it would be better to eliminate the option.
568 ;;! ;; Choose a good default value for split-window-keep-point. 506 ;;! ;; Choose a good default value for split-window-keep-point.