TEA Preferences

Before you can setup custom user actions you will need to enable them in the TEA Preferences, which are located in the Advanced tab of the Espresso Preferences.

Checking “use XHTML by default” will cause TEA-based snippets that use the $E_XHTML variable to leave it blank. At some point in the future, TEA will hopefully be more intelligent about detecting whether a document is HTML or XHTML, but for now you’ll need to control it using this preference.

For details about custom user actions, see below.

Similar to Textmate, anything entered in the Custom Shell Variables section of the preferences will be available as an environmental variable to any shell scripts you run through TEA. For instance, if you add a variable with the name “MY_CUSTOM_VARIABLE” and the contents “I love TEA!” then wherever you use the shell environmental variable $MY_CUSTOM_VARIABLE you’ll get “I love TEA!”

Actions

If you check “Enable custom user actions” you will be able to create custom actions without needing a custom sugar. This is useful not only for custom TEA-based actions, but for custom actions using third party sugars, as well.

There are, however, several caveats: first, you will need to relaunch Espresso after checking this box before any of the existing custom actions in your Support folder are detected. Any changes you make to existing actions will not take effect until you relaunch Espresso, and if you add any new files in your Support folder you will have to relaunch Espresso twice in order for the new actions to be detected.

The reason for this ridiculousness is that Espresso doesn’t offer any API for registering actions aside from XML action definitions that live inside Sugars. To get around this, TEA creates symbolic links to the XML files in your Support/TextActions folder, but because it can only create those links while it is itself being initialized, the links are created too late for Espresso to notice them. So the first time you relaunch Espresso links to the new files are created, and the second time you relaunch Espresso those links are noticed by Espresso itself.