Re: bug in map expr and complete()

2006-10-06 Thread Jürgen Krämer

Hi,

Hari Krishna Dara wrote:
 The help on complete() gives an example as a usage pattern which seems
 to be very useful, but it doesn't work. Here is a slightly modified
 example to avoid breaking the lines in email transmission:
 
 inoremap expr F5 ListWeeks()
 func! ListWeeks()
   call complete(col('.'), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])
   return ''
 endfunc
 
 If you hit F5, Vim complains about the complete() as not allowed.
 
 Error detected while processing function ListWeeks:
 line1:
 E523: Not allowed here

I don't know the reason for this restriction, but it is documented under
:help complete():

| Set the matches for Insert mode completion.
| Can only be used in Insert mode.  You need to use a mapping
| with CTRL-R = |i_CTRL-R|.  It does not work after CTRL-O or
| with an expression mapping.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: bug in map expr and complete()

2006-10-06 Thread Hari Krishna Dara

On Fri, 6 Oct 2006 at 8:19am, Jürgen Krämer wrote:


 Hi,

 Hari Krishna Dara wrote:
  The help on complete() gives an example as a usage pattern which seems
  to be very useful, but it doesn't work. Here is a slightly modified
  example to avoid breaking the lines in email transmission:
 
  inoremap expr F5 ListWeeks()
  func! ListWeeks()
call complete(col('.'), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri',
'Sat'])
return ''
  endfunc
 
  If you hit F5, Vim complains about the complete() as not allowed.
 
  Error detected while processing function ListWeeks:
  line1:
  E523: Not allowed here

 I don't know the reason for this restriction, but it is documented under
 :help complete():

I am sorry, what exactly are you referring to as documented? The help on
complete() talks nothing about E523 or why it can't be used in expr
maps. In fact the above example is directly based on the example given
in that help.

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: bug in map expr and complete()

2006-10-06 Thread A.J.Mechelynck

Hari Krishna Dara wrote:

On Fri, 6 Oct 2006 at 8:19am, Jürgen Krämer wrote:


Hi,

Hari Krishna Dara wrote:

The help on complete() gives an example as a usage pattern which seems
to be very useful, but it doesn't work. Here is a slightly modified
example to avoid breaking the lines in email transmission:

inoremap expr F5 ListWeeks()
func! ListWeeks()
  call complete(col('.'), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri',

'Sat'])

  return ''
endfunc

If you hit F5, Vim complains about the complete() as not allowed.

Error detected while processing function ListWeeks:
line1:
E523: Not allowed here

I don't know the reason for this restriction, but it is documented under
:help complete():


I am sorry, what exactly are you referring to as documented? The help on
complete() talks nothing about E523 or why it can't be used in expr
maps. In fact the above example is directly based on the example given
in that help.



He means this, from
*eval.txt*  For Vim version 7.0.  Last change: 2006 Sep 22

lines 2019-2023
 8 
complete({startcol}, {matches}) *complete()* *E785*
Set the matches for Insert mode completion.
Can only be used in Insert mode.  You need to use a mapping
with CTRL-R = |i_CTRL-R|.  It does not work after CTRL-O or
with an expression mapping.
 8 

IIUC, expression mapping refers to :imap expr.

:help E523 refers to the 'secure' option.

The difference between your mapping and the example is that you use :imap 
expr while the example does not use expr but uses C-R=


I don't know the reason for the restriction but it _is_ documented.


Best regards,
Tony.


Re: bug in map expr and complete()

2006-10-06 Thread Hari Krishna Dara

On Fri, 6 Oct 2006 at 7:48pm, A.J.Mechelynck wrote:

 Hari Krishna Dara wrote:
  On Fri, 6 Oct 2006 at 8:19am, Jürgen Krämer wrote:
 
  Hi,
 
  Hari Krishna Dara wrote:
  The help on complete() gives an example as a usage pattern which seems
  to be very useful, but it doesn't work. Here is a slightly modified
  example to avoid breaking the lines in email transmission:
 
  inoremap expr F5 ListWeeks()
  func! ListWeeks()
call complete(col('.'), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri',
  'Sat'])
return ''
  endfunc
 
  If you hit F5, Vim complains about the complete() as not allowed.
 
  Error detected while processing function ListWeeks:
  line1:
  E523: Not allowed here
  I don't know the reason for this restriction, but it is documented under
  :help complete():
 
  I am sorry, what exactly are you referring to as documented? The help on
  complete() talks nothing about E523 or why it can't be used in expr
  maps. In fact the above example is directly based on the example given
  in that help.
 

 He means this, from
 *eval.txt*  For Vim version 7.0.  Last change: 2006 Sep 22

 lines 2019-2023
  8 
 complete({startcol}, {matches})   *complete()* *E785*
   Set the matches for Insert mode completion.
   Can only be used in Insert mode.  You need to use a mapping
   with CTRL-R = |i_CTRL-R|.  It does not work after CTRL-O or
   with an expression mapping.
  8 

 IIUC, expression mapping refers to :imap expr.

 :help E523 refers to the 'secure' option.

 The difference between your mapping and the example is that you use :imap
 expr while the example does not use expr but uses C-R=

 I don't know the reason for the restriction but it _is_ documented.


 Best regards,
 Tony.

