Hello everybody! I wrote my first emacs extension: [csharpto.el](https://github.com/mabo3n/csharpto.el)
Basically it introduces [Evil](https://github.com/emacs-evil/evil) text objects for functions (and now generic "scopes") of the CSharp language. They still don't support the count argument and the current region, but they work fine for the trivial cases and are already saving me lots of keystrokes. Hope they are useful to someone else!
Oh, and as I was learning and doing at the same time, I'm pretty sure lots of things can be improved. I'm open for your feedback and suggestions! Thanks.
## A bit of background
About 2.5y ago I was using C# and Visual Studio at work, and after playing around with Vim for a few months I got to know this Evil mode thing and decided to give Emacs a try (or more specifically, Spacemacs). Since then, I've been learning how to, and using it in my daily activities.
One thing that I always missed is the ability to select a whole function in C#, but I thought I just didn't know the right package or it was something trivial to do ad-hoc. Surprisingly, up to these days I still couldn't find anything. I bumped into the [expand-region](https://github.com/magnars/expand-region.el) package at some point, which is awesome, but still something was missing. After going through the [Emacs Lisp Intro](https://www.gnu.org/software/emacs/manual/eintr.html) tutorial, I learned a bit how to search things in a buffer, and I was also editing csharp files every day, so I decided to try to implement the functions myself. Fast forward some weeks, here I am, with a smile on my face :)
## What I learned
I could put my hands on several things I wanted to learn:
- Doing things the emacs way: using the standard functions, playing with plists/alists, macros and backquotes, keybindings and keymaps, etc.
- Using the edebug: this is essential. I should have learned earlier, would have saved me some headaches.
- Learning the rx syntax for regexps: this is surprisingly good! I was reluctant to learn the syntax at first, but now I use it whenever I can. No more backslash hell.
But also ended up letting some things aside that I was interested in:
- ert: I was going to start writing tests with it, but I skipped the info pages and decide to write a custom, rudimentary test framework for my use cases instead.
- Packaging and distributing: I need to learn how to set a CI environment to run tests, and how one publishes a package.
- Getting to know more how Evil works: I certainly would have done things differently if I dedicated time to learn Evil better before started coding (but it wouldn't be as funny).
- Faces and Overlays: I see these everywhere but don't know how to use them. Maybe next time...
Overall I'm very satisfied with my progress, and now I feel much more confident in trying to hack things I want with elisp. Hopefully in the future I will be able to each time make more meaningful contributions to the community.