Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Little helper for GNU Emacs to "karma run"
(require 'ansi-color)
(defvar karma-buffer
(defun karma-compile ()
"Run Karma"
(shell-command "karma run" (get-buffer-create karma-buffer))
(display-buffer karma-buffer)
(with-current-buffer karma-buffer
(ansi-color-apply-on-region (point-min) (point-max))
(while (re-search-forward "^.*\n\\[1A\\[2K" nil t)
(replace-match "" nil nil)
;; bind to key (M-r) in js-mode, adapt to your liking
(add-hook 'js-mode-hook
(lambda ()
(local-set-key (kbd "M-r") 'karma-compile)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment