[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sass-mode 3930ddc 05/31: add sass-output-region() and sass
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sass-mode 3930ddc 05/31: add sass-output-region() and sass-output-buffer() |
Date: |
Sun, 29 Aug 2021 11:29:36 -0400 (EDT) |
branch: elpa/sass-mode
commit 3930ddcb2ce89fa770c1dacf0155f7b81eb25eef
Author: kmori <mori.dev.asdf@gmail.com>
Commit: kmori <mori.dev.asdf@gmail.com>
add sass-output-region() and sass-output-buffer()
---
sass-mode.el | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/sass-mode.el b/sass-mode.el
index 11d8993..09bd046 100644
--- a/sass-mode.el
+++ b/sass-mode.el
@@ -181,9 +181,17 @@ LIMIT is the limit of the search."
;; Mode setup
+(defvar sass-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-c\C-r" 'sass-output-region)
+ (define-key map "\C-c\C-l" 'sass-output-buffer)
+ map))
+
;;;###autoload
(define-derived-mode sass-mode haml-mode "Sass"
- "Major mode for editing Sass files."
+ "Major mode for editing Sass files.
+
+\\{sass-mode-map}"
(set-syntax-table sass-syntax-table)
(setq font-lock-extend-region-functions
'(font-lock-extend-region-wholelines
font-lock-extend-region-multiline))
@@ -201,6 +209,24 @@ LIMIT is the limit of the search."
if (looking-at opener) return nil
finally return t))
+;; Command
+
+(defun sass-output-region (start end)
+ "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"))))
+
+(defun sass-output-buffer ()
+ "Displays the CSS output for entire buffer."
+ (interactive)
+ (sass-output-region (point-min) (point-max)))
+
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.sass$" . sass-mode))
- [nongnu] elpa/sass-mode 8190f29 15/31: Better version of sass-output-region (see #1), (continued)
- [nongnu] elpa/sass-mode 8190f29 15/31: Better version of sass-output-region (see #1), ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 28dd06b 14/31: Merge remote-tracking branch 'refs/remotes/nex3/pr/1', ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode c5de02d 22/31: Use cl-lib for consistent destructuring-bind etc., ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode b676b2d 03/31: Make variables buffer-local before setting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 30f6132 09/31: added missing ' in auto-mode-alisp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode bf846d6 13/31: Merge pull request #11 from gramos/fix_auto-mode-alist_pattern, ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 0c54866 16/31: Make comments toggleable with M-;, ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode aee28ea 18/31: Bump version to 3.0.16, ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 5d69d5f 06/31: Update .gitignore., ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode fcee43b 01/31: Get rid of haml-mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 3930ddc 05/31: add sass-output-region() and sass-output-buffer(),
ELPA Syncer <=
- [nongnu] elpa/sass-mode 9d05841 08/31: auto-mode-alisp patter should ends with \\ is better, ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode d19542f 20/31: Don't override the syntax classes for "-" and "_", ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode a3f5b1a 19/31: Send errors to a separate buffer, ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 3da9040 23/31: Update my name., ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 26a66e3 21/31: Revert "Don't override the syntax classes for "-" and "_"", ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 69fc32b 28/31: Adding sass-before-eval-hook., ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode e0c9198 29/31: Merge pull request #24 from dcluna/add-pre-eval-hook-and-options, ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 247a0d4 31/31: Ensure cl-return has a matching block to return from (see #23), ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode 3938a42 04/31: Bump version to 3.0.15., ELPA Syncer, 2021/08/29
- [nongnu] elpa/sass-mode c0147d2 10/31: Don't indent after "attr: value" lines (fixes #5), ELPA Syncer, 2021/08/29