Re: vim9 autoload script modified : How to reload it On-The-Fly

2023-01-12 Thread N i c o l a s
Found and sorry.

vim9script

if exists("g:did_load_helper")
  *finish*
endif
g:did_load_helper = 1


I thought in the help for vim9 same mecanism to prevent loading script can 
be applied. Maybe a mistake of reading from me.

Thank you Life
Nicolas
Le jeudi 12 janvier 2023 à 21:24:41 UTC+1, Lifepillar a écrit :

> On 2023-01-11, N i c o l a s  wrote:
> > Hum, thanks a lot Life, after one more check:
> >
> > *./vimfiles/plugged/foo-helper.vim/autoload/vim9fooscript.vim*
> >
> > vim9script
> >
> > *# some many defs func*
> >
> > export def *High_Caller*(): void
> > Sub_Called(4)
> > enddef
> >
> > def Sub_Called(code: number ): void
> > *# some job*
> > enddef
> >
> >
> > *~/_vimc*
> > import autoload './vimfiles/*plugged*/foo-helper.vim/autoload/
> > *vim9fooscript*.vim' as *Helper*
> > nnoremap io  *Helper*.High_Caller()
> >
> >
> > typing io it echoes E1091: Function is not compiled: *vim9fooscript*#
> > *High_Caller*
>
> I'd start by removing the "many function defs", and possibly simplifying
> the body fo Sub_Called(), and see if I can source without error. Then,
> I would start to gradually re-add the removed material until I find what
> is causing the error.
>
> Hope this helps,
> Life.
>
>

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/7aba787d-c2c2-4d36-b503-cd1a2bf937a3n%40googlegroups.com.


Re: vim9 autoload script modified : How to reload it On-The-Fly

2023-01-12 Thread Lifepillar
On 2023-01-11, N i c o l a s  wrote:
> Hum, thanks a lot Life, after one more check:
>
> *./vimfiles/plugged/foo-helper.vim/autoload/vim9fooscript.vim*
>
> vim9script
>
> *# some many defs func*
>
> export def  *High_Caller*(): void
>Sub_Called(4)
> enddef
>
> def  Sub_Called(code: number ): void
>   *# some job*
> enddef
>
>
> *~/_vimc*
> import autoload './vimfiles/*plugged*/foo-helper.vim/autoload/
> *vim9fooscript*.vim' as *Helper*
> nnoremap io   *Helper*.High_Caller()
>
>
> typing io it echoes  E1091: Function is not compiled:  *vim9fooscript*#
> *High_Caller*

I'd start by removing the "many function defs", and possibly simplifying
the body fo Sub_Called(), and see if I can source without error. Then,
I would start to gradually re-add the removed material until I find what
is causing the error.

Hope this helps,
Life.

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/tppq9r%248v1%241%40ciao.gmane.io.


Re: vim9 autoload script modified : How to reload it On-The-Fly

2023-01-11 Thread N i c o l a s
Hum, thanks a lot Life, after one more check:

*./vimfiles/plugged/foo-helper.vim/autoload/vim9fooscript.vim*

vim9script

*# some many defs func*

export def  *High_Caller*(): void
   Sub_Called(4)
enddef  

def  Sub_Called(code: number ): void
  *# some job*
enddef  


*~/_vimc*
import autoload './vimfiles/*plugged*/foo-helper.vim/autoload/
*vim9fooscript*.vim' as *Helper*
nnoremap io   *Helper*.High_Caller()


typing io it echoes  E1091: Function is not compiled:  *vim9fooscript*#
*High_Caller*


Does foo-helper.vim directory must match vim9fooscript ?
Le mercredi 11 janvier 2023 à 21:33:08 UTC+1, Lifepillar a écrit :

> On 2023-01-11, N i c o l a s  wrote:
> >
> > effectively, sourcing does not work sorry lifepillar: it echoes to me a
> > message E1091 Function HighCaller (below) is not compiled.
> >
> > And the calling tree is as this :
> > nnoremap *foo * Helper. *HighCaller* () ->
> > autoload/vim9fooscript.vim :: *exported *def *HighCaller() *->
> > autoload/vim9fooscript.vim :: def *SubCalled*
>
> There may be something else going on in your script, possibly a syntax
> error in some function. This trivial example works for me:
>
> ~/.vim/autoload/vim9fooscript.vim
>
> vim9script
>
> export def HighCaller()
> SubCalled()
> enddef
>
> def SubCalled()
> echo 'I was called!'
> enddef
>
> ~/.vim/vimrc
>
> import autoload "vim9fooscript.vim" as Helper
> nnoremap gG  Helper.HighCaller()
>
> When I start Vim and type gG, Vim echoes 'I was called!'. If I then
> change the echo message to something else, save the script and then
> :source ~/.vim/autoload/vim9fooscript.vim, I get no errors and gG prints
> the updated message. 
>
> Life.
>
>

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/876f9f74-0b46-49c3-8352-ea7cfd35d4d1n%40googlegroups.com.


Re: vim9 autoload script modified : How to reload it On-The-Fly

2023-01-11 Thread Lifepillar
On 2023-01-11, N i c o l a s  wrote:
>
> effectively, sourcing does not work sorry lifepillar: it echoes to me a
> message E1091 Function HighCaller (below) is not compiled.
>
> And the calling tree is as this :
> nnoremap *foo * Helper. *HighCaller*  () ->
> autoload/vim9fooscript.vim :: *exported *def *HighCaller() *->
> autoload/vim9fooscript.vim :: def *SubCalled*

There may be something else going on in your script, possibly a syntax
error in some function. This trivial example works for me:

