aboutsummaryrefslogtreecommitdiffstats
path: root/emmet-mode.el
diff options
context:
space:
mode:
authorDave Mayo <dave_mayo@harvard.edu>2014-11-26 00:26:46 -0500
committerDave Mayo <dave_mayo@harvard.edu>2014-11-26 00:26:46 -0500
commitaa68ee74fd85723f40f7a5202009ebab09184215 (patch)
treec123f250dac67c7fceecf1efa05b61f79a646c22 /emmet-mode.el
parentc22ba86d6fcceeff4026185b3f6c5b8d66ef7f91 (diff)
downloademmet-mode-aa68ee74fd85723f40f7a5202009ebab09184215.tar.lz
emmet-mode-aa68ee74fd85723f40f7a5202009ebab09184215.tar.xz
emmet-mode-aa68ee74fd85723f40f7a5202009ebab09184215.zip
Fixes #54 - Uses looking-back to check if there is a tag immediately preceding in cases where ">" is before-char
Diffstat (limited to 'emmet-mode.el')
-rw-r--r--emmet-mode.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/emmet-mode.el b/emmet-mode.el
index 330658a..30592a1 100644
--- a/emmet-mode.el
+++ b/emmet-mode.el
@@ -172,7 +172,6 @@ and leaving the point in place."
"Find the left bound of an emmet expr"
(save-excursion (save-match-data
(let ((char (char-before))
- (last-gt (point))
(in-style-attr (looking-back "style=[\"'][^\"']*")))
(while char
(cond ((and in-style-attr (member char '(?\" ?\')))
@@ -181,9 +180,9 @@ and leaving the point in place."
(with-syntax-table (standard-syntax-table)
(backward-sexp) (setq char (char-before))))
((eq char ?\>)
- (setq last-gt (point)) (backward-char) (setq char (char-before)))
- ((eq char ?\<)
- (goto-char last-gt) (setq char nil))
+ (if (looking-back "<[^>]+>" (line-beginning-position))
+ (setq char nil)
+ (progn (backward-char) (setq char (char-before)))))
((not (string-match-p "[[:space:]\n;]" (string char)))
(backward-char) (setq char (char-before)))
(t
@@ -460,10 +459,13 @@ cursor position will be moved to after the first quote."
(emmet-remove-flash-ovl (current-buffer))
(let ((here (point)))
(insert markup)
- (if emmet-indent-after-insert
- (let ((pre-indent-point (point)))
- (indent-region here (point))
- (setq here (+ here (- (point) pre-indent-point)))))
+ (when emmet-indent-after-insert
+ (indent-region here (point))
+ (setq here
+ (save-excursion
+ (goto-char here)
+ (skip-chars-forward "\s-")
+ (point))))
(setq emmet-flash-ovl (make-overlay here (point)))
(overlay-put emmet-flash-ovl 'face 'emmet-preview-output)
(when (< 0 emmet-insert-flash-time)