Om mode

Om-mode is a minor mode for Emacs that helps inserting Om components. A short demo is available on youtube.

You will probably want to install it via Marmalade or MELPA. A README with usage instructions and source is on github.

Here is the template om-mode expands into.

(defn example
  "Om component for new example"
  [data owner]
  (reify
    om/IInitState
    (init-state [_] { }
      )
    om/IWillMount
    (will-mount [_]
      )
    om/IDidMount
    (did-mount [_]
      )
    om/IWillUnmount
    (will-unmount [_]
      )
    om/IShouldUpdate
    (should-update [_ next-props next-state]
      )
    om/IWillReceiveProps
    (will-receive-props [_ next-props]
      )
    om/IWillUpdate
    (will-update [_ next-props next-state]
      )
    om/IDidUpdate
    (did-update [_ prev-props prev-state]
      )
    om/IDisplayName
    (display-name [this]
      "example")
    om/IRenderState
    (render-state [_ state])))

P.S. Follow me on Twitter.

Daniel Szmulewicz 24 September 2014
blog comments powered by Disqus