mirror of
https://github.com/vim/vim.git
synced 2025-09-06 21:53:38 -04:00
patch 7.4.1499
Problem: No error message when :packadd does not find anything. Solution: Add an error message. (Hirohito Higashi)
This commit is contained in:
parent
2588b5a43f
commit
be82c25486
@ -213,7 +213,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
|||||||
about each searched file.
|
about each searched file.
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
|
|
||||||
*:pa* *:packadd*
|
*:pa* *:packadd* *E919*
|
||||||
:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath'
|
:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath'
|
||||||
and source any plugin files found. The directory must
|
and source any plugin files found. The directory must
|
||||||
match:
|
match:
|
||||||
|
@ -1012,7 +1012,7 @@ EX(CMD_print, "print", ex_print,
|
|||||||
RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK,
|
RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_packadd, "packadd", ex_packadd,
|
EX(CMD_packadd, "packadd", ex_packadd,
|
||||||
BANG|FILE1|TRLBAR|SBOXOK|CMDWIN,
|
BANG|FILE1|NEEDARG|TRLBAR|SBOXOK|CMDWIN,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_pclose, "pclose", ex_pclose,
|
EX(CMD_pclose, "pclose", ex_pclose,
|
||||||
BANG|TRLBAR,
|
BANG|TRLBAR,
|
||||||
|
@ -2918,8 +2918,7 @@ source_callback(char_u *fname, void *cookie UNUSED)
|
|||||||
/*
|
/*
|
||||||
* Source the file "name" from all directories in 'runtimepath'.
|
* Source the file "name" from all directories in 'runtimepath'.
|
||||||
* "name" can contain wildcards.
|
* "name" can contain wildcards.
|
||||||
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
|
* When "all" is TRUE: source all files, otherwise only the first one.
|
||||||
* When "flags" has DIP_DIR: find directories instead of files.
|
|
||||||
*
|
*
|
||||||
* return FAIL when no file could be sourced, OK otherwise.
|
* return FAIL when no file could be sourced, OK otherwise.
|
||||||
*/
|
*/
|
||||||
@ -2931,7 +2930,18 @@ source_runtime(char_u *name, int all)
|
|||||||
|
|
||||||
#define DIP_ALL 1 /* all matches, not just the first one */
|
#define DIP_ALL 1 /* all matches, not just the first one */
|
||||||
#define DIP_DIR 2 /* find directories instead of files. */
|
#define DIP_DIR 2 /* find directories instead of files. */
|
||||||
|
#define DIP_ERR 4 /* give an error message when none found. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find the file "name" in all directories in "path" and invoke
|
||||||
|
* "callback(fname, cookie)".
|
||||||
|
* "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 "flags" has DIP_ERR: give an error message if there is no match.
|
||||||
|
*
|
||||||
|
* return FAIL when no file could be sourced, OK otherwise.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
do_in_path(
|
do_in_path(
|
||||||
char_u *path,
|
char_u *path,
|
||||||
@ -3022,12 +3032,19 @@ do_in_path(
|
|||||||
}
|
}
|
||||||
vim_free(buf);
|
vim_free(buf);
|
||||||
vim_free(rtp_copy);
|
vim_free(rtp_copy);
|
||||||
if (p_verbose > 0 && !did_one && name != NULL)
|
if (!did_one && name != NULL)
|
||||||
|
{
|
||||||
|
char *basepath = path == p_rtp ? "runtimepath" : "packpath";
|
||||||
|
|
||||||
|
if (flags & DIP_ERR)
|
||||||
|
EMSG3(_(e_dirnotf), basepath, name);
|
||||||
|
else if (p_verbose > 0)
|
||||||
{
|
{
|
||||||
verbose_enter();
|
verbose_enter();
|
||||||
smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);
|
smsg((char_u *)_("not found in '%s': \"%s\""), basepath, name);
|
||||||
verbose_leave();
|
verbose_leave();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef AMIGA
|
#ifdef AMIGA
|
||||||
proc->pr_WindowPtr = save_winptr;
|
proc->pr_WindowPtr = save_winptr;
|
||||||
@ -3178,8 +3195,8 @@ theend:
|
|||||||
void
|
void
|
||||||
source_packages()
|
source_packages()
|
||||||
{
|
{
|
||||||
do_in_path(p_pp, (char_u *)"pack/*/ever/*",
|
do_in_path(p_pp, (char_u *)"pack/*/ever/*", DIP_ALL + DIP_DIR,
|
||||||
DIP_ALL + DIP_DIR, add_pack_plugin, p_pp);
|
add_pack_plugin, p_pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3197,8 +3214,8 @@ ex_packadd(exarg_T *eap)
|
|||||||
if (pat == NULL)
|
if (pat == NULL)
|
||||||
return;
|
return;
|
||||||
vim_snprintf(pat, len, plugpat, eap->arg);
|
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 + DIP_ERR,
|
||||||
eap->forceit ? NULL : p_pp);
|
add_pack_plugin, eap->forceit ? NULL : p_pp);
|
||||||
vim_free(pat);
|
vim_free(pat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1577,6 +1577,7 @@ EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
|
|||||||
#ifndef FEAT_CLIPBOARD
|
#ifndef FEAT_CLIPBOARD
|
||||||
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
|
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
|
||||||
#endif
|
#endif
|
||||||
|
EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
|
||||||
|
|
||||||
#ifdef MACOS_X_UNIX
|
#ifdef MACOS_X_UNIX
|
||||||
EXTERN short disallow_gui INIT(= FALSE);
|
EXTERN short disallow_gui INIT(= FALSE);
|
||||||
|
@ -31,6 +31,10 @@ func Test_packadd()
|
|||||||
call assert_equal(17, g:ftdetect_works)
|
call assert_equal(17, g:ftdetect_works)
|
||||||
call assert_true(len(&rtp) > len(rtp))
|
call assert_true(len(&rtp) > len(rtp))
|
||||||
call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
|
call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
|
||||||
|
|
||||||
|
" Check exception
|
||||||
|
call assert_fails("packadd directorynotfound", 'E919:')
|
||||||
|
call assert_fails("packadd", 'E471:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_packadd_noload()
|
func Test_packadd_noload()
|
||||||
|
@ -743,6 +743,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1499,
|
||||||
/**/
|
/**/
|
||||||
1498,
|
1498,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user