Archives / Search ›

Emacs activation script, take 3

About a year ago I posted an Emacs launching script which would, if Emacs were already running, use emacsclient to open a file and AppleScript to bring Emacs to the front. It works well and I use it every day, but the AppleScript activating part is very slow. I usually end up just clicking on Emacs' dock icon instead of waiting for it to finish.

After a bit of hacking, instead of:

osascript -e 'tell application "Emacs" to activate'

I now use:

appswitch -i com.gnu.emacs

The speed difference is significant:

% time osascript -e 'tell application "Emacs" to activate'
osascript -e 'tell application "Emacs" to activate'  2.42s user 1.25s system 62% cpu 5.864 total
% time appswitch -i com.gnu.emacs
appswitch -i com.gnu.emacs  0.01s user 0.07s system 13% cpu 0.602 total
% time appswitch -a Emacs
appswitch -a Emacs  0.00s user 0.05s system 29% cpu 0.169 total

The -i flag is slowest because it needs to construct a CFBundle; fast matching occurs on application name, path, process ID and creator. (Process ID matching would be fastest if I directly converted to a process serial number, but I don't do that.)

If you've used my launch tool, you'll find appswitch very similar—I borrowed quite a bit from launch to write it. I hope it will be similarly useful “glue” for others.

Download appswitch here.

ICeCoffEE 1.3 final released. If you read this Weblog regularly, you’re probably sick and tired of hearing about it, but it includes a bunch of new features and refinements to existing features, as well as the APE rewrite which significantly increases stability and robustness.

One place I'm using ICeCoffEE 1.3 frequently is in Safari: if a Web page renders poorly, just command-option-click on the URL bar to select another browser, even easier than using the equivalent command in the Debug menu.

Happy third birthday to Radio Paradise, which has been keeping me company all night.

End of the road

ICeCoffEE 1.3b3 is out, and should be identical to the release version unless anyone points out any further bugs. It adds one last new feature for parity with ICeTEe 2: support for a bookmark helper application, such as URL Manager Pro.

Eric Albert points to a beautifully written essay on switching. It certainly resonates with me, as it's about life choices more than it is the Mac.

Since the response from my beta testers has been less than overwhelming, please download ICeCoffEE 1.3b2 and let me know if you experience any problems. Aside from updating to a slightly newer APE and changing the version number in about 45 places, this will be 1.3 final unless I hear of any more bugs.

‹ Newer Posts  •  Older Posts ›