Komodo macros as pure magic code injection

Back when we released ( I think it was? ) Komodo 3.0, David Ascher spent a few weeks scratching his chin and writing some docs on the JavaScript and Python macro apis that we were exposing in Komodo for users to hack on. The initial cut of the macros feature was a ‘record some UI actions as JS code that might be re-runnable’, but Komodo macros have since become very much *how you hack* Komodo, for instant gratification. The API David wrote back in 2004 (?) was a limited subset of what is possible in Komodo, because virtually anything can be scripted somehow from JavaScript in Komodo’s Chrome.

When I originally started hacking macros, it was very much:

  • create code that does $X when run
  • bind macro to some unused keybinding
  • try and remember what that key-binding was the next time I need the macro.

Flash forward to 2009, I am delighted and amused at how the Komodo hacking community has progressed. It shouldn’t be surprising; most Komodo users are web developers whose stock and trade is JavaScript and possibly Python, and with any community of developers around a reasonably hackable editor ( eg Vim or Emacs ) people want to hack at their editor.

A particularly astonishing example of this has been playing out over the last few weeks on the Komodo forums:

Komodo user Stan has created an amazing monster of a macro that auto-completes html and XML tags. When he first posted it, the macro was pretty straightforward in how it worked, but also vey sophisticated in how it executes. Instead of being some chunk of Code that triggers on-demand, Stan’s instead executes when Komodo starts and listens for key-press events of certain types while you are editing. The upshot of this is that Stan’s tag completion macro fundamentally alters how Komodo’s editor behaves, and manages to tie in not only close-tag completion, but Abbreviations supports as well. Very cool.

Recent Posts

Scroll to Top