June 24, 2010
Here’s a really useful Emacs tip that is easy to miss.
All Emacs users know that C-SPC sets the mark (set-mark-command). But not everybody knows that the mark is not a single value. Every time a new mark is set, it is also pushed to the mark ring. The really useful thing about this is that you can move back through that ring by giving a prefix argument to set-mark-command.
will take you back to the previous place you set the mark. It turns out that this is often what you want. For example, this could be where you last yanked a block of text or started an isearch. If you want to go back further, just repeat the jump.
An example: Say I’m editing somewhere in the middle of a long file and want to do an isearch from the beginning of the buffer. The sequence of commands would then be:
M-< (sets the mark, then jumps to beginning of buffer)
C-s (do the isearch, will also set the mark unless cancelled)
Make a few changes
C-u C-SPC C-u C-SPC (jump to previous mark twice)
I should mention that there are in fact two mark rings in Emacs: A local and a global one. Local and global in this context refers to buffer – the local ring is a per-buffer ring, the global one is across buffers.
You can backtrack along the global one with pop-global-mark:
The and global mark rings are described in sections 11.4 and 11.5 of the Emacs manual.
June 20, 2010
Today I was going through some trouble setting up an existing Rails project I need to do some work on.
The project uses the Postgres database and Sphinx to provide search functionality. Installing Postgres is easy using the official DMG. Installing Sphinx using Homebrew is also very easy:
sudo brew install sphinx
That should be it, right? Unfortunately, not quite. This did install Sphinx, but without Postgres support. If you build TS yourself, Postgres support is enabled by adding the –with-psql option when calling ./configure. I looked through the brew documentation but didn’t find any way of passing this option to the configure command that brew executes.
Finally, it occurred to me to look into the brew “formula” for Sphinx. This is just Ruby code, and the source of the problem was easy to spot: It turns out that the formula installs Postgres support automatically if it detects that Postgres is installed. The problem was the method it used for detecting this:
config_args << “–with-pgsql” if `/usr/bin/which pg_config`.size > 0
June 15, 2010
I’m sure the actual training will be really good, because I know that both Lau Jensen and Christophe Grand are very competent. But perhaps more importantly, having three days away from work and family will allow me to really concentrate on learning Clojure, including all the surrounding stuff.
I have been reading a lot about the language already, so I hope we’ll be covering all the small things that make Clojure a practical language to use (probably more so than Haskell, Erlang etc.). Project setup, unit testing and so on. These are the kinds of things about a new programming language that require a few days to grasp – to actually get a feel for how it is to use the language on non-trivial projects.
By the way, there are still seats available. Anybody want to join us?