tungd / kite-mini.el

Yet another Emacs package to interact with WebKit remote debugging API.
GNU General Public License v3.0
19 stars 5 forks source link

Mini Kite Mode

Emacs integration for WebKit remote debug protocol. Inspired by Kite and Wooky.

Debugging JavaScript in WebKit browser (Chrome) from Emacs is always fun. There's a couple of packages implement that idea already: Skewer, Kite and Wooky with different feature sets. However, due to my specific workflow and needs, they are not suitable, so I decided to wrote this.

Installation

Note: I test this only on Emacs 24.1 and above. Pull requests for supporting other versions are welcomed.

Usage

Open Chrome/Chromium with remote debugging enabled:

chromium --remote-debugging-port=9222
# Or
open -a /Applications/Google\ Chrome.app --args "--remote-debugging-port=9222"

Require the package

(require 'kite-mini)
# Automatically Turn on the mode for your buffer of choice.
(add-hook 'js-mode-hook (lambda () (kite-mini-mode t)))
(add-hook 'css-mode-hook (lambda () (kite-mini-mode t)))

Connect:

<M-x> kite-mini-connect

Console (with context sensitive autocompletion via TAB):

<M-x> kite-mini-console

Note: if you open the Devtools console in Chrome, the tabs will not appear for selection.

Key Function Description
C-c C-c kite-mini-evaluate-region-or-line Send active region or current line to Chrome
C-c C-k kite-mini-update Reload the JS source in the tab. This method is able to update closure and event handlers similar to what you can do in the dev tools debugger.
C-c C-r kite-mini-reload Refresh the page

Credits

License

GPL