I have an @command X executed by selecting a menu item. X wants to change the selected node.

28 views
Skip to first unread message

SegundoBob

unread,
Feb 26, 2022, 4:36:22 PM2/26/22
to leo-editor
cmdr.selectPosition(posX) has immediate effect when executed by Ctrl+B, but it has NO observable effect when executed in an @command function invoked by a menu item.

Is there any way to do what I want to do?

SegundoBob

tbp1...@gmail.com

unread,
Feb 26, 2022, 5:06:03 PM2/26/22
to leo-editor
You have got to get the new_position argument to the command.  There's a method for a command to get arguments from the minibuffer, but I've never used it so I can't give you the details.  Someone else could chime in here ...

Edward K. Ream

unread,
Feb 28, 2022, 8:18:09 AM2/28/22
to leo-editor
On Sat, Feb 26, 2022 at 4:06 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
You have got to get the new_position argument to the command. 

And you may have to call c.redraw to recalculate positions. Note that c.redraw(new_position) will set c.p.
There's a method for a command to get arguments from the minibuffer, but I've never used it so I can't give you the details.  Someone else could chime in here ...

Not to my knowledge. There is an issue, marked either "Maybe" or "Won'tDo" to that effect.

Edward

tbp1...@gmail.com

unread,
Feb 28, 2022, 8:36:39 AM2/28/22
to leo-editor
I'm thinking of the way you can enter a search  in the minibuffer during a find-all command, for example.

Edward K. Ream

unread,
Feb 28, 2022, 10:03:07 AM2/28/22
to leo-editor
On Mon, Feb 28, 2022 at 7:36 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:

There's a method for a command to get arguments from the minibuffer, but I've never used it so I can't give you the details.  Someone else could chime in here ...

Not to my knowledge. There is an issue, marked either "Maybe" or "Won'tDo" to that effect.

I'm thinking of the way you can enter a search  in the minibuffer during a find-all command, for example.

I see. You refer to c.interactive, etc.

Edward

SegundoBob

unread,
Feb 28, 2022, 4:14:44 PM2/28/22
to leo-editor
Thank you, tbp1 for responding.  Unfortunately, if I understand you, you totally misunderstood me.  If you understood me, I totally misunderstood you. Perhaps we each misunderstood the other.

I've resolved my problem which was not what I thought it was.  Two things were happening:

1) Bit rot in my code caused by no longer allowing cmder.setChanged() to have one argument.  Consequently, some of my code that had been working for years was no longer able to set the selected position as observed by the operator after my code executed.  This was because I was calling cmdr.setPosition() right after calling cmdr.setChanged().  Since now cmdr.setChanged() was causing an exception (which was never shown to the operator, so I didn't know there was an error), the cmdr.setPosition() was no longer called.

2) In another case, I was intentionally raising an exception after calling cmdr.setPosition().  While it is surprising to me that raising an exception in some sense "undoes" the cmdr.setPosition(), I have no objections to this.

Thanks.  So far as I'm concerned this thread is finished.

SegundoBob

tbp1...@gmail.com

unread,
Feb 28, 2022, 6:12:42 PM2/28/22
to leo-editor
Yup, I definitely didn't pick that up from your original post!
Reply all
Reply to author
Forward
0 new messages