# forward-definition and backward-definition?

For many years my custom keybindings have contained bindings for forward-definition and backward-definition. Yet, those editor commands do not exist (v. 6.1), and they are not in any of my scripts files..

I am perplexed, because I shouldn't be able to bind a key to a command that doesn't exist (at least not using the Preferences dialog — I do sometimes edit the preferences file directly, but this doesn't seem like how I would have assigned keys to these particular definitions). Furthermore, as a (very, very) long-time Emacs user, where I use that command often, this is a command I think would use fairly regularly in Wing. (I am using Wing for the first time in quite a while, so I may just be confused or misremembering.) Did they ever exist? Where did they go?

edit retag close merge delete

Sort by » oldest newest most voted

I don't see any evidence that they ever existed.  We log any changes to command set in the CHANGELOG.txt file and nothing seems to match this.  It might be that in the past we allowed entering non-existent command names in the prefs dialog or you had a script that implemented this.

more

Well, "they are not in any of my scripts files" is not quite accurate. It wasn't in my version 6 scripts, and it wasn't in my version 5 scripts, but it was in my version 4 scripts!. I have always carried my preferences file over from version to version, so yes, I once had these defined and therefore was able to bind keys to them, so they were left in my preferences file.

I guess I'm wrong about having used this often in Wing, at least not for a very long time. My guess is that instead of trying to use these, I just used select-scope, then forward-character or backward-character to enter a different definition.

The way I had implemented long ago  was contorted and used internal calls that may even exist anymore. Simple definitions that more or less do what I want are:

def backward_definition():
""" Move backward to the def or class prior to current line"""
ed = wingapi.gApplication.GetActiveEditor()
ed.ExecuteCommand('previous_scope')
ed.ExecuteCommand('backward-char')           # clear selection

def forward_definition():
""" Move forward to the def or class following the current line"""
ed = wingapi.gApplication.GetActiveEditor()
ed.ExecuteCommand('next_scope')
ed.ExecuteCommand('backward-char')           # clear selection


Is there a cleaner way to clear the selection than just using backward-char?

more

Using backward-char seems like the right way to do it.

( 2019-01-02 09:37:00 -0500 )edit