Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve counsel-M-x-transformer key lookup #1534

Merged
merged 3 commits into from Apr 23, 2018

Conversation

basil-conto
Copy link
Collaborator

@basil-conto basil-conto commented Apr 23, 2018

Issue

counsel-M-x-transformer unconditionally replaces C-x6 with F2 in the key description, without checking that the latter is still a valid binding.

Recipe

  1. make plain
  2. (global-set-key [f2] #'ignore)
  3. C-j
  4. M-x2C-command
    • Expected annotation: C-x6
      Screenshot after
    • Actual annotation: F2
      Screenshot before

Performance

Compared to the incumbent counsel-M-x-transformer, the final version in this PR is up to twice as fast and never slower, regardless of C-x6 replacement. The key-description -> kbd round trip, by contrast, is up to twice as slow as the incumbent. I think this justifies the only slight increase in algorithmic complexity.

basil-conto added 3 commits Apr 23, 2018
counsel.el (counsel-M-x-transformer):
Only replace C-x 6 with <f2> when their definitions are equal.
Reduce number of strings created.
Avoid the key-description -> kbd round trip.
@basil-conto
Copy link
Collaborator Author

@basil-conto basil-conto commented Apr 23, 2018

Compared to the incumbent counsel-M-x-transformer, the final version in this PR is up to twice as fast and never slower, regardless of C-x6 replacement. The key-description -> kbd round trip, by contrast, is up to twice as slow as the incumbent. I think this justifies the only slight increase in algorithmic complexity.

Of course, an even simpler approach would be to get rid of the C-x6 replacement, but I assume you still want that. :)

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Apr 23, 2018

I assume you still want that. :)

Correctly assumed:)

@abo-abo abo-abo merged commit 5ac2fd4 into abo-abo:master Apr 23, 2018
1 of 2 checks passed
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Apr 23, 2018

Thanks.

@basil-conto basil-conto deleted the blc/lookup-key branch Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants