Wednesday, July 16, 2008

Setting Defaults Properly

Problem: I have a new developer who wants to check something into Subversion. He tries, and is mystified by svn's message, telling him he has to set the environment variable $EDITOR.

Solution: I tell him to set the environment variable.

(Okay, this should read "Problem: My software developers can't read." It's still a problem.)

git, in contrast, has this one figured out. From the git-config man page:
core.editor
Commands such as commit and tag that lets you edit messages by
launching an editor uses the value of this variable when it is set,
and the environment variable GIT_EDITOR is not set. The order of
preference is GIT_EDITOR environment, core.editor, VISUAL and
EDITOR environment variables and then finally vi.
Yes, it isn't quite grammatical. The author's Finnish. Give him a break. "... and then finally vi." This because every Posix-conforming system is required to have a text editor named vi that acts according to the IEEE spec. (It can be a superset, like gvim, but it has to respond correctly to the basic commands.)

Richard Stallman and the FSF were asked for an emacs spec to put into Posix (Stallman named Posix, by the way), but they refused, so there's no guarantee that a Posix-conforming system will have it, out of the box.

No comments: