1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Local help files are only listed in help.txt, not in translated
13 Solution: Also find translated help files. (Yasuhiro Matsumoto)
17 *** ../vim-7.3.340/src/ex_cmds.c 2011-09-30 17:30:27.000000000 +0200
18 --- src/ex_cmds.c 2011-10-20 17:39:45.000000000 +0200
23 int in_example = FALSE;
34 ! * In the "help.txt" file, add the locally added help files.
35 ! * This uses the very first line in the help file.
37 ! if (fnamecmp(gettail(curbuf->b_fname), "help.txt") == 0)
39 for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
41 line = ml_get_buf(curbuf, lnum, FALSE);
42 ! if (strstr((char *)line, "*local-additions*") != NULL)
44 ! /* Go through all directories in 'runtimepath', skipping
49 ! copy_option_part(&p, NameBuff, MAXPATHL, ",");
51 ! rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
52 ! if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME)
64 ! /* Find all "doc/ *.txt" files in this directory. */
65 ! add_pathsep(NameBuff);
66 ! STRCAT(NameBuff, "doc/*.txt");
67 ! if (gen_expand_wildcards(1, &NameBuff, &fcount,
68 ! &fnames, EW_FILE|EW_SILENT) == OK
71 ! for (fi = 0; fi < fcount; ++fi)
73 ! fd = mch_fopen((char *)fnames[fi], "r");
76 ! vim_fgets(IObuff, IOSIZE, fd);
77 ! if (IObuff[0] == '*'
78 ! && (s = vim_strchr(IObuff + 1, '*'))
82 ! int this_utf = MAYBE;
84 ! /* Change tag definition to a
85 ! * reference and remove <CR>/<NL>. */
90 ! if (*s == '\r' || *s == '\n')
93 ! /* The text is utf-8 when a byte
94 ! * above 127 is found and no
95 ! * illegal byte sequence is found.
97 ! if (*s >= 0x80 && this_utf != FALSE)
102 ! l = utf_ptr2len(s);
111 ! /* The help file is latin1 or utf-8;
112 ! * conversion to the current
113 ! * 'encoding' may be required. */
114 ! vc.vc_type = CONV_NONE;
115 ! convert_setup(&vc, (char_u *)(
116 ! this_utf == TRUE ? "utf-8"
117 ! : "latin1"), p_enc);
118 ! if (vc.vc_type == CONV_NONE)
119 ! /* No conversion needed. */
123 ! /* Do the conversion. If it fails
124 ! * use the unconverted text. */
125 ! cp = string_convert(&vc, IObuff,
130 ! convert_setup(&vc, NULL, NULL);
132 ! ml_append(lnum, cp, (colnr_T)0, FALSE);
136 ! ml_append(lnum, IObuff, (colnr_T)0,
144 - FreeWild(fcount, fnames);
159 ! * In the "help.txt" and "help.abx" file, add the locally added help
160 ! * files. This uses the very first line in the help file.
162 ! fname = gettail(curbuf->b_fname);
163 ! if (fnamecmp(fname, "help.txt") == 0
164 ! #ifdef FEAT_MULTI_LANG
165 ! || (fnamencmp(fname, "help.", 5) == 0
166 ! && ASCII_ISALPHA(fname[5])
167 ! && ASCII_ISALPHA(fname[6])
168 ! && TOLOWER_ASC(fname[7]) == 'x'
169 ! && fname[8] == NUL)
173 for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
175 line = ml_get_buf(curbuf, lnum, FALSE);
176 ! if (strstr((char *)line, "*local-additions*") == NULL)
179 ! /* Go through all directories in 'runtimepath', skipping
184 ! copy_option_part(&p, NameBuff, MAXPATHL, ",");
186 ! rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
187 ! if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME)
199 ! /* Find all "doc/ *.txt" files in this directory. */
200 ! add_pathsep(NameBuff);
201 ! #ifdef FEAT_MULTI_LANG
202 ! STRCAT(NameBuff, "doc/*.??[tx]");
204 ! STRCAT(NameBuff, "doc/*.txt");
206 ! if (gen_expand_wildcards(1, &NameBuff, &fcount,
207 ! &fnames, EW_FILE|EW_SILENT) == OK
210 ! #ifdef FEAT_MULTI_LANG
219 ! /* If foo.abx is found use it instead of foo.txt in
220 ! * the same directory. */
221 ! for (i1 = 0; i1 < fcount; ++i1)
223 ! for (i2 = 0; i2 < fcount; ++i2)
227 ! if (fnames[i1] == NULL || fnames[i2] == NULL)
232 ! if (fnamencmp(f1, f2, t1 - f1) != 0)
234 ! e1 = vim_strrchr(t1, '.');
235 ! e2 = vim_strrchr(gettail(f2), '.');
236 ! if (e1 == NUL || e2 == NUL)
238 ! if (fnamecmp(e1, ".txt") != 0
239 ! && fnamecmp(e1, fname + 4) != 0)
241 ! /* Not .txt and not .abx, remove it. */
242 ! vim_free(fnames[i1]);
246 ! if (fnamencmp(f1, f2, e1 - f1) != 0)
248 ! if (fnamecmp(e1, ".txt") == 0
249 ! && fnamecmp(e2, fname + 4) == 0)
251 ! /* use .abx instead of .txt */
252 ! vim_free(fnames[i1]);
258 ! for (fi = 0; fi < fcount; ++fi)
260 ! if (fnames[fi] == NULL)
262 ! fd = mch_fopen((char *)fnames[fi], "r");
265 ! vim_fgets(IObuff, IOSIZE, fd);
266 ! if (IObuff[0] == '*'
267 ! && (s = vim_strchr(IObuff + 1, '*'))
271 ! int this_utf = MAYBE;
273 ! /* Change tag definition to a
274 ! * reference and remove <CR>/<NL>. */
279 ! if (*s == '\r' || *s == '\n')
282 ! /* The text is utf-8 when a byte
283 ! * above 127 is found and no
284 ! * illegal byte sequence is found.
286 ! if (*s >= 0x80 && this_utf != FALSE)
291 ! l = utf_ptr2len(s);
300 ! /* The help file is latin1 or utf-8;
301 ! * conversion to the current
302 ! * 'encoding' may be required. */
303 ! vc.vc_type = CONV_NONE;
304 ! convert_setup(&vc, (char_u *)(
305 ! this_utf == TRUE ? "utf-8"
306 ! : "latin1"), p_enc);
307 ! if (vc.vc_type == CONV_NONE)
308 ! /* No conversion needed. */
312 ! /* Do the conversion. If it fails
313 ! * use the unconverted text. */
314 ! cp = string_convert(&vc, IObuff,
319 ! convert_setup(&vc, NULL, NULL);
321 ! ml_append(lnum, cp, (colnr_T)0, FALSE);
325 ! ml_append(lnum, IObuff, (colnr_T)0,
333 + FreeWild(fcount, fnames);
343 *** ../vim-7.3.340/src/version.c 2011-10-20 18:12:27.000000000 +0200
344 --- src/version.c 2011-10-20 18:13:46.000000000 +0200
348 { /* Add new patch number below this line */
354 From "know your smileys":
355 :-)-O Smiling doctor with stethoscope
357 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
358 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
359 \\\ an exciting new programming language -- http://www.Zimbu.org ///
360 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///