~/.vim/autoload/vim9fooscript.vim

vim9script

export def HighCaller()
  SubCalled()
enddef

def SubCalled()
  echo 'I was called!'
enddef

~/.vim/vimrc

import autoload "vim9fooscript.vim" as Helper
nnoremap gG  Helper.HighCaller()

When I start Vim and type gG, Vim echoes 'I was called!'. If I then
change the echo message to something else, save the script and then
:source ~/.vim/autoload/vim9fooscript.vim, I get no errors and gG prints
the updated message. 

Life.

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/tpn6dm%24u3j%241%40ciao.gmane.io.


Re: vim9 autoload script modified : How to reload it On-The-Fly

2023-01-11 Thread N i c o l a s


Ok Bram that what I do each time I modify an autoload vim9script (so I do 
the best I can :)
effectively, sourcing does not work sorry lifepillar: it echoes to me a 
message E1091 Function HighCaller (below) is not compiled.

And the calling tree is as this :
nnoremap *foo * Helper. *HighCaller*  () ->  
autoload/vim9fooscript.vim :: *exported *def *HighCaller() *->  
autoload/vim9fooscript.vim :: def *SubCalled*

So it seems to be  needed to add a mapping to launch gvim -c with the 
command test I need.
*Thank you*
*Nicolas*


Le mercredi 11 janvier 2023 à 21:09:00 UTC+1, Bram Moolenaar a écrit :

>
> > Currently modifying an *autoload*/*vim9fooscript*.vim which can be 
> started 
> > by typing a nnoremap as this :
> > 
> > 
> > - *_vimrc* :
> > 
> > import autoload './vimfiles/some/thing/*autoload*/*vim9fooscript* .vim'
> > as thatHelp
> > *nnoremap* inout  thatHelp.E10_InOut()
> > 
> > 
> > 
> > - vimfiles/some/thing/*autoload*/*vim9fooscript*.vim 
> > 
> > def Foo which is currently modifying
> > 
> > 
> > How to force "recompile" the new modified content of def Foo without 
> touch 
> > the nnoremap ?
>
> There is no reliable way to reload an autoload script and have all the
> changes take effect. It's best to exit Vim and restart. Trying to make
> this work without a Vim restart is not only complicated, it is also
> going to be unreliable.
>
> -- 
> An alien life briefly visits earth. Just before departing it leaves a
> message in the dust on the back of a white van. The world is shocked
> and wants to know what it means. After months of studies the worlds
> best linguistic scientists are able to decipher the message: "Wash me!".
>
> /// Bram Moolenaar -- br...@moolenaar.net -- http://www.Moolenaar.net \\\
> /// \\\
> \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
>

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/3d4ed282-6c4c-4f67-a411-bb130e83353dn%40googlegroups.com.


Re: vim9 autoload script modified : How to reload it On-The-Fly

2023-01-11 Thread Bram Moolenaar


> Currently modifying an *autoload*/*vim9fooscript*.vim which can be started 
> by typing a nnoremap as this :
> 
> 
>- *_vimrc* :
> 
> import autoload './vimfiles/some/thing/*autoload*/*vim9fooscript*  .vim'
> as thatHelp
> *nnoremap* inout  thatHelp.E10_InOut()
> 
> 
> 
>- vimfiles/some/thing/*autoload*/*vim9fooscript*.vim  
> 
> def Foo which is currently modifying
> 
> 
> How to force "recompile" the new modified content of def Foo without touch 
> the nnoremap ?

There is no reliable way to reload an autoload script and have all the
changes take effect.  It's best to exit Vim and restart.  Trying to make
this work without a Vim restart is not only complicated, it is also
going to be unreliable.

-- 
An alien life briefly visits earth.  Just before departing it leaves a
message in the dust on the back of a white van.  The world is shocked
and wants to know what it means.  After months of studies the worlds
best linguistic scientists are able to decipher the message: "Wash me!".

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20230111200849.7B4C21C07A0%40moolenaar.net.


Re: vim9 autoload script modified : How to reload it On-The-Fly

2023-01-11 Thread Lifepillar
On 2023-01-11, N i c o l a s  wrote:
> Hi,
>
> Currently modifying an *autoload*/*vim9fooscript*.vim which can be started
> by typing a nnoremap as this :
>
>
>- *_vimrc* :
>
> import autoload './vimfiles/some/thing/*autoload*/*vim9fooscript*  .vim'
> as thatHelp
> *nnoremap* inout  thatHelp.E10_InOut()
>
>
>
>- vimfiles/some/thing/*autoload*/*vim9fooscript*.vim
>
> def Foo which is currently modifying
>
>
> How to force "recompile" the new modified content of def Foo without touch
> the nnoremap ?

Sourcing the autoload script should clear the old definitions and
compile the new ones. See :help vim9-reload.

Hope this helps,
Life.

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/tpn4bu%2414kt%241%40ciao.gmane.io.


vim9 autoload script modified : How to reload it On-The-Fly

2023-01-11 Thread N i c o l a s
Hi,

Currently modifying an *autoload*/*vim9fooscript*.vim which can be started 
by typing a nnoremap as this :


   - *_vimrc* :

import autoload './vimfiles/some/thing/*autoload*/*vim9fooscript*  .vim'
as thatHelp
*nnoremap* inout  thatHelp.E10_InOut()



   - vimfiles/some/thing/*autoload*/*vim9fooscript*.vim  

def Foo which is currently modifying


How to force "recompile" the new modified content of def Foo without touch 
the nnoremap ?

Thank you
N i  c  o l a s

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/a132de71-6114-4fe2-ab83-41bec94ce8b7n%40googlegroups.com.