Why is creating good packages so hard?
I have had a hard time creating good packages, packages whose permissions did not inadvertently screw up the existing file tree. I thought that the PackageMaker option to not Overwrite Permissions would save me. It didn't. It seems to only affect the permissions not the user and group, which could easily be just as important.
What's a programmer to do? Well, create a tool of course. I created a tool called packagelint. It will compare any package you give it with the BaseSystem package. If any of the common directories are set differently from what the BaseSystem package calls for, it will report those errors and differences. Here is an example.
As you can see, even the latest version of uControl still suffers from a few deviations from what is standard. Obviously, my next release of uControl will benefit from this new tool. Feel free to download it, and expand it. I'm sure there are lots of other things that are in need of more stringent validation than PackageMaker currently affords.
-shane (at) gnufoo (dot) org
Macs do Emacs? Who knew?
Update: I just received an email that tipped me off to a fantastic piece of software which includes a DefaultKeyBinding.dict file with many more emacs-ish features, but not only that. It includes an InputManager plugin for TextExtras (also requires: MOKit) which gives you good old emacs services like selection piping, programmatic indentation, brace matching, and more in every Cocoa application! It's simply phenomenal, if you like emacs.
When you found out that you had emacs bindings in Cocoa, were you impressed? Then you realized you only got the Control half of the key bindings. Option still just gave you funny characters. Better than nothing, I thought. Well someone behind Mac OS X or NeXT certainly had an affection for definable key bindings and now you can unleash the other half (well most of the other half) by dabbling with a few dictionary files.
I found this gem while looking through the Project Builder release notes, directing me to the Help system to look for "Text System Defaults and Key Bindings" (BTW, does anyone else think Apple's new Help is a piece of crap? You can't copy and paste. Navigation is cumbersome at best... nevermind.)
Make yourself a ~/Library/KeyBindings directory then place this file shown below into that directory. You should have instantaneous emacs key bindings system wide or maybe cocoa-wide! It's fabulous, if you enjoy emacs. Even if I were into vi, having these bindings, same as most default shells would still bring a smile to my face.
/* Picked up from Help search on Key Bindings. Good stuff -shane */ /* ~/Library/KeyBindings/DefaultKeyBinding.dict */ { "~f"="moveWordForward:"; "~b"="moveWordBackward:"; "~<"="moveToBeginningOfDocument:"; "~>"="moveToEndOfDocument:"; "~v"="pageUp:"; "~d"="deleteWordForward:"; "~^h"="deleteWordBackward:"; "~\010"="deleteWordBackward:"; /* Alt-backspace */ "~\177"="deleteWordBackward:"; /* Alt-delete */ /* Escape should really be complete. */ "\033"="complete:"; /* Escape */ }
I don't know where any of these are bindings (i.e. "moveWordForward:") are defined so if anyone finds out. Let us know! It seems this file contains the answers to this question, many thanks to Mishka Gorodnitzky for this link and the link to TextExtras.
I was editing a Word document for work today, and I realized if I had these bindings in Word I would have a much more pleasant experience. I'm actually excited at the prospect of using Word! What an odd thing to hear myself think out loud.
For those looking for the real Emacs for Mac OS X, take a look at this page by Ovidiu Presdescu who packaged Emacs. The person responsible for development of the port is Andrew Choi, to whom I and my fellow emacs users are deeply indebted to.
-shane (at) gnufoo (dot) org
Talking cat? Only on OS X!
Here's a little hack I did on cat for my own amusement. Since we have speech synthesis by default on Mac OS X, well, we might as well show it off. First you must download it. Here's the binary and the man page.
$ chmod a+x ~/bin/cat; # have to make it executable $ echo hi | ~/bin/cat -a [speaks it] hi
If you decide to install it, I would not recommend replacing your old cat binary with it. Instead place it in your ~/bin or rename it to something else (i.e. kat, cheshire). Anyway, I should be doing other things like sleeping. ;)
-shane (at) gnufoo (dot) org
For those interested in building this from the source, apply this patch to the cat directory after you unpack this tarball. I didn't bother with Makefiles or the build system to try and figure out how to go about compiling it the "proper" way. Here's the compile line you have to stammer out to get it:
$ tar xfz text_cmds-1997.11.10-8.3.tar.gz $ cd text_cmds-8-3 $ patch -d cat < /cat.diff; # or where ever you put the diff file $ cd cat $ cc -I/System/Library/Frameworks/ApplicationServices.framework\ /Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/Headers \ -framework ApplicationServices cat.c -o cat