Mercurial > vim
diff src/ex_cmds2.c @ 4833:70b1178dec79 v7.3.1163
updated for version 7.3.1163
Problem: Not easy to load Python modules.
Solution: Search "python2", "python3" and "pythonx" directories in
'runtimepath' for Python modules. (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 10 Jun 2013 21:27:29 +0200 |
parents | 208a6c04e6b8 |
children | 5751284311f3 |
line wrap: on
line diff
--- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2737,6 +2737,10 @@ source_runtime(name, all) * When "all" is TRUE repeat for all matches, otherwise only the first one is * used. * Returns OK when at least one match found, FAIL otherwise. + * + * If "name" is NULL calls callback for each entry in runtimepath. Cookie is + * passed by reference in this case, setting it to NULL indicates that callback + * has done its job. */ int do_in_runtimepath(name, all, callback, cookie) @@ -2768,7 +2772,7 @@ do_in_runtimepath(name, all, callback, c buf = alloc(MAXPATHL); if (buf != NULL && rtp_copy != NULL) { - if (p_verbose > 1) + if (p_verbose > 1 && name != NULL) { verbose_enter(); smsg((char_u *)_("Searching for \"%s\" in \"%s\""), @@ -2782,7 +2786,13 @@ do_in_runtimepath(name, all, callback, c { /* Copy the path from 'runtimepath' to buf[]. */ copy_option_part(&rtp, buf, MAXPATHL, ","); - if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL) + if (name == NULL) + { + (*callback)(buf, (void *) &cookie); + if (!did_one) + did_one = (cookie == NULL); + } + else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL) { add_pathsep(buf); tail = buf + STRLEN(buf); @@ -2821,7 +2831,7 @@ do_in_runtimepath(name, all, callback, c } vim_free(buf); vim_free(rtp_copy); - if (p_verbose > 0 && !did_one) + if (p_verbose > 0 && !did_one && name != NULL) { verbose_enter(); smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);