Skip to content

some nice scala defaults - #673

Closed
fommil wants to merge 2 commits into
Fuco1:masterfrom
fommil:scala
Closed

some nice scala defaults#673
fommil wants to merge 2 commits into
Fuco1:masterfrom
fommil:scala

Conversation

@fommil

@fommil fommil commented Nov 8, 2016

Copy link
Copy Markdown
Contributor

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

Fuco1 commented Nov 9, 2016

Copy link
Copy Markdown
Owner

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

Fuco1 commented Nov 9, 2016

Copy link
Copy Markdown
Owner

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

fommil commented Nov 9, 2016

Copy link
Copy Markdown
Contributor Author

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

fommil commented Nov 9, 2016

Copy link
Copy Markdown
Contributor Author

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

Fuco1 commented Nov 9, 2016

Copy link
Copy Markdown
Owner

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

fommil commented Jul 1, 2017

Copy link
Copy Markdown
Contributor Author

I also completely forgot about this.

@fommil

fommil commented Jul 1, 2017

Copy link
Copy Markdown
Contributor Author

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

Fuco1 commented Jul 1, 2017

Copy link
Copy Markdown
Owner

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

fommil commented Jul 1, 2017

Copy link
Copy Markdown
Contributor Author

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

Fuco1 commented Jul 1, 2017

Copy link
Copy Markdown
Owner

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

Fuco1 commented Jul 1, 2017

Copy link
Copy Markdown
Owner

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

fommil commented Jul 1, 2017

Copy link
Copy Markdown
Contributor Author

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

@Fuco1

Fuco1 commented Jul 1, 2017

Copy link
Copy Markdown
Owner

Closed in 10657cc.

Thanks for the contribution!

@Fuco1 Fuco1 closed this Jul 1, 2017
@Fuco1

Fuco1 commented Jul 1, 2017

Copy link
Copy Markdown
Owner

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

Fuco1 commented Jul 1, 2017

Copy link
Copy Markdown
Owner

@fommil

fommil commented Jul 1, 2017

Copy link
Copy Markdown
Contributor Author

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