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)
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 353ae89..22b41f4 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2737,6 +2737,10 @@
* 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 @@
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 @@
{
/* 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 @@
}
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);