While using the Coda Plug-In Creator to create a plugin, I kept running into some issues. I was working off another plugin by simply copy-and-pasting it, and started to edit the actual script that is responsible for the plugin effect (eg. to restrict lines to 80 characters).
However each time I would go in, edit the terminal script, and save it, it would break the plugin. It would cause Coda to crash. After some time, I realized the issue lay with the editor I was using to make changes to the terminal script.
I was using TextEdit to make my desired changes, however TextEdit has some side effects when opening and saving a file. Namely, it may change the encoding and/or file extension. Therefore when I would make my programmatic changes, the actual file within the plugin was having it's mime type, extension and encoding changed. This was, as it ought to, killing the plugin and causing Coda to crash.
I got around this by creating the plugin, right clicking on the icon in the
Finder, and clicking Show Package Contents
. From there, I could navigate my
way to the actual script, right click it, and choose to make changes to it
within whichever application I wanted to. Specifically, an application that
doesn't alter the encoding, mime type or file extension. Coda itself is a safe
bet, along with TextMate and
Dashcode.
I presume TextEdit was doing this because it is basically designed for rich text files, and therefore saving anything through it would naturally corrupt it being able to be run as an executable.