Hi folks,

I did test leo some time ago, and decided to wait until the "new
layout" mechanism is sattled down. Now I downloaded leo version
(Leo 4.9.1 devel, build 4867, 2011-12-05 06:57:18 -0500) to try again.

The layout handling is OK, but I did encounter some strange behaviour
with @path and @auto directives.

General Info
==========
- leoSettings.leo activated plugins:

# default
contextmenu.py
leo_to_html.py
mod_scripting.py
nav_qt.py
quicksearch.py
stickynotes.py
todo.py
viewrendered.py

# I activated
active_path.py
attrib_edit.py
xml_edit.py

all other settings are default. There is no myLeoSettings.leo

===
OS: ubuntu 11.10

TestCase
========

A simplified testcase outline looks like this:

+ @path ~/tmp/
|
+- /tstLeo/
    *- test.js

test.js file contains:

/* some comment */
var = "<< some text >>";

=====

When I doubleClick the test.js _the first time_ it says:

@verbatim is not a Leo directive: test declarations
undefined section: << some text >>
referenced from: test declarations
error: @auto did not import test.js perfectly
first mismatched line: 4 (original) = 4 (imported)

hook failed: icondclick1, <function <lambda> at 0x3a23848>,
leo.plugins.active_path
Traceback (most recent call last):
  File "/path/to/leo/core/leoPlugins.py", line 336, in callTagHandler
    result = handler(tag,keywords)
  File "/path/to/leo/plugins/active_path.py", line 124, in <lambda>
    g.registerHandler(event, lambda t,k: onSelect(t,k))
  File "/path/to/leo/plugins/active_path.py", line 229, in onSelect
    if sync_node_to_folder(c,pos,path):
  File "/path/to/leo/plugins/active_path.py", line 322, in
sync_node_to_folder
    openFile(c,parent,d)
  File "/path/to/leo/plugins/active_path.py", line 398, in openFile
    c.importCommands.createOutline(d,parent=parent,atAuto=True)
  File "/path/to/leo/core/leoImport.py", line 888, in createOutline
    func(s,p,atAuto=atAuto)
  File "/path/to/leo/core/leoImport.py", line 1531, in
scanJavaScriptText
    scanner.run(s,parent)
  File "/path/to/leo/core/leoImport.py", line 3327, in run
    ok = self.errors == 0 and self.check(s,parent)
  File "/path/to/leo/core/leoImport.py", line 1838, in check
    return self.checkTrialWrite()
  File "/path/to/leo/core/leoImport.py", line 1927, in checkTrialWrite
    self.reportMismatch(lines1,lines2,bad_i1,bad_i2)
  File "/path/to/leo/core/leoImport.py", line 2070, in reportMismatch
    line = repr(lines2[i])
IndexError: list index out of range

======
I want to see, what's going on
I click the outline in no special order (see below)

* @path ~/tmp/
|
+- /tstLeo/   ... mouse click
    +- test.js  ... mouse click

it magically changes to this view:

* @path ~/tmp/
|
+- /tstLeo/
    +- test.js
        +- *test declarations*

test.js node contains:
@language javascript
@tabwidth -4
@others

-> OK

*test declarations* node contains:

/* comment */
@verbatim
var text1 = '<< some text >>';

which actually is the test.js file content. (except @verbatim) -> ???
=====

the log window doesn't show new information ...

=====

Save the file:
saved: workbook.leo

Closed the workbook.leo tab

=====
Open the file with: Menu: File: Recent: workbook.leo

I want to load test.js automatically, so I added @auto

* @path ~/tmp/
|
+- /tstLeo/
    +- @auto test.js
        +- *test declarations*

mouse right click: refresh from disk "@auto test.js"
log says:

@verbatim is not a Leo directive: test declarations
undefined section: << some text >>
referenced from: test declarations
error: @auto did not import @auto test.js perfectly
first mismatched line: 4 (original) = 4 (imported)
@verbatim is not a Leo directive: test declarations
undefined section: << some text >>
referenced from: test declarations

<Ctrl> Save

log says:

not written: /home/aaa/tmp/tstLeo/test.js
saved: workbook.leo
====

Added some comments "// test asdf" to node "test declarations"
content:
var text1 = '<< some text >>';  // test asdf

<Ctrl> Save -> OK

====
Close the workbook.leo tab

====

Having a look at the "real" directory structure it shows

/tstLeo
 |
 +- test.js
 +- test.js.tmp

test.js content isn't changed -> OK
test.js.tmp contains no code just the comment -> ?????

====

Open file with:  Menu: File: Recent: workbook.leo

outline says:

* @path ~/tmp/
|
+- /tstLeo/
    +- @auto test.js
        +- test declarations
        +- test declarations

- the first "test declarations" contains the "leo node content"
- the second node contains the file test.js content.

- both are different. ?!?!

----
log says:

Leo Log Window
Leo 4.9.1 devel, build 4867, 2011-12-05 06:57:18 -0500
Python 2.7.2, qt version 4.7.3
linux2
reading: /home/aaaa/.leo/workbook.leo
reading: @auto test.js

@verbatim is not a Leo directive: test declarations
undefined section: << some text >>
referenced from: test declarations
@verbatim is not a Leo directive: test declarations
undefined section: << some text >>
referenced from: test declarations
error: @auto did not import @auto test.js perfectly
first mismatched line: 4 (original) = 4 (imported)
Original file...

   2 u'*/\n'
   3 u'\n'
   4 u"var text1 = '<< some text >>';\n"
   5 u'\n'

Imported file...

   2 u'*/\n'
   3 u'\n'
   4 u'\n'
   5 u'\n'
inserting @ignore
errors inhibited read @auto /home/aaa/tmp/tstLeo/test.js

=====
 --- Test stopped ---
=====

As I wrote at the beginning, the above is a simplified testcase to
track down the "magic behaviour".

The first time I ran into this I did use a "real project" structure.
It took me hours to see the "inserting @ignore". message in the log
pane. I'm a _newbie_. I simply didn't see it ;)  It took much time to
figure out, why I couldn't reproduce the strange behaviour again.
(Because @ignore, suppressed it)

It took me hours again (reading this group and the leo documentation)
to find out that:

      var text1 = "<< some text >>";

can't be @auto imported/exported into a leo outline without troubles
or deep knowledge.

The point is:
 - I can't beleve it. What am I missing?

help appreciated
-mario


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

Reply via email to