Hi Bram and list!
Pre patch:
:packadd directorynotfound
(No message output)
Post patch:
:packadd directorynotfound
E919: Directory not found in 'packpath': "directorynotfound"
Please adjust the words and items.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index d5d7863..1b9e54f 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -213,7 +213,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
about each searched file.
{not in Vi}
- *:pa* *:packadd*
+ *:pa* *:packadd* *E919*
:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath'
and source any plugin files found. The directory must
match:
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index b6992b2..a8207ac 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2920,6 +2920,7 @@ source_callback(char_u *fname, void *cookie UNUSED)
* "name" can contain wildcards.
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
* When "flags" has DIP_DIR: find directories instead of files.
+ * When "outmsg" is TRUE error or information message will be output.
*
* return FAIL when no file could be sourced, OK otherwise.
*/
@@ -2937,6 +2938,7 @@ do_in_path(
char_u *path,
char_u *name,
int flags,
+ int outmsg,
void (*callback)(char_u *fname, void *ck),
void *cookie)
{
@@ -3022,11 +3024,18 @@ do_in_path(
}
vim_free(buf);
vim_free(rtp_copy);
- if (p_verbose > 0 && !did_one && name != NULL)
+ if (!did_one && name != NULL)
{
- verbose_enter();
- smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);
- verbose_leave();
+ char *basepath = path == p_rtp ? "runtimepath" : "packpath";
+
+ if (outmsg)
+ EMSG3(_(e_dirnotf), basepath, gettail(name));
+ else if (p_verbose > 0)
+ {
+ verbose_enter();
+ smsg((char_u *)_("not found in '%s': \"%s\""), basepath, name);
+ verbose_leave();
+ }
}
#ifdef AMIGA
@@ -3054,7 +3063,7 @@ do_in_runtimepath(
void (*callback)(char_u *fname, void *ck),
void *cookie)
{
- return do_in_path(p_rtp, name, all ? DIP_ALL : 0, callback, cookie);
+ return do_in_path(p_rtp, name, all ? DIP_ALL : 0, FALSE, callback, cookie);
}
/*
@@ -3178,8 +3187,8 @@ theend:
void
source_packages()
{
- do_in_path(p_pp, (char_u *)"pack/*/ever/*",
- DIP_ALL + DIP_DIR, add_pack_plugin, p_pp);
+ do_in_path(p_pp, (char_u *)"pack/*/ever/*", DIP_ALL + DIP_DIR, FALSE,
+ add_pack_plugin, p_pp);
}
/*
@@ -3197,7 +3206,7 @@ ex_packadd(exarg_T *eap)
if (pat == NULL)
return;
vim_snprintf(pat, len, plugpat, eap->arg);
- do_in_path(p_pp, (char_u *)pat, DIP_ALL + DIP_DIR, add_pack_plugin,
+ do_in_path(p_pp, (char_u *)pat, DIP_ALL + DIP_DIR, TRUE, add_pack_plugin,
eap->forceit ? NULL : p_pp);
vim_free(pat);
}
diff --git a/src/globals.h b/src/globals.h
index 6fd86fb..bd9ef5c 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1577,6 +1577,7 @@ EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
#ifndef FEAT_CLIPBOARD
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
#endif
+EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
#ifdef MACOS_X_UNIX
EXTERN short disallow_gui INIT(= FALSE);
diff --git a/src/testdir/test_packadd.vim b/src/testdir/test_packadd.vim
index 091fec2..ccc77b0 100644
--- a/src/testdir/test_packadd.vim
+++ b/src/testdir/test_packadd.vim
@@ -31,6 +31,14 @@ func Test_packadd()
call assert_equal(17, g:ftdetect_works)
call assert_true(len(&rtp) > len(rtp))
call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
+
+ " Check exception
+ try
+ packadd directorynotfound
+ catch
+ call assert_exception('E919:')
+ endtry
+
endfunc
func Test_packadd_noload()