*** empty log message ***
[bpt/emacs.git] / src / charset.c
index 65e233f..8f044f1 100644 (file)
@@ -63,7 +63,7 @@ Lisp_Object Vcharset_hash_table;
 struct charset *charset_table;
 
 static int charset_table_size;
-int charset_table_used;
+static int charset_table_used;
 
 Lisp_Object Qcharsetp;
 
@@ -110,7 +110,7 @@ struct charset *emacs_mule_charset[256];
    CHARS, and FINAL-CHAR) to Emacs' charset.  */
 int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
 
-Lisp_Object Vcharset_map_directory;
+Lisp_Object Vcharset_map_path;
 
 Lisp_Object Vchar_unified_charset_table;
 
@@ -406,8 +406,7 @@ load_charset_map_from_file (charset, mapfile, control_flag)
   suffixes = Fcons (build_string (".map"),
                    Fcons (build_string (".TXT"), Qnil));
 
-  fd = openp (Fcons (Vcharset_map_directory, Qnil), mapfile, suffixes,
-             NULL, Qnil);
+  fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil);
   if (fd < 0
       || ! (fp = fdopen (fd, "r")))
     {
@@ -583,7 +582,7 @@ map_charset_chars (c_function, function, arg,
 
       range = Fcons (make_number (from_c), make_number (to_c));
       if (NILP (function))
-       (*c_function) (range, arg);
+       (*c_function) (arg, range);
       else
        call2 (function, range, arg);
     }
@@ -598,7 +597,7 @@ map_charset_chars (c_function, function, arg,
            XSETCAR (range, make_number (127));
 
          if (NILP (function))
-           (*c_function) (range, arg);
+           (*c_function) (arg, range);
          else
            call2 (function, range, arg);
        }
@@ -640,7 +639,8 @@ map_charset_chars (c_function, function, arg,
            this_from = CHARSET_MIN_CODE (charset);
          if (this_to > CHARSET_MAX_CODE (charset))
            this_to = CHARSET_MAX_CODE (charset);
-         map_charset_chars (c_function, function, arg, charset, from, to);
+         map_charset_chars (c_function, function, arg, charset,
+                            this_from, this_to);
        }
     }
 }
@@ -1375,7 +1375,6 @@ find_charsets_in_text (ptr, nchars, nbytes, charsets, table, multibyte)
      int multibyte;
 {
   const unsigned char *pend = ptr + nbytes;
-  int ncharsets = ASIZE (charsets);
 
   if (nchars == nbytes)
     {
@@ -1989,6 +1988,7 @@ usage: (set-charset-priority &rest charsets)  */)
      Lisp_Object *args;
 {
   Lisp_Object new_head, old_list, arglist[2];
+  Lisp_Object list_2022, list_emacs_mule;
   int i, id;
 
   old_list = Fcopy_sequence (Vcharset_ordered_list);
@@ -2007,13 +2007,16 @@ usage: (set-charset-priority &rest charsets)  */)
   Vcharset_ordered_list = Fnconc (2, arglist);
   charset_ordered_list_tick++;
 
-  for (old_list = Vcharset_ordered_list, new_head = Qnil;
+  for (old_list = Vcharset_ordered_list, list_2022 = list_emacs_mule = Qnil;
        CONSP (old_list); old_list = XCDR (old_list))
     {
       if (! NILP (Fmemq (XCAR (old_list), Viso_2022_charset_list)))
-       new_head = Fcons (XCAR (old_list), new_head);
+       list_2022 = Fcons (XCAR (old_list), list_2022);
+      if (! NILP (Fmemq (XCAR (old_list), Vemacs_mule_charset_list)))
+       list_emacs_mule = Fcons (XCAR (old_list), list_emacs_mule);
     }
-  Viso_2022_charset_list = Fnreverse (new_head);
+  Viso_2022_charset_list = Fnreverse (list_2022);
+  Vemacs_mule_charset_list = Fnreverse (list_emacs_mule);
 
   return Qnil;
 }
@@ -2035,7 +2038,9 @@ Return charset identification number of CHARSET.  */)
 void
 init_charset ()
 {
-
+  Vcharset_map_path
+    = Fcons (Fexpand_file_name (build_string ("charsets"), Vdata_directory),
+            Qnil);
 }
 
 
@@ -2127,11 +2132,9 @@ syms_of_charset ()
   defsubr (&Sset_charset_priority);
   defsubr (&Scharset_id_internal);
 
-  DEFVAR_LISP ("charset-map-directory", &Vcharset_map_directory,
-              doc: /* Directory of charset map files that come with GNU Emacs.
-The default value is sub-directory "charsets" of `data-directory'.  */);
-  Vcharset_map_directory = Fexpand_file_name (build_string ("charsets"),
-                                             Vdata_directory);
+  DEFVAR_LISP ("charset-map-path", &Vcharset_map_path,
+              doc: /* *Lisp of directories to search for charset map files.  */);
+  Vcharset_map_path = Qnil;
 
   DEFVAR_LISP ("charset-list", &Vcharset_list,
               doc: /* List of all charsets ever defined.  */);