From: Kenichi Handa Date: Mon, 8 Nov 2004 00:38:48 +0000 (+0000) Subject: (fontset_pattern_regexp): Cancel my previous change; X-Git-Tag: ttn-vms-21-2-B4~4114 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a653f81218951ad4776bdfe3314c76e10f7fb509;p=emacs.git (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index cd1fa804ca2..b981d8970c1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2004-11-08 Kenichi Handa + + * 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,Ad(Brv * emacs.c (Fdump_emacs): Only output warning on GNU/Linux. diff --git a/src/fontset.c b/src/fontset.c index 6d2840ffd26..f3bdc4c235e 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -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);