Skip to content
Browse files

Merge pull request #11 from jkpl/master

Improved sws indent and stylus syntax highlight
  • Loading branch information...
2 parents ed4275a + 3db33f4 commit 275ab149edb0f6bcfae6ac17ba456f3351191604 @brianc committed Aug 2, 2012
Showing with 13 additions and 8 deletions.
  1. +1 −0 stylus-mode.el
  2. +12 −8 sws-mode.el
View
1 stylus-mode.el
@@ -57,6 +57,7 @@
(modify-syntax-entry ?\/ ". 124b" syntable)
(modify-syntax-entry ?* ". 23" syntable)
(modify-syntax-entry ?\n "> b" syntable)
+ (modify-syntax-entry ?' "\"" syntable)
syntable)
"Syntax table for `stylus-mode'.")
View
20 sws-mode.el
@@ -14,8 +14,11 @@
(defun sws-previous-indentation ()
"Gets indentation of previous line"
(save-excursion
- (previous-line)
- (current-indentation)))
+ (forward-line -1)
+ (if (bobp) 0
+ (progn
+ (while (and (looking-at "^[ \t]*$") (not (bobp))) (forward-line -1))
+ (current-indentation)))))
(defun sws-max-indent ()
"Calculates max indentation"
@@ -44,12 +47,13 @@
(defun sws-indent-line ()
"Indents current line"
(interactive)
- (if mark-active
- (sws-indent-region)
- (if (sws-at-bot-p)
- (sws-do-indent-line)
- ;; instead of adjusting indent, move point to text
- (sws-point-to-bot))))
+ (if (eq this-command 'indent-for-tab-command)
+ (if mark-active
+ (sws-indent-region (region-beginning) (region-end))
+ (if (sws-at-bot-p)
+ (sws-do-indent-line)
+ (sws-point-to-bot)))
+ (indent-to (sws-previous-indentation))))
(defun sws-at-bol-p ()
"If point is at beginning of line"

0 comments on commit 275ab14

Please sign in to comment.
Something went wrong with that request. Please try again.