The command snippet appears to work fine if you do not deref `ed`... in 
other words:

(cmd/command {:command :user.say-hello
              :desc "User: Say Hello"
              :exec (fn []
                      (let [ed (lt.objs.editor.pool/last-active)]
                        (lt.objs.editor/center-cursor ed)))})

should suffice. I was able to successfully use the command to bring the 
viewport back to the cursor and have the cursor be on the center line. 
Perhaps there was an issue with the command not being refreshed after 
compiling changes? If so, you should be able to reopen Light Table and have 
the modified command available.

As for full documentation, that is still a work in progress. The gitbook 
link you provided should eventually contain sufficient plugin development 
docs. There is also an incomplete API available to view at 
http://lighttable.github.io/LightTable/api/ . We plan to expand both this 
year.

Hope that helps,

Scott


On Monday, February 20, 2017 at 11:44:04 AM UTC-5, Max Muranov wrote:
>
> I think it's a usual sutiation: I haven't found one useful function in the 
> light table and want to write it myself. It's a simple function and I want 
> to just put it to user script. 
>
> Found this quick start guide for plugin development: 
> https://lighttable.gitbooks.io/light-table-developers-guide/content/user-plugin.html
> Okay but... What about full documentation? I want to use functions that 
> are not in this guide. 
>
> I didn't found something similar to functions docs and assumed that I can 
> find them in the sources. 
>
>
> https://github.com/LightTable/LightTable/blob/master/src/lt/objs/editor.cljs
> I found a function in this file and tried to do something simpliest:
>
> (cmd/command {:command :user.say-hello
>               :desc "User: Say Hello"
>               :exec (fn []
>                       (let [ed (lt.objs.editor.pool/last-active)]
>                         (lt.objs.editor/center-cursor @ed)))})
>                       ;;;;;;;;;;;;(tabs/add-or-focus! hello))})
>
> And this causes an exception "TypeError: 
> lt.objs.editor.__GT_cm_ed.call(...).getCursor is not a function". 
>
> What am I doing wrong? And where can I find something similar to plugin 
> development docs? Help, I can't understand anything =D
>

-- 
You received this message because you are subscribed to the Google Groups 
"Light Table Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to