Interesting... the 7.0.99 version that I have doesn't have anything that
you are pointing to, and the example clearly used map expr. The
documentation was probably updated later on? What patch version do you
have? Or may be that I updated the vim binaries, not runtime, so I might
not be seeing the updates to documentation.

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: bug in map expr and complete()

2006-10-06 Thread A.J.Mechelynck

Hari Krishna Dara wrote:
[...]

Interesting... the 7.0.99 version that I have doesn't have anything that
you are pointing to, and the example clearly used map expr. The
documentation was probably updated later on? What patch version do you
have? Or may be that I updated the vim binaries, not runtime, so I might
not be seeing the updates to documentation.



I periodically update my runtime files using

 cd ~/.build/vim/vim70
 rsync -avzcP --delete --exclude=/dos/ ftp.nluug.nl::Vim/runtime/ ./runtime/

, because not every runtime file change is reflected in the patches. I quoted 
the first line of the help file in my previous patch so you could see the 
datestamp; I don't think it was included in one of the official numbered 
patches. (This also means that the patcher usually rejects runtime file 
updates when they _are_ included, but that's not really a problem; it prompts 
me to do an rsync run between patch and compile).


FYI, I compiled an installed gvim 7.0.119 a few minutes ago.


Best regards,
Tony.


Re: bug in map expr and complete()

2006-10-06 Thread Bill McCarthy
On Fri 6-Oct-06 6:46pm -0600, A.J.Mechelynck wrote:

 Hari Krishna Dara wrote:
 [...]
 Interesting... the 7.0.99 version that I have doesn't have anything that
 you are pointing to, and the example clearly used map expr. The
 documentation was probably updated later on? What patch version do you
 have? Or may be that I updated the vim binaries, not runtime, so I might
 not be seeing the updates to documentation.
 

 I periodically update my runtime files using

   cd ~/.build/vim/vim70
   rsync -avzcP --delete --exclude=/dos/ ftp.nluug.nl::Vim/runtime/ 
 ./runtime/

Thanks for showing us the 'nix approach.  Here's the dos
approach:

  copy /us ftp://ftp.home.vim.org/pub/vim/runtime/dos/*; c:\vim\vim70\

-- 
Best regards,
Bill



Re: bug in map expr and complete()

2006-10-06 Thread A.J.Mechelynck

Bill McCarthy wrote:

On Fri 6-Oct-06 6:46pm -0600, A.J.Mechelynck wrote:


Hari Krishna Dara wrote:
[...]

Interesting... the 7.0.99 version that I have doesn't have anything that
you are pointing to, and the example clearly used map expr. The
documentation was probably updated later on? What patch version do you
have? Or may be that I updated the vim binaries, not runtime, so I might
not be seeing the updates to documentation.


I periodically update my runtime files using

  cd ~/.build/vim/vim70
  rsync -avzcP --delete --exclude=/dos/ ftp.nluug.nl::Vim/runtime/ ./runtime/


Thanks for showing us the 'nix approach.  Here's the dos
approach:

  copy /us ftp://ftp.home.vim.org/pub/vim/runtime/dos/*; c:\vim\vim70\



Thanks for showing us the dos command-line approach (I didn't know copy 
could fetch files over the Internet). When in Windows, I would normally use a 
graphical FTP client such as FileZilla, set my preferences to Overwrite if 
newer or whatever it's called, and drag the files/folders from one pane to 
the other after highlighting them all. But it is also possible (in both Linux 
and Windows) to use the command-line ftp utility (with mget so wildcards can 
be used). The advantage of rsync or of other clients who can make timestamp 
comparison, is that unchanged files are not re-downloaded.



Best regards,
Tony.


Re: bug in map expr and complete()

2006-10-06 Thread Bill McCarthy
On Fri 6-Oct-06 8:36pm -0600, you wrote:

 Bill McCarthy wrote:
 On Fri 6-Oct-06 6:46pm -0600, A.J.Mechelynck wrote:
 
 Hari Krishna Dara wrote:
 [...]
 Interesting... the 7.0.99 version that I have doesn't have anything that
 you are pointing to, and the example clearly used map expr. The
 documentation was probably updated later on? What patch version do you
 have? Or may be that I updated the vim binaries, not runtime, so I might
 not be seeing the updates to documentation.

 I periodically update my runtime files using

   cd ~/.build/vim/vim70
   rsync -avzcP --delete --exclude=/dos/ ftp.nluug.nl::Vim/runtime/ 
 ./runtime/
 
 Thanks for showing us the 'nix approach.  Here's the dos
 approach:
 
   copy /us ftp://ftp.home.vim.org/pub/vim/runtime/dos/*; c:\vim\vim70\
 

 Thanks for showing us the dos command-line approach (I didn't know copy
 could fetch files over the Internet). When in Windows, I would normally use a
 graphical FTP client such as FileZilla, set my
 preferences to Overwrite if 
 newer or whatever it's called, and drag the
 files/folders from one pane to 
 the other after highlighting them all. But it is also possible (in both Linux
 and Windows) to use the command-line ftp utility (with mget so wildcards can
 be used). The advantage of rsync or of other clients who can make timestamp
 comparison, is that unchanged files are not re-downloaded.

My shell is 4nt.  The copy command (and any other command)
allowed ftp files (in fact you can open an ftp site, with
subdirectory names if desired, and use ftp:wildcard to
reference them).

The /s switch includes subdirectories.

The /u switch only updates files with newer time stamps.

It also supports wildcards.

-- 
Best regards,
Bill