Somehow, by accident, 2018 has become the year of Emacs. I did write about some Emacs improvements I was doing, but it seems to be something I have come back to time after time. My latest work project is a large, mostly-standard Java app with some Spring sprinkled in here and there. I'm using Magit for using all my Git interfacing, which I never thought would happen – I always did the heavy work on the command-line but find Magit much more friendly now. For coding, I'm moving back and forth between Emacs and Intellij. Intellij still does a lot of nice things (like auto-import, syntax checking, etc) but I can type faster in Emacs. And, since this codebase is large and, er, not necessarily well arranged, Intellij can be slow with it. But Emacs with
gradle-mode let's me do the TDD things much faster.
All this to say – last week I ascended onto even a higher level of Emacs karma.
Our dev team is transitioning between from Windows to Mac and some are still pedaling away on their Windows machines. This causes our commit-hook to put our ticket name (which comes from the branch name) to go from working to non-working on the Mac, because of permission issue. If I fix it, the next pull may break it. So I'm having to remember to put it in, which, so you know, just isn't going to happen. On a check-in last week, I noticed that Magit has the branch name in the comments when making a commit message. I thought "I could make a keyboard macro that uses the branch name to put in the ticket name." So I quickly created it and tested it out – it worked fine. I didn't know how, but knew I could save it for later. Sure enough I could but first I had to name it – so that was a quick
C-x C-k n . I had already setup emacs-bind-map to make my own prefix to put come shortcuts. Of course, I had to run
insert-kbd-macro to put in the Elisp code and the named function (the code looks like gibberish… mostly numbers) and then assigned it in my
This is not rocket science, especially for Emacs but my shift in thinking of simply thinking "I know I can do this… let's figure it out" as opposed to "I wish I could…" or simply googling for someone's blog post.