Re: Error In Documentation?

2007-03-25 Thread Vigil

On Sun, 25 Mar 2007, Bram Moolenaar wrote:


You apparently really want to pass ${*} to the shell command.  The help
for makeprg explains replacing $* with the name of the file, but you use
% for that.


My help says that $* is replaced with the arguments, which I take to mean -T in 
my example:


The placeholder $* can be given (even multiple times) to specify
where the arguments will be included

It doesn't say anything about the filename. Maybe it needs to distinguish which 
arguments it is referring to.



This probably also works:

   setlocal makeprg=/usr/share/vim/vim70/tools/efm_perl.pl\ -c\ -w\ $*


Nope. When I replace efm_perl.pl with efm_perl2.pl, a simple script that 
outputs the arguments it was called with, and I have


set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ ${*}\ %

and I call :make on the file that I have open ('binary.pl'), efm_perl2.pl 
outputs


Called with: -c -w binary.pl

When I call it with :make -T, it outputs

Called with: -c -w binary.pl -T

Now, if I change the makeprg thus:

set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ $*

and call :make:

Called with: -c -w

and :make -T:

Called with: -c -w -T

As you can see, the filename of the current buffer is not passed to the 
makeprg.


Further experimentation reveals that the order of %\ ${*} or ${*}\ % makes 
no difference to the arguments that efm_perl2.pl is passed, nor their order. 
Indeed, ${*} is superfluous, but it does seem that I need % to substitute both 
the filename AND any arguments I give to :make.


$* and all variations of braces in and around it, just doesn't work.

This
option may contain '%' and '#' characters, which are expanded like
when used in a command-line.

I think that needs explaining a bit more. To me, % is used when specifying the 
entire range of the file on the vim command line, and # prints lines with their 
respective line numbers :/


--

.


Re: Error In Documentation?

2007-03-25 Thread Bram Moolenaar

Vigil wrote:

 On Sun, 25 Mar 2007, Bram Moolenaar wrote:
 
  You apparently really want to pass ${*} to the shell command.  The help
  for makeprg explains replacing $* with the name of the file, but you use
  % for that.
 
 My help says that $* is replaced with the arguments, which I take to
 mean -T in my example:
 
  The placeholder $* can be given (even multiple times) to specify
  where the arguments will be included
 
 It doesn't say anything about the filename. Maybe it needs to
 distinguish which arguments it is referring to.

Sorry, $* is indeed replaced by the :make arguments, not the file name.

  This probably also works:
 
 setlocal makeprg=/usr/share/vim/vim70/tools/efm_perl.pl\ -c\ -w\ $*
 
 Nope. When I replace efm_perl.pl with efm_perl2.pl, a simple script that 
 outputs the arguments it was called with, and I have
 
   set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ ${*}\ %
 
 and I call :make on the file that I have open ('binary.pl'), efm_perl2.pl 
 outputs
 
   Called with: -c -w binary.pl

 When I call it with :make -T, it outputs
 
   Called with: -c -w binary.pl -T

What happens here is that ${*} is changed by the shell to an empty
string.  Then % is changed to the file name, and the other arguments
follow, since you don't use $*.  If you leave out ${*} you get the same
result.

 Now, if I change the makeprg thus:
 
   set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ $*
 
 and call :make:
 
   Called with: -c -w
 
 and :make -T:
 
   Called with: -c -w -T
 
 As you can see, the filename of the current buffer is not passed to the 
 makeprg.

No, but the argument is.  Thus these two are equivalent:

set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ % $*
set makeprg=~/.vim/tools/efm_perl2.pl\ -c\ -w\ %

Because when $* is not used you get the arguments anyway.

 Further experimentation reveals that the order of %\ ${*} or ${*}\
 % makes no difference to the arguments that efm_perl2.pl is passed,
 nor their order.  Indeed, ${*} is superfluous, but it does seem that I
 need % to substitute both the filename AND any arguments I give to
 :make.
 
 $* and all variations of braces in and around it, just doesn't work.
 
   This option may contain '%' and '#' characters, which are
   expanded like when used in a command-line.
 
 I think that needs explaining a bit more. To me, % is used when
 specifying the entire range of the file on the vim command line, and #
 prints lines with their respective line numbers :/

This refers to using them in an argument.  That should be mentioned,
I'll adjust the text.

-- 
It is illegal for anyone to give lighted cigars to dogs, cats, and other
domesticated animal kept as pets.
[real standing law in Illinois, United States of America]

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Error In Documentation?

2007-03-25 Thread A.J.Mechelynck

Vigil wrote:
[...]

This
option may contain '%' and '#' characters, which are expanded like
when used in a command-line.

I think that needs explaining a bit more. To me, % is used when 
specifying the entire range of the file on the vim command line, and # 
prints lines with their respective line numbers :/




% means 1,$ when used as a range, between the colon and the ex-command. # is 
equivalent to number when used as an ex-command (:#). Neither apply here.


When used after an ex-command which expects a file name, % means the filename 
of the current buffer, and # means the filename of the alternate buffer.


See
:help edit-intro
:help cmdline-special


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
138. You develop a liking for cold coffee.




Re: Error In Documentation?

2007-03-25 Thread Vigil

On Sun, 25 Mar 2007, A.J.Mechelynck wrote:

When used after an ex-command which expects a file name, % means the filename 
of the current buffer, and # means the filename of the alternate buffer.


See
:help edit-intro
:help cmdline-special


Thanks - I didn't think of it being used like that. I certainly didn't realise 
that :_% referred to it! I guess in the help system, an underscore means 
'something arbitrary here'.


--

.


Re: Error In Documentation?

2007-03-24 Thread Vigil

On Fri, 23 Mar 2007, Bram Moolenaar wrote:


in :help makeprg, I think the {$*} in the example ought to be ${*}. At
least, it wouldn't work for me unless I did that.


No, it's really $*.  This is replaced by Vim before passing the command
to the shell.


$* and {$*} won't work in my ftplugin. This, however, does:

setlocal makeprg=/usr/share/vim/vim70/tools/efm_perl.pl\ -c\ -w\ ${*}\ %

Perhaps the braces are to get around ithe command being sourced from a file?

--

.


Error In Documentation?

2007-03-23 Thread Vigil

In vim's:

VIM - Vi IMproved 7.0 (2006 May 7, compiled May 30 2006 13:06:19)
VIM - Vi IMproved 6.4 (2005 Oct 15, compiled May 23 2006 12:03:57)

in :help makeprg, I think the {$*} in the example ought to be ${*}. At least, 
it wouldn't work for me unless I did that.


--

.


Re: Error In Documentation?

2007-03-23 Thread Bram Moolenaar

Vigil wrote:

 In vim's:
 
 VIM - Vi IMproved 7.0 (2006 May 7, compiled May 30 2006 13:06:19)
 VIM - Vi IMproved 6.4 (2005 Oct 15, compiled May 23 2006 12:03:57)
 
 in :help makeprg, I think the {$*} in the example ought to be ${*}. At
 least, it wouldn't work for me unless I did that.

No, it's really $*.  This is replaced by Vim before passing the command
to the shell.

-- 
MONK: ... and the Lord spake, saying, First shalt thou take out the Holy Pin,
  then shalt thou count to three, no more, no less.  Three shalt be the
  number thou shalt count, and the number of the counting shalt be three.
  Four shalt thou not count, neither count thou two, excepting that thou
  then proceed to three.  Five is right out.  Once the number three, being
  the third number, be reached, then lobbest thou thy Holy Hand Grenade of
  Antioch towards thou foe, who being naughty in my sight, shall snuff it.
 Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///