4 From: Bram Moolenaar <Bram@moolenaar.net>
8 Problem: Syntax files for Vim 6.0 can't be used with 5.x.
9 Solution: Add the "default" argument to the ":highlight" command: Ignore the
10 command if highlighting was already specified.
14 *** ../vim-5.7.14/src/syntax.c Mon May 22 09:42:51 2000
15 --- src/syntax.c Wed Nov 8 19:33:11 2000
19 static int highlight_list_arg __ARGS((int id, int didh, int type, int iarg, char_u *sarg, char *name));
20 static int syn_add_group __ARGS((char_u *name));
21 static int syn_list_header __ARGS((int did_header, int outlen, int id));
22 + static int hl_has_settings __ARGS((int idx, int check_link));
23 static void highlight_clear __ARGS((int idx));
32 + int dodefault = FALSE;
39 name_end = skiptowhite(line);
40 linep = skipwhite(name_end);
43 + * Check for "default" argument.
45 + if (STRNCMP(line, "default", name_end - line) == 0)
49 + name_end = skiptowhite(line);
50 + linep = skipwhite(name_end);
53 if (STRNCMP(line, "clear", name_end - line) == 0)
55 if (STRNCMP(line, "link", name_end - line) == 0)
58 * for the group, unless '!' is used
60 if (to_id > 0 && !forceit && !init
61 ! && (HL_TABLE()[from_id - 1].sg_term_attr != 0
62 ! || HL_TABLE()[from_id - 1].sg_cterm_attr != 0
64 ! || HL_TABLE()[from_id - 1].sg_gui_attr != 0
68 ! if (sourcing_name == NULL)
69 EMSG("group has settings, highlight link ignored");
73 * for the group, unless '!' is used
75 if (to_id > 0 && !forceit && !init
76 ! && hl_has_settings(from_id - 1, dodefault))
78 ! if (sourcing_name == NULL && !dodefault)
79 EMSG("group has settings, highlight link ignored");
85 if (id == 0) /* failed (out of memory) */
87 idx = id - 1; /* index is ID minus one */
89 + /* Return if "default" was used and the group already has settings. */
90 + if (dodefault && hl_has_settings(idx, TRUE))
93 if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0)
94 is_normal_group = TRUE;
99 /* Only call highlight_changed() once, after sourcing a syntax file */
100 need_highlight_changed = TRUE;
104 + * Return TRUE if highlight group "idx" has any settings.
105 + * When "check_link" is TRUE also check for an existing link.
108 + hl_has_settings(idx, check_link)
112 + return ( HL_TABLE()[idx].sg_term_attr != 0
113 + || HL_TABLE()[idx].sg_cterm_attr != 0
115 + || HL_TABLE()[idx].sg_gui_attr != 0
117 + || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK)));
122 * Clear highlighting for one group.
123 *** ../vim-5.7.14/src/version.c Wed Nov 1 09:55:17 2000
124 --- src/version.c Wed Nov 8 19:33:20 2000
128 { /* Add new patch number below this line */
134 Time is money. Especially if you make clocks.
136 /// Bram Moolenaar Bram@moolenaar.net http://www.moolenaar.net \\\
137 \\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///