Skip to content

some nice scala defaults #673

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

Closed
wants to merge 2 commits into from
Closed

some nice scala defaults #673

wants to merge 2 commits into from

Conversation

fommil
Copy link
Contributor

@fommil fommil commented Nov 8, 2016

this is a WIP because I'm not sure how to write the tests correctly:

  • execute-kbd-macro is inserting text explicitly, and not triggering the special rules
  • I don't know how to test the region wrapper. Do you have syntax for that or should I use set-mark?

@Fuco1
Copy link
Owner

Fuco1 commented Nov 9, 2016

execute-kbd-macro should trigger everything the same way as if you were typing it, we use it all over in the tests. If it doesn't work there might be some problem with the setup.

As for tests, 99% can be covered with sp-test-with-temp-buffer, check the docstring (it's in test/test-helper.el) and just grep the test folder for usage. Tldr | in the input represents point and M (capital m) represents mark...

@Fuco1
Copy link
Owner

Fuco1 commented Nov 9, 2016

With execute-kbd-macro don't forget to wrap with kbd if you use special syntax, for example

(execute-kbd-macro (kbd "DEL"))

Would excute "delete" key but

(execute-kbd-macro "DEL")

would just write the letters DEL literally.

@fommil
Copy link
Contributor Author

fommil commented Nov 9, 2016

of course 😄 I'll update later tonight when I get home from work. Helps to keep my mind of the world that is burning around us.

@fommil
Copy link
Contributor Author

fommil commented Nov 9, 2016

I updated the PR but I don't think that changes the way the execute-kbd-macro works. e.g. (kbd "SPC") just returns " ".

@Fuco1
Copy link
Owner

Fuco1 commented Nov 9, 2016

The problem might be with the conditional handlers... I'm not sure we have tests for that yet. I'll try to look at that as well.

@fommil
Copy link
Contributor Author

fommil commented Jul 1, 2017

I also completely forgot about this.

@fommil
Copy link
Contributor Author

fommil commented Jul 1, 2017

hmm, I never worked out what was going on here. AFAIK it should be passing ... did you ever find the time to look into what the problem could be?

@Fuco1
Copy link
Owner

Fuco1 commented Jul 1, 2017

I'm going to right after your other PR. I feel terrible now having it lying here for so long. I'm on vacation now which is the best time for hacking! Thanks for your patience.

@fommil
Copy link
Contributor Author

fommil commented Jul 1, 2017

it's ok I think I have these in my personal config so I haven't been missing out 😄 the ability to hack my own emacs sometimes makes me lazy at implementing features properly in my own projects and then I talk to people who ask "can you make it do X?" and I'm like "it already does X, what do you mean? oooooh... that one is in my .emacs.d/lisp folder"

@Fuco1
Copy link
Owner

Fuco1 commented Jul 1, 2017

I feel the same way about my flycheck hacks :/ Still, I've read a nice blog about optimistic merging recently and I would like to start following that. It engages people a lot better.

@Fuco1
Copy link
Owner

Fuco1 commented Jul 1, 2017

Turns out kbd and execute-kbd-macro are quite picky.

You need to execute the entire thing in one call to execute-kbd-macro otherwise the events won't come to the handler as during the real execution (probably some edebug or other command gets executed inbetween breaking the simulation). Also, literal space characters are removed from kbd spec and all the special chars delimited by spaces are translated. So you end up with something like

(execute-kbd-macro (kbd "{ RET f SPC => SPC f.toString"))

which "types" {\n f => f.toString

I had to dig a bit into Emacs to get to the bottom of this. Reading code always works :D

@fommil
Copy link
Contributor Author

fommil commented Jul 1, 2017

Wow, that's really bizarre. We should add this to a comment to save some poor soul from suffering in the future.

@Fuco1
Copy link
Owner

Fuco1 commented Jul 1, 2017

Closed in 10657cc.

Thanks for the contribution!

@Fuco1 Fuco1 closed this Jul 1, 2017
@Fuco1
Copy link
Owner

Fuco1 commented Jul 1, 2017

We should add this to a comment to save some poor soul from suffering in the future.

Good point, I will add it to the testing page on the wiki as well.

@Fuco1 Fuco1 removed their request for review July 1, 2017 21:23
@Fuco1
Copy link
Owner

Fuco1 commented Jul 1, 2017

@fommil
Copy link
Contributor Author

fommil commented Jul 1, 2017

Thank you again! Need to find myself some time to hack on some Emacs lisp soon. Been missing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants