diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-06-10 21:27:29 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-06-10 21:27:29 +0200 |
commit | c09a6d6c0c9d0e9056816f518171864158c72076 (patch) | |
tree | d40e772fb06ab3fc2fee71c87c0d84ba819ed3d2 /src/ex_cmds2.c | |
parent | f9c9b32bd124235136980749bee754cae99e164a (diff) |
updated for version 7.3.1163v7.3.1163
Problem: Not easy to load Python modules.
Solution: Search "python2", "python3" and "pythonx" directories in
'runtimepath' for Python modules. (ZyX)
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r-- | src/ex_cmds2.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 353ae8981f..22b41f415e 100644 --- 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, cookie) 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, cookie) { /* 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, cookie) } 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); |