>
>
>>> If you put the following code into a node with the headline `@button 
> clone-to-calendar @key=Alt-4`:
> v = p.v
> cal = c.find_h('Calendar')[0]
> cal_v = cal.v
> if cal_v not in v.parents:
>     cal_v.children.append(v)
>     v.parents.append(cal_v)
>     cal_v.children.sort(key=lambda x:x.h)
>     c.redraw()
>

Yes. The code works. I put it under one @command button, and I can use a 
shortcut key to clone current node.  Like a magic!

I'm trying to optimize it by adding an abbreviation.  I put below to 
my @data abbreviations

cal;;={|{

\:v = p.v

\:cal = c.find_h('Calendar')[0]

\:cal_v = cal.v

\:if cal_v not in v.parents:

\: cal_v.children.append(v)

\: v.parents.append(cal_v)

\: cal_v.children.sort(key=lambda x:x.h)

\: c.redraw()

\:}|}


I am expecting when I key in cal;;, the node will be automatically cloned. 
So I will not need to lose my focus when editing the meeting node body. 

However, the cal;; is not working as my expected. The editor must 
understood cal;; since I cannot key in another ';' after cal;;.


Do you know is there any limitation to implement such logic inside an 
abbreviation?


Thanks Again.


BR,Austin




-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/d6ff9103-6fc9-4dd8-8530-2b3638171d6e%40googlegroups.com.

Reply via email to