Browse files

coffee-compile-region does not give focus to the compiled buffer, and…

… clear the buffer instead of kill & re-create it
  • Loading branch information...
1 parent 1a12d07 commit af89c399ff54b77568d6e7b8cc43e786f37a5abe @lcoq lcoq committed Nov 8, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 coffee-mode.el
@@ -283,15 +283,18 @@ called `coffee-compiled-buffer-name'."
(let ((buffer (get-buffer coffee-compiled-buffer-name)))
(when buffer
- (kill-buffer buffer)))
+ (with-current-buffer buffer
+ (erase-buffer))))
(apply (apply-partially 'call-process-region start end coffee-command nil
(get-buffer-create coffee-compiled-buffer-name)
(append coffee-args-compile (list "-s" "-p")))
- (pop-to-buffer (get-buffer coffee-compiled-buffer-name))
- (let ((buffer-file-name "tmp.js")) (set-auto-mode))
- (goto-char (point-min)))
+ (let ((buffer (get-buffer coffee-compiled-buffer-name)))
+ (display-buffer buffer)
+ (with-current-buffer buffer
+ (let ((buffer-file-name "tmp.js")) (set-auto-mode)))))
(defun coffee-js2coffee-replace-region (start end)
"Convert JavaScript in the region into CoffeeScript."

0 comments on commit af89c39

Please sign in to comment.