unit testing increases number of registered handlers

2011-02-04 Thread vitalije
Hello,
while I was experimenting with registering handler for idle events,
I have noticed
that there were about 40 registered handlers for idle event. What
was most interesting is the fact that those handlers were all about
the same function onIdle in mod_autosave plugin. At first I thought
that handler is registering itself over and over, but when I looked in
the source I couldn't find anything suspicious.

So I made small script to print number of registered handlers and
manually executed it from time to time to see when it increases.

g.es(len(g.app.pluginsController.getHandlersForOneTag(idle)))

Finally, I realized that every time when I invoke unit test command Alt
+5, number of registered handlers increased.

From the above it is obvious that I have enabled plugin mod_autosave.
From the Log
Leo Log Window
Leo 4.8 final, build 3752, November 26, 2010
Python 2.6.6, qt version 4.7.0
linux2

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: choose python version for @file

2011-02-04 Thread Kent Tenney
I've had endless problems with interpreter versioning, leading me to:

class Runwith:
def __init__(self, interpreter, code,
 cleanup=True, autorun=True,)
   def _prepare_run
   def _normalize_code
   def run
   def _report
   def _cleanup

it writes a file to disk, makes it executable, runs it, captures
exitcode, err and output, removes the files, provides reports.

This provides complete decoupling from Leo.

I have run-bash and run-python buttons in Leo which run the node
contents as shell or python.

I'm liking it a lot.

I'm currently extending it to provide command line sugar:

$ rw ln -s /home/ktenney/work/src/project/bin/myscript
/home/ktenney/bin --makelink.sh--

The rw script executes the command, and creates the script makelink.sh

On Fri, Feb 4, 2011 at 12:56 AM, Ville M. Vainio vivai...@gmail.com wrote:
 On Fri, Feb 4, 2011 at 4:37 AM, Anne cqci...@yahoo.com wrote:

 Is there a python command to set the version?
 I don't know of one. I had problems where my scripts (non-leo) were
 expecting a different python version than what I had, and I didn't
 find a good solution. I think python expects only one installed
 version on the system.

 Typically, you specify the full path to python executable when
 launching scripts, if you want to use a specific version.

 On Linux, you often have the binaries with full name available (e.g.
 'python2.6 test.py')

 --
 Ville M. Vainio @@ Forum Nokia

 --
 You received this message because you are subscribed to the Google Groups 
 leo-editor group.
 To post to this group, send email to leo-editor@googlegroups.com.
 To unsubscribe from this group, send email to 
 leo-editor+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/leo-editor?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: unit testing increases number of registered handlers

2011-02-04 Thread Edward K. Ream
On Fri, Feb 4, 2011 at 6:58 AM, vitalije vitali...@gmail.com wrote:

 Finally, I realized that every time when I invoke unit test command Alt
 +5, number of registered handlers increased.

Thanks for this.  I'll investigate.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: Script @prelude

2011-02-04 Thread Edward K. Ream
On Thu, Feb 3, 2011 at 4:41 PM, Ville M. Vainio vivai...@gmail.com wrote:

 - What if you scanned up the tree when pressing ctrl+b, and if one
 ancestor had @prelude in it, it would be evaluated as part of the
 script, before the code in current node?

Possible.   But this could be called a special case of::

exec(g.findTestScript(c,'@common my common code'))

I like the exec way better.  Of course, you are free to implement
@prelude in many ways if you prefer.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: What (vim) commands objects require repeat counts?

2011-02-04 Thread Edward K. Ream
On Thu, Feb 3, 2011 at 11:45 AM, tfer tfethers...@aol.com wrote:

 Normal mode is more interesting.

[big snip]

 What I'm saying here is that the problem is more one of developing the
 parsing function than binding keys to functions.

Thanks for this.  I knew that bindings were not the important part,
but I didn't realize how complex the parsing function is in vim.

It may be time to study vim, and it's source code in more detail.

Do you have any links to discussions of the internals of vim's command
parser?  Clearly, it can be duplicated in python ;-)

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: What (vim) commands objects require repeat counts?

2011-02-04 Thread Edward K. Ream
On Fri, Feb 4, 2011 at 8:58 AM, Edward K. Ream edream...@gmail.com wrote:

 Do you have any links to discussions of the internals of vim's command
 parser?  Clearly, it can be duplicated in python ;-)

I have the sources of vim72.  It appears that normal.c and ops.c are
where the action is.

I'll peruse the sources, and also look for higher-level docs.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: Script @prelude

2011-02-04 Thread Ville M. Vainio
On Fri, Feb 4, 2011 at 4:54 PM, Edward K. Ream edream...@gmail.com wrote:

 - What if you scanned up the tree when pressing ctrl+b, and if one
 ancestor had @prelude in it, it would be evaluated as part of the
 script, before the code in current node?

 Possible.   But this could be called a special case of::

    exec(g.findTestScript(c,'@common my common code'))

 I like the exec way better.  Of course, you are free to implement
 @prelude in many ways if you prefer.

The implementation is not a problem. I can also add my own button /
command, but I'm thinking of having this as standard feature. Leo is
infinitely scriptable, so there is no doubt there are many ways to do
this :).

I'm thinking that perhaps we should have execute-script-rich (or
something equivalent) that would provide a more advanced execution,
and have that bound by default to some key.

(Yes, this is the old argument about good defaults vs.
customizeability. In my books, if a feature is not available by
default or just by enabling a plugin, it doesn't exist)

-- 
Ville M. Vainio @@ Forum Nokia

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: Script @prelude

2011-02-04 Thread Edward K. Ream
On Fri, Feb 4, 2011 at 9:06 AM, Ville M. Vainio vivai...@gmail.com wrote:

 In my books, if a feature is not available by default or just by enabling a 
 plugin, it doesn't exist)

Interesting rule of thumb.  Otoh, exec(g.findTestScript,...) exists by default.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: Script @prelude

2011-02-04 Thread Ville M. Vainio
On Fri, Feb 4, 2011 at 6:04 PM, Edward K. Ream edream...@gmail.com wrote:

 In my books, if a feature is not available by default or just by enabling a 
 plugin, it doesn't exist)

 Interesting rule of thumb.  Otoh, exec(g.findTestScript,...) exists by 
 default.

Indeed. I wonder if we could accomplish the same with less
objectionable syntax...

-- 
Ville M. Vainio @@ Forum Nokia

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.