Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Use a temporary buffer for stylish (refs #54).

  • Loading branch information...
commit 4bd22d04e297d2a9ae76c487b30a7bce7be35cd7 1 parent 344c0e1
@chrisdone chrisdone authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 haskell-mode.el
13 haskell-mode.el
@@ -763,10 +763,15 @@ This function will be called with no arguments.")
(defun haskell-mode-buffer-apply-command (cmd)
"Execute shell command CMD with current buffer as input and
replace the whole buffer with the output. If CMD fails the
- buffer remains unchanged"
- (when (= 0 (shell-command-on-region (point-min) (point-max) cmd))
- (erase-buffer)
- (insert-buffer "*Shell Command Output*")))
+ buffer remains unchanged."
+ (let ((target-buffer (current-buffer)))
+ (with-temp-buffer
+ (let ((tmp-buffer (current-buffer)))
+ (when (= 0 (with-current-buffer target-buffer
+ (shell-command-on-region (point-min) (point-max) cmd tmp-buffer)))
+ (with-current-buffer target-buffer
+ (erase-buffer)
+ (insert-buffer tmp-buffer)))))))
(defun haskell-mode-stylish-buffer ()
"Apply stylish-haskell to the current buffer."
Please sign in to comment.
Something went wrong with that request. Please try again.