New on (M)Elpa: speed-of-thought-lisp02 Feb 2015, by Artur Malabarba.
New on Elpa post series
- New on (M)Elpa: speed-of-thought-lisp
- New on Elpa: Spinner.el, mode-line spinners and progress-bars
When your computer is feeling slow and you decide to upgrade it, where do you start? You start by finding the bottleneck, of course. That awesome CPU won't do you any good with crappy RAM disk. The same logic holds for your coding skills.
Whenever you're writing code, there are two main processes going on —this is a very rough model, but it gets the job done.
- You think of what you'll write,
- and you write it.
As you become more experienced with a language, the first part gets faster and easier, to the point where you can immediately envisage the solution to any problem you encounter. On the other hand, your actual writing speed is much slower to improve, and caps at a very disappointing maximum.
The solution? Upgrade the bottle-neck, i.e., your hands.
sotlisp) is all about helping your hands keep up with your brain. The mode
itself is quite simple, it provides two sets of tools to help your fingers follow
your thought-flow. To turn it on, just issue M-x
While you're at it, make sure you've got something like
sotlisp is a lot more fluid with these.
Minimal typing with abbrevs
A large number of intelligent abbrevs which expand a function's initials to its name. A few examples:
- i →
- a →
- r →
- wcb →
- efn →
It's pointless to list all of them here, there are 136 of them at the moment.
The whole purpose of these abbrevs is that you don't need to learn them. Instead
insert SPC or maybe
ins TAB, you just write
i SPC for the same
effect. You'll be surprised how quickly this abbreviations become more natural
to you than the actual names.
And before you start worrying, these are defined in a way such that they only
expand in a place where you would use a function. So hitting SPC after
(require ', but hitting SPC after
(delete-region r will not expand
r, because that's obviously not a function. You can safely use short
variable names without running into conflicts.
You may I have noticed I've only mentioned functions. Variable abbrevs are on the way!
It also defines 4 commands, which fit tightly into this “follow the thought-flow” way of writing.
- Break line and insert
()with point in the middle.
forward-up-listthen do the above.
Hitting RET followed by a ( was one of the most common key sequences for me while writing elisp, so giving it a quick-to-hit key is a significant improvement.
- C-c f
- Find function under point. If it is not defined, create a definition for it above the current function and leave point inside.
- C-c v
- Same, but for variable.
With these commands, you just write your code as you think of it. Once you hit a
“stop-point” of sorts in your thought-flow, you hit C-c v on any undefined
variables. Then you just write its definition, and hit C-u C-SPC
pop-global-mark) to go back to where you were.
sotlisp is floating around the Elpas, so you can issue the usual M-x
sotlisp, and activate it in your init file.
Then you'll be able to do magic such as writing
Also coming up is a
sotlatex package and perhaps even a