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. speed-of-thought-lisp
(or 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-xspeed-of-thought-mode.
While you're at it, make sure you've got something like electric-pair-mode or
paredit active, 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 → insert
a → and
r → require '
wcb → with-current-buffer
efn → expand-file-name
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
of typing 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 (r
gives (require ', but hitting SPC after (delete-region r will not expand
the 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!
Speedy keybinds
It also defines 4 commands, which fit tightly into this “follow the
thought-flow” way of writing.
M-RET
Break line and insert () with point in the middle.
C-RET
Do forward-up-list then 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.
Conclusion
sotlisp is floating around the Elpas, so you can issue the usual M-xpackage-installRETsotlisp, and activate it in your init file.
Then you'll be able to do magic such as writing
by typing (wtbM-RETiSPCtextC-RETbsSPC.
Also coming up is a sotlatex package and perhaps even a sotclojure.
New on (M)Elpa: speed-of-thought-lisp
02 Feb 2015, by Artur Malabarba.New on Elpa post series
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.
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.
speed-of-thought-lisp
(orsotlisp
) 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-xspeed-of-thought-mode
. While you're at it, make sure you've got something likeelectric-pair-mode
orparedit
active,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:
insert
and
require '
with-current-buffer
expand-file-name
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 of typing
insert SPC
or maybeins TAB
, you just writei 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
(r
gives(require '
, but hitting SPC after(delete-region r
will not expand ther
, 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!
Speedy keybinds
It also defines 4 commands, which fit tightly into this “follow the thought-flow” way of writing.
()
with point in the middle.forward-up-list
then 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.
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.Conclusion
sotlisp
is floating around the Elpas, so you can issue the usual M-xpackage-install
RETsotlisp
, and activate it in your init file.Then you'll be able to do magic such as writing
by typing
(wtb
M-RETi
SPCtext
C-RETbs
SPC.Also coming up is a
sotlatex
package and perhaps even asotclojure
.Tags: package, lisp, programming, emacs,
View the Change-Log for packages before upgrading, with Paradox »
« Implementing comment-line
Related Posts
Turbo up your Ruby console in Emacs in programming
It’s Magit! And you’re the magician! in package
A few paredit keys that take over the world in programming
Content © 2019, All rights reserved. Icons under CC3.0.