*** empty log message ***
[m17n/m17n-lib.git] / src / input.c
index b4561ec..3175ce0 100644 (file)
@@ -1070,34 +1070,48 @@ load_branch (MInputMethodInfo *im_info, MPlist *plist, MIMMap *map)
       if (branch_actions)
        M17N_OBJECT_REF (branch_actions);
     }
-  else if (im_info->maps
-          && (plist = (MPlist *) mplist_get (im_info->maps, map_name)))
+  else if (im_info->maps) 
     {
-      MPLIST_DO (plist, plist)
+      plist = (MPlist *) mplist_get (im_info->maps, map_name);
+      if (! plist)
        {
-         MPlist *keylist, *map_actions;
+         MPlist *p = mplist__assq (im_info->configured_vars, map_name);
 
-         if (! MPLIST_PLIST_P (plist))
-           MERROR (MERROR_IM, -1);
-         keylist = MPLIST_PLIST (plist);
-         map_actions = MPLIST_NEXT (keylist);
-         if (MPLIST_SYMBOL_P (keylist))
+         if (p && MPLIST_PLIST_P (p))
+           {
+             p = MPLIST_NEXT (MPLIST_NEXT (MPLIST_NEXT (MPLIST_PLIST (p))));
+             if (MPLIST_SYMBOL_P (p))
+               plist = mplist_get (im_info->maps, MPLIST_SYMBOL (p));
+           }
+       }
+      if (plist)
+       {
+         MPLIST_DO (plist, plist)
            {
-             MSymbol command = MPLIST_SYMBOL (keylist);
-             MPlist *pl;
+             MPlist *keylist, *map_actions;
 
-             if (MFAILP (command != Mat_reload))
-               continue;
-             pl = resolve_command (im_info->configured_cmds, command);
-             if (MFAILP (pl))
-               continue;
-             MPLIST_DO (pl, pl)
-               load_translation (map, pl, map_actions, branch_actions,
+             if (! MPLIST_PLIST_P (plist))
+               MERROR (MERROR_IM, -1);
+             keylist = MPLIST_PLIST (plist);
+             map_actions = MPLIST_NEXT (keylist);
+             if (MPLIST_SYMBOL_P (keylist))
+               {
+                 MSymbol command = MPLIST_SYMBOL (keylist);
+                 MPlist *pl;
+
+                 if (MFAILP (command != Mat_reload))
+                   continue;
+                 pl = resolve_command (im_info->configured_cmds, command);
+                 if (MFAILP (pl))
+                   continue;
+                 MPLIST_DO (pl, pl)
+                   load_translation (map, pl, map_actions, branch_actions,
+                                     im_info->macros);
+               }
+             else
+               load_translation (map, keylist, map_actions, branch_actions,
                                  im_info->macros);
            }
-         else
-           load_translation (map, keylist, map_actions, branch_actions,
-                             im_info->macros);
        }
     }
 
@@ -1640,7 +1654,7 @@ check_description (MPlist *plist)
          {
            M17N_OBJECT_UNREF (mt);
            mt = mtext__from_data (translated, strlen (translated),
-                                  MTEXT_FORMAT_UTF_8, 0);
+                                  MTEXT_FORMAT_UTF_8, 1);
          }
       }
 #endif
@@ -1742,14 +1756,13 @@ config_command (MPlist *plist, MPlist *global_cmds, MPlist *custom_cmds,
                MPlist *config_cmds)
 {
   MPlist *global = NULL, *custom = NULL, *config = NULL;
-  MSymbol name;
+  MSymbol name = MPLIST_SYMBOL (plist);
   MSymbol status;
   MPlist *description, *keyseq;
 
   if (global_cmds && (global = mplist__assq (global_cmds, name)))
     global = MPLIST_NEXT (MPLIST_PLIST (global));  
 
-  name = MPLIST_SYMBOL (plist);
   plist = MPLIST_NEXT (plist);
   if (MPLIST_MTEXT_P (plist) || MPLIST_PLIST_P (plist))
     {
@@ -3796,8 +3809,6 @@ filter (MInputContext *ic, MSymbol key, void *arg)
 
   if (mtext_nchars (ic->produced) > 0)
     {
-      MSymbol lang = msymbol_get (ic->im->language, Mlanguage);
-
       if (mdebug__flag & mdebug_mask)
        {
          MDEBUG_PRINT (" (produced");
@@ -3806,9 +3817,8 @@ filter (MInputContext *ic, MSymbol key, void *arg)
          MDEBUG_PRINT (")");
        }
 
-      if (lang != Mnil)
-       mtext_put_prop (ic->produced, 0, mtext_nchars (ic->produced),
-                       Mlanguage, ic->im->language);
+      mtext_put_prop (ic->produced, 0, mtext_nchars (ic->produced),
+                     Mlanguage, ic->im->language);
     }
   if (ic_info->commit_key_head > 0)
     {