branch: elpa/sass-mode commit 8190f29bc13c4b31af5c9d1a803b75534bdf4643 Author: Steve Purcell <st...@sanityinc.com> Commit: Steve Purcell <st...@sanityinc.com>
Better version of sass-output-region (see #1) --- sass-mode.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sass-mode.el b/sass-mode.el index 662b2ff..e5bb277 100644 --- a/sass-mode.el +++ b/sass-mode.el @@ -216,12 +216,12 @@ LIMIT is the limit of the search." "Displays the CSS output for the current block of Sass code. Called from a program, START and END specify the region to indent." (interactive "r") - (let* ((text (buffer-substring-no-properties start end)) - (command (format "ruby -rubygems -e \"require 'sass'; puts Sass::Engine.new('%s').render\"" text))) - (kill-new text) - (with-temp-buffer - (yank) - (shell-command-on-region (point-min) (point-max) command "sass-output")))) + (let ((output-buffer "*sass-output*")) + (shell-command-on-region start end "sass --stdin" output-buffer) + (when (fboundp 'css-mode) + (with-current-buffer output-buffer + (css-mode))) + (switch-to-buffer-other-window output-buffer))) (defun sass-output-buffer () "Displays the CSS output for entire buffer."