First time here? Check out the FAQ!
-1

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?

Mitchell L Model's avatar
13
Mitchell L Model
asked 2018-12-30 11:29:00 -0600
Wingware Support's avatar
4k
Wingware Support
updated 2019-03-13 10:25:55 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

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.

Wingware Support's avatar
4k
Wingware Support
answered 2018-12-30 16:50:00 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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?

Mitchell L Model's avatar
13
Mitchell L Model
answered 2018-12-30 19:26:00 -0600
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-06 22:27:11 -0600
edit flag offensive 0 remove flag delete link

Comments

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

Wingware Support's avatar Wingware Support (2019-01-02 09:37:00 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer