May 14th, 2009
Deliver us from TextMate, vi, and emacs.
Some years ago, we would have followed TextMate to whatever end. Now, however, we see that TextMate was a false prophet. He led us down a garden path but abandoned us before we reached the promised land. In our desperation, we turned to the elder sages: vi and emacs. Alas, they seem curiously unaware that it’s 2009. You know: 2009. The year before the year we make contact.
Editor Gods, we don’t ask for much. We just want an editor that makes us stand up and shout: “Hey! The future is here, and I’ve got a text editor to prove it!”
While we’re praying, we might as well let you know exactly what our hearts yearn for.
(more…)
January 7th, 2009
Here’s a much simpler way to get emacs to behave nicely with ⌘-] and ⌘-[. Add the following to your .emacs, modifying the code to use the appropriate keymap for your build of emacs:
(define-key osx-key-mode-map (kbd "A-[")
(lambda () (interactive)
(indent-rigidly (region-beginning) (region-end) (- tab-width))
(setq mark-active t deactivate-mark nil)))
(define-key osx-key-mode-map (kbd "A-]")
(lambda () (interactive)
(indent-rigidly (region-beginning) (region-end) tab-width)
(setq mark-active t deactivate-mark nil)))
The key is the magic invocation of (setq mark-active t deactivate-mark nil) which ensures that, regardless of whether you’re using transient-mark-mode or not, the region will stay visibly highlighted after you’ve performed the indentation. It turns out that deactivate-mark is a defsubst designed to make this sort of thing easy on the developer. It even invokes the necessary hooks.