]> git.eshelyaron.com Git - emacs.git/commitdiff
(fontset_pattern_regexp): Cancel my previous change;
authorKenichi Handa <handa@m17n.org>
Mon, 8 Nov 2004 00:38:48 +0000 (00:38 +0000)
committerKenichi Handa <handa@m17n.org>
Mon, 8 Nov 2004 00:38:48 +0000 (00:38 +0000)
don't pay attention to '\' before '*'.
(fontset_pattern_regexp): Change the meaning of the second arg.
(Fnew_fontset): Call fs_query_fontset, not Fquery_fontset.
(check_fontset_name): Try NAME as literal at first, and if it
failes, try NAME as pattern.

src/ChangeLog
src/fontset.c

index cd1fa804ca23076640db8f5b2e3159d58b796ab9..b981d8970c1da7efe03c7fde9933bb5a8d70ee7d 100644 (file)
@@ -1,3 +1,12 @@
+2004-11-08  Kenichi Handa  <handa@m17n.org>
+
+       * fontset.c (fontset_pattern_regexp): Cancel my previous change;
+       don't pay attention to '\' before '*'.
+       (fontset_pattern_regexp): Change the meaning of the second arg.
+       (Fnew_fontset): Call fs_query_fontset, not Fquery_fontset.
+       (check_fontset_name): Try NAME as literal at first, and if it
+       failes, try NAME as pattern.
+
 2004-11-07  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * emacs.c (Fdump_emacs): Only output warning on GNU/Linux.
index 6d2840ffd2615edff35820703bf78283cbeea2d5..f3bdc4c235ebfb95e8779067eff73dc9e1121448 100644 (file)
@@ -796,7 +796,7 @@ fontset_pattern_regexp (pattern)
        {
          if (*p0 == '-')
            ndashes++;
-         else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
+         else if (*p0 == '*')
            nstars++;
        }
 
@@ -811,7 +811,7 @@ fontset_pattern_regexp (pattern)
       *p1++ = '^';
       for (p0 = SDATA (pattern); *p0; p0++)
        {
-         if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
+         if (*p0 == '*')
            {
              if (ndashes < 14)
                *p1++ = '.';
@@ -835,29 +835,33 @@ fontset_pattern_regexp (pattern)
 }
 
 /* Return ID of the base fontset named NAME.  If there's no such
-   fontset, return -1.  */
+   fontset, return -1.  NAME_PATTERN specifies how to treat NAME as this:
+     0: pattern containing '*' and '?' as wildcards
+     1: regular expression
+     2: literal fontset name
+*/
 
 int
-fs_query_fontset (name, regexpp)
+fs_query_fontset (name, name_pattern)
      Lisp_Object name;
-     int regexpp;
+     int name_pattern;
 {
   Lisp_Object tem;
   int i;
 
   name = Fdowncase (name);
-  if (!regexpp)
+  if (name_pattern != 1)
     {
       tem = Frassoc (name, Vfontset_alias_alist);
       if (CONSP (tem) && STRINGP (XCAR (tem)))
        name = XCAR (tem);
-      else
+      else if (name_pattern == 0)
        {
          tem = fontset_pattern_regexp (name);
          if (STRINGP (tem))
            {
              name = tem;
-             regexpp = 1;
+             name_pattern = 1;
            }
        }
     }
@@ -872,7 +876,7 @@ fs_query_fontset (name, regexpp)
        continue;
 
       this_name = FONTSET_NAME (fontset);
-      if (regexpp
+      if (name_pattern == 1
          ? fast_string_match (name, this_name) >= 0
          : !strcmp (SDATA (name), SDATA (this_name)))
        return i;
@@ -963,6 +967,7 @@ FONTLIST is an alist of charsets vs corresponding font name patterns.  */)
 {
   Lisp_Object fontset, elements, ascii_font;
   Lisp_Object tem, tail, elt;
+  int id;
 
   (*check_window_system_func) ();
 
@@ -970,10 +975,14 @@ FONTLIST is an alist of charsets vs corresponding font name patterns.  */)
   CHECK_LIST (fontlist);
 
   name = Fdowncase (name);
-  tem = Fquery_fontset (name, Qnil);
-  if (!NILP (tem))
-    error ("Fontset `%s' matches the existing fontset `%s'",
-          SDATA (name), SDATA (tem));
+  id = fs_query_fontset (name, 2);
+  if (id >= 0)
+    {
+      fontset = FONTSET_FROM_ID (id);
+      tem = FONTSET_NAME (fontset);
+      error ("Fontset `%s' matches the existing fontset `%s'",
+            SDATA (name),  SDATA (tem));
+    }
 
   /* Check the validity of FONTLIST while creating a template for
      fontset elements.  */
@@ -1048,7 +1057,11 @@ check_fontset_name (name)
     return Vdefault_fontset;
 
   CHECK_STRING (name);
-  id = fs_query_fontset (name, 0);
+  /* First try NAME as literal.  */
+  id = fs_query_fontset (name, 2);
+  if (id < 0)
+    /* For backward compatibility, try again NAME as pattern.  */
+    id = fs_query_fontset (name, 0);
   if (id < 0)
     error ("Fontset `%s' does not exist", SDATA (name));
   return FONTSET_FROM_ID (id);