changeset 18072:ffd40bd63246

(command-line): Detect Latin-N character sets from envvars, both for multibyte mode and single-byte mode.
author Richard M. Stallman <rms@gnu.org>
date Sat, 31 May 1997 07:30:33 +0000
parents bcdf720abb1a
children 460d5452a852
files lisp/startup.el
diffstat 1 files changed, 25 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/startup.el	Sat May 31 07:16:13 1997 +0000
+++ b/lisp/startup.el	Sat May 31 07:30:33 1997 +0000
@@ -277,10 +277,12 @@
 but inhibiting `site-start.el' requires `--no-site-file', which
 is less convenient.")
 
-(defconst iso-8859-1-locale-regexp "8859[-_]?1"
-  "Regexp that specifies when to enable the ISO 8859-1 character set.
+(defconst iso-8859-n-locale-regexp "8859[-_]?\\([1-5]\\)"
+  "Regexp that specifies when to enable an ISO 8859-N character set.
 We do that if this regexp matches the locale name
-specified by the LC_ALL, LC_CTYPE and LANG environment variables.")
+specified by the LC_ALL, LC_CTYPE and LANG environment variables.
+The paren group in the regexp should match the specific character
+set number, N.")
 
 (defvar mail-host-address nil
   "*Name of this machine, for purposes of naming users.")
@@ -415,20 +417,28 @@
 	       (string= vc "simple"))
 	   (setq version-control 'never))))
 
-  (if (let ((ctype
-	     ;; Use the first of these three envvars that has a nonempty value.
-	     (or (let ((string (getenv "LC_ALL")))
-		   (and (not (equal string "")) string))
-		 (let ((string (getenv "LC_CTYPE")))
-		   (and (not (equal string "")) string))
-		 (let ((string (getenv "LANG")))
-		   (and (not (equal string "")) string)))))
-	(and ctype
-	     (string-match iso-8859-1-locale-regexp ctype)))
-      (progn 
+  (let ((ctype
+	 ;; Use the first of these three envvars that has a nonempty value.
+	 (or (let ((string (getenv "LC_ALL")))
+	       (and (not (equal string "")) string))
+	     (let ((string (getenv "LC_CTYPE")))
+	       (and (not (equal string "")) string))
+	     (let ((string (getenv "LANG")))
+	       (and (not (equal string "")) string))))
+	charset)
+    (when (and ctype
+	       (string-match iso-8859-n-locale-regexp ctype))
+      (setq charset (concat "latin-" (match-string 1 ctype)))
+      (if (default-value 'enable-multibyte-characters)
+	  (if (string-match "latin-[12345]" charset)
+	      (set-language-environment charset))
+	;; These two lines are ok for any Latin-N character set,
+	;; as long as the terminal displays it.
 	(require 'disp-table)
 	(standard-display-european t)
-	(require 'latin-1)))
+	;; Set up syntax for the chosen character set.
+	(if (string-match "latin-[1234]" charset)
+	    (require (intern charset))))))
 
   ;;! This has been commented out; I currently find the behavior when
   ;;! split-window-keep-point is nil disturbing, but if I can get used