Loading ...
Sorry, an error occurred while loading the content.

Re:

Expand Messages
  • A. J. Mechelynck
    ... The way I read it, the help for means that it always produces exactly one quoted string containing all the arguments (I presume that if there are
    Message 1 of 3 , Jun 2, 2005
    • 0 Attachment
      Charles E. Campbell, Jr. wrote:
      > Hello, Bram!
      >
      > When there are no arguments, <f-args> will create no arguments.
      > That appears not to be the case for <q-args>, as shown by sourcing
      >
      > fun! Problem(...)
      > echomsg " ----- "
      > echomsg " a:0=".a:0
      > if a:0 > 0
      > echomsg " a:1<".a:1.">"
      > endif
      > endfun
      > com -nargs=? PRBLM call Problem(<q-args>)
      > PRBLM
      >
      > Its not clear from the documentation (at least, not to me) that <q-args>
      > should have this behavior of inventing an argument (I assume its "")
      > when there are none provided.
      >
      > Just thought I'd point it out.
      >
      > Regards,
      > Chip Campbell
      >
      >
      >
      >

      The way I read it, the help for <q-args> means that it always produces
      exactly one quoted string containing all the arguments (I presume that
      if there are none, the null string is used). <f-args>, OTOH, produces
      (IIUC) a comma-separated list of (zero or more) quoted arguments.

      I'm looking at:

      *map.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
      lines 1031 sqq.

      *map.txt* For Vim version 6.3. Last change: 2004 May 21
      lines 1033 sqq.


      Best regards,
      Tony.
    • Bram Moolenaar
      Charles - ... I think we can add a remark in the docs that is an empty string when there are no arguments. I don t see a good reason to change the
      Message 2 of 3 , Jun 3, 2005
      • 0 Attachment
        Charles -

        > When there are no arguments, <f-args> will create no arguments.
        > That appears not to be the case for <q-args>, as shown by sourcing
        >
        > fun! Problem(...)
        > echomsg " ----- "
        > echomsg " a:0=".a:0
        > if a:0 > 0
        > echomsg " a:1<".a:1.">"
        > endif
        > endfun
        > com -nargs=? PRBLM call Problem(<q-args>)
        > PRBLM
        >
        > Its not clear from the documentation (at least, not to me) that <q-args>
        > should have this behavior of inventing an argument (I assume its "")
        > when there are none provided.
        >
        > Just thought I'd point it out.

        I think we can add a remark in the docs that <q-args> is an empty string
        when there are no arguments. I don't see a good reason to change the
        behavior. As it is now it also works for a function that takes one
        argument. It would fails if <q-args> doesn't produce an empty string
        when there is no argument.

        - Bram

        --
        How To Keep A Healthy Level Of Insanity:
        16. Have your coworkers address you by your wrestling name, Rock Hard Kim.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
      Your message has been successfully submitted and would be delivered to recipients shortly.