On Wed, Apr 14, 2021 at 11:14 AM Jacob Peck <[email protected]> wrote:

> I'm stuck on how to get myHeadline -- 'p' is of course the position of
the currently selected node, not the @rclick itself.  Is there some API to
grab the position (or vnode?) of the executing script?

Yes. It's a bit of an Easter Egg, but it is documented.

@rclick print-hi @args=print-hi

g.cls()
print('rclick hi: %s' % c.p.h)
print('dir()', dir())
print(script_args)
print(script_gnx)

prints:

rclick hi: @rclick say-hi @args=say hi
dir() ['__builtins__', '__name__', 'c', 'g', 'input', 'p', 'script_args',
'script_gnx']
['say hi']
ekr.20210414174148.1

The calling tree is:

sc.handleAtRclickNode (handles @rclick)
sc.getArgs  (handles @args)
sc.registerAllCommands
c.executeScript
c.executeScriptHelper (injects script_args and script_gnx)

HTH.

Edward

-- 
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/CAMF8tS2Ld1TRcJKLVZ9NdTV7bcsSY5ywcQ0MAzuYhrpwqtwkbQ%40mail.gmail.com.

Reply via email to