I've been reading about the differences between frameworks and libraries. And I noticed that some of the issues with frameworks are the same issues that we encounter in some build tools such as Ocamlbuild or even make. So I started experimenting on the design of a build library, by opposition of a build framework. It's just an experiment; I did not make yet another build system. But I find the results interesting.
Lately I've been experimenting with
js_of_ocaml (from Ocsigen)
and I have developed
a small library to help me write client-side browser applications.
The library is called Funweb (for Functional Web) because imagination
is hard. It is available on GitHub.
Browser applications have two sides: the description of the user interface, which is a DOM tree, and the code which actually does stuff. Graphical User Interface (GUI) programming can be messy when the two are interleaved, especially if the user interface itself can be the result of computations.
There is an underlying idea in my previous articles: if you have to repeat some actions often, automate the process. Previous articles focused on long-term improvements though. Is it worth it to automate a task that you will only use a few times and then never again? It is, but only if the process of automating is very cheap. This is where macros shine; or, the almost magical multiple-cursor alternative.
How do you move through the document you are editing?
Do you use the mouse? Do you use the arrow keys?
Knowing standard shortcuts such as
Ctrl+Home can make a big difference.
But there is one secret to move faster, which is to shorten the delay
between two repetitions of the same key.
I run Emacs fullscreen and have enough room for three buffers next to each other, the first two being 80-character wide and the last one being 74-character wide.
Setting this up correctly took me a few years. I did it incrementally.
First I used
C-x 3 manually. Then I automated the process of splitting.
After a while I noticed how painful some tasks where. For instance,
*compilation* window would use any column in a seemingly random
fashion, or maybe even split an existing one in half, screwing the
whole layout. I also noticed that it was very convenient to be able
to swap or clone columns.
I finally have something I am confortable with. You can download it here. I will explain its features and how I use it. I will also go into the code in details, to serve as a tutorial.
Once in a while I show my Emacs configuration file (
a friend and there is always something that they didn't know or for
which they have a better solution. So I thought I would go through my
.emacs and extract the most useful, general parts of it to share
them with you. This should be an interesting read even if you don't use
Emacs, as you may want to try to apply them to your own favorite editor.
Or maybe you have a more elegant solution?
CDPATH is a very convenient feature, yet it is ignored by many Linux
users. It is similar to PATH, but for the
cd command instead of the
"run this program" command. It allows to type, say:
even if the current directory is not