aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2004-11-08 00:38:48 +0000
committerKenichi Handa2004-11-08 00:38:48 +0000
commita653f81218951ad4776bdfe3314c76e10f7fb509 (patch)
tree0fca8e0672f519e53ab3e610421ca1c7d5847b78 /src
parentbd6bda79c3231b44165a0ca865ac532f4cde1f29 (diff)
downloademacs-a653f81218951ad4776bdfe3314c76e10f7fb509.tar.gz
emacs-a653f81218951ad4776bdfe3314c76e10f7fb509.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/fontset.c41
2 files changed, 36 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index cd1fa804ca2..b981d8970c1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12004-11-08 Kenichi Handa <handa@m17n.org>
2
3 * fontset.c (fontset_pattern_regexp): Cancel my previous change;
4 don't pay attention to '\' before '*'.
5 (fontset_pattern_regexp): Change the meaning of the second arg.
6 (Fnew_fontset): Call fs_query_fontset, not Fquery_fontset.
7 (check_fontset_name): Try NAME as literal at first, and if it
8 failes, try NAME as pattern.
9
12004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 102004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 11
3 * emacs.c (Fdump_emacs): Only output warning on GNU/Linux. 12 * 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)
796 { 796 {
797 if (*p0 == '-') 797 if (*p0 == '-')
798 ndashes++; 798 ndashes++;
799 else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 799 else if (*p0 == '*')
800 nstars++; 800 nstars++;
801 } 801 }
802 802
@@ -811,7 +811,7 @@ fontset_pattern_regexp (pattern)
811 *p1++ = '^'; 811 *p1++ = '^';
812 for (p0 = SDATA (pattern); *p0; p0++) 812 for (p0 = SDATA (pattern); *p0; p0++)
813 { 813 {
814 if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') 814 if (*p0 == '*')
815 { 815 {
816 if (ndashes < 14) 816 if (ndashes < 14)
817 *p1++ = '.'; 817 *p1++ = '.';
@@ -835,29 +835,33 @@ fontset_pattern_regexp (pattern)
835} 835}
836 836
837/* Return ID of the base fontset named NAME. If there's no such 837/* Return ID of the base fontset named NAME. If there's no such
838 fontset, return -1. */ 838 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
839 0: pattern containing '*' and '?' as wildcards
840 1: regular expression
841 2: literal fontset name
842*/
839 843
840int 844int
841fs_query_fontset (name, regexpp) 845fs_query_fontset (name, name_pattern)
842 Lisp_Object name; 846 Lisp_Object name;
843 int regexpp; 847 int name_pattern;
844{ 848{
845 Lisp_Object tem; 849 Lisp_Object tem;
846 int i; 850 int i;
847 851
848 name = Fdowncase (name); 852 name = Fdowncase (name);
849 if (!regexpp) 853 if (name_pattern != 1)
850 { 854 {
851 tem = Frassoc (name, Vfontset_alias_alist); 855 tem = Frassoc (name, Vfontset_alias_alist);
852 if (CONSP (tem) && STRINGP (XCAR (tem))) 856 if (CONSP (tem) && STRINGP (XCAR (tem)))
853 name = XCAR (tem); 857 name = XCAR (tem);
854 else 858 else if (name_pattern == 0)
855 { 859 {
856 tem = fontset_pattern_regexp (name); 860 tem = fontset_pattern_regexp (name);
857 if (STRINGP (tem)) 861 if (STRINGP (tem))
858 { 862 {
859 name = tem; 863 name = tem;
860 regexpp = 1; 864 name_pattern = 1;
861 } 865 }
862 } 866 }
863 } 867 }
@@ -872,7 +876,7 @@ fs_query_fontset (name, regexpp)
872 continue; 876 continue;
873 877
874 this_name = FONTSET_NAME (fontset); 878 this_name = FONTSET_NAME (fontset);
875 if (regexpp 879 if (name_pattern == 1
876 ? fast_string_match (name, this_name) >= 0 880 ? fast_string_match (name, this_name) >= 0
877 : !strcmp (SDATA (name), SDATA (this_name))) 881 : !strcmp (SDATA (name), SDATA (this_name)))
878 return i; 882 return i;
@@ -963,6 +967,7 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
963{ 967{
964 Lisp_Object fontset, elements, ascii_font; 968 Lisp_Object fontset, elements, ascii_font;
965 Lisp_Object tem, tail, elt; 969 Lisp_Object tem, tail, elt;
970 int id;
966 971
967 (*check_window_system_func) (); 972 (*check_window_system_func) ();
968 973
@@ -970,10 +975,14 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */)
970 CHECK_LIST (fontlist); 975 CHECK_LIST (fontlist);
971 976
972 name = Fdowncase (name); 977 name = Fdowncase (name);
973 tem = Fquery_fontset (name, Qnil); 978 id = fs_query_fontset (name, 2);
974 if (!NILP (tem)) 979 if (id >= 0)
975 error ("Fontset `%s' matches the existing fontset `%s'", 980 {
976 SDATA (name), SDATA (tem)); 981 fontset = FONTSET_FROM_ID (id);
982 tem = FONTSET_NAME (fontset);
983 error ("Fontset `%s' matches the existing fontset `%s'",
984 SDATA (name), SDATA (tem));
985 }
977 986
978 /* Check the validity of FONTLIST while creating a template for 987 /* Check the validity of FONTLIST while creating a template for
979 fontset elements. */ 988 fontset elements. */
@@ -1048,7 +1057,11 @@ check_fontset_name (name)
1048 return Vdefault_fontset; 1057 return Vdefault_fontset;
1049 1058
1050 CHECK_STRING (name); 1059 CHECK_STRING (name);
1051 id = fs_query_fontset (name, 0); 1060 /* First try NAME as literal. */
1061 id = fs_query_fontset (name, 2);
1062 if (id < 0)
1063 /* For backward compatibility, try again NAME as pattern. */
1064 id = fs_query_fontset (name, 0);
1052 if (id < 0) 1065 if (id < 0)
1053 error ("Fontset `%s' does not exist", SDATA (name)); 1066 error ("Fontset `%s' does not exist", SDATA (name));
1054 return FONTSET_FROM_ID (id); 1067 return FONTSET_FROM_ID (id);