Skip to content

Instantly share code, notes, and snippets.

@nozma
Created September 25, 2010 12:32
Show Gist options
  • Save nozma/596791 to your computer and use it in GitHub Desktop.
Save nozma/596791 to your computer and use it in GitHub Desktop.
(autoload 'js-console "js-console" nil t)
(defun js-console-eval-region (start end)
"Execute region"
(interactive "r")
(let ((buf-name (buffer-name (current-buffer))))
(copy-region-as-kill start end)
(switch-to-buffer-other-window "*js*")
(js-console-exec-input (car kill-ring))
(switch-to-buffer-other-window buf-name)))
(defun run-js-console-and-split-window ()
"Run js-console and split window horizontally."
(interactive)
(split-window-horizontally)
(js-console)
(other-window 1)
)
(add-hook 'js-mode-hook ;; Emacs23用
(lambda ()
(moz-minor-mode 1)
(local-set-key "\C-c\C-j" 'run-js-console-and-split-window)
(local-set-key "\C-c\C-r" 'js-console-eval-region)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment