From 9ed7f5fccad1ce05fef43fb77972dd1e33d02fd4 Mon Sep 17 00:00:00 2001 From: Dave Mayo Date: Thu, 26 Jun 2014 10:48:54 -0400 Subject: Proof of concept that #21 is doable. --- src/mode-def.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mode-def.el b/src/mode-def.el index fa01727..dd82409 100644 --- a/src/mode-def.el +++ b/src/mode-def.el @@ -10,10 +10,21 @@ for the current line." (let* ((start (line-beginning-position)) (end (line-end-position)) - (line (buffer-substring-no-properties start end)) - (expr (emmet-regex "\\([ \t]*\\)\\([^\n]+\\)" line 2))) - (if (first expr) - (list (first expr) start end)))) + (line (buffer-substring-no-properties start end))) + (save-excursion + (save-match-data + (let ((bound (point))) + (goto-char start) + (if (re-search-forward "\\(\\([ \t]+\\)?<[^>]*?>\\)+" bound t) + (progn + (setq start (match-end 0)) + (setq end bound) + (setq line (buffer-substring-no-properties start end)) + ) + )))) + (let ((expr (emmet-regex "\\([ \t]*\\)\\([^\n]+\\)" line 2))) + (if (first expr) + (list (first expr) start end))))) (defcustom emmet-indentation 4 "Number of spaces used for indentation." -- cgit v1.2.3