Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Wednesday, March 31, 2010

There's a way to do that in emacs

Given a number of lines of text such as

foopy charlie
foo bravo
food alpha

and you want to sort them by their second field so they end up like

food alpha
foo bravo
foopy charlie

the right emacs incantation is:

C-u 2 M-x sort-fields

That's all.

Wednesday, March 17, 2010

Ambiguity everywhere

I use emacs for writing code, which is considered a bit old-school by many Java programmers. One of them recently commented that "watching someone use emacs is like watching ballet". Was that a compliment or not? "Graceful" and "efficient" come to mind, but maybe he just doesn't like watching ballet.

Wednesday, May 14, 2008

Emacs, OS X and the EDITOR variable

This took a bit of fiddling to get right, so I offer it up to the Great Google Index with the hope that it may save someone else some time. The EDITOR environment variable is what is used by Unix applications (such as Subversion and git) when they want to start an editor for input. Starting emacs from the command line in OS X uses the open command.

To get this working with emacs and OS X Leopard I had to make the file /usr/bin/emacs contain:

#!/bin/sh
open -nWa /Applications/Emacs.app/Contents/MacOS/Emacs "$@"

This opens a file using a new instance of emacs and waits until emacs exits.