Thursday, October 21, 2010

How to Disable Ubuntu command-not-found

Ubuntu, in all its helpfulness, has a feature that tries to guess what you mean when you type commands at the bash prompt. If you type a command that's found, it runs it, of course. If you type a command that it can't find, it takes a moment to search available packages for install and suggest what you might do to make that command available. It sometimes looks like this:

$ foo
No command 'foo' found, did you mean:
 Command 'xoo' from package 'xoo' (universe)
 Command 'fop' from package 'fop' (universe)
 Command 'fox' from package 'objcryst-fox' (universe)
 Command 'zoo' from package 'zoo' (universe)
 Command 'goo' from package 'goo' (universe)
foo: command not found
It's great when you have a new system and you haven't yet installed everything you need. Type emacs before emacs has been installed, and it will helpfully tell you the exact command to use to install it. After a while, though, you have all the packages you need, and the only time you see this feature in action is when you mistype something. When this happens to me, all the package suggestions and apt-get commands are just annoying. This, for example, is not helpful:
$ les foo.txt
The program 'les' is currently not installed.  You can install it by typing:
sudo apt-get install atm-tools
les: command not found
I'd much rather see this quick, short message so that I can get on with fixing my mistake by adding another 's':
$ les foo.txt
-bash: les: command not found
I finally found how to fix it. Put this line in your .bashrc:
unset command_not_found_handle
Much better.

Sunday, October 17, 2010

My .emacs is now in Mercurial

A while ago I decided to start maintaining my .emacs file under revision control. I picked git because it seemed like the cool thing to do. I put it on gitorious so that I could easily sync it with my home and work machines, and it was public in the off chance that it might help out some other emacs user. Today I converted it from git to mercurial, because for some reason

hg incoming

is more intuitive and easier for me to remember than

git fetch && git log ..origin/master

Maybe I'm weird that way. Anyway, the new repo is on bitbucket. That is all.

Friday, October 8, 2010

Email with Thunderbird, Compose with Emacs

My Mac let's me use emacs keyboard shortcuts everywhere. I'm really sad that I don't get that in Linux. How the universe ever got into this state is beyond my comprehension. Mail.App has gotten me hooked on emacs keybindings when typing emails especially.

The solution in Linux, it turns out, is to just use emacs. I already have It's All Text for Firefox, with emacsclient as the editor. I just found External Editor for Thunderbird, with emacsclient as the editor and tbemail-mode for extra goodness. I think that'll do.