[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7b783ee 308/433: Don't confuse script tags with EJS tags
From: |
Dmitry Gutov |
Subject: |
[elpa] master 7b783ee 308/433: Don't confuse script tags with EJS tags |
Date: |
Thu, 15 Mar 2018 19:44:25 -0400 (EDT) |
branch: master
commit 7b783eee7af119b2eab3263afece1dcae38e7bbf
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Don't confuse script tags with EJS tags
---
mmm-erb.el | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/mmm-erb.el b/mmm-erb.el
index d59a849..c8d846e 100644
--- a/mmm-erb.el
+++ b/mmm-erb.el
@@ -91,14 +91,16 @@
("<%" . mmm-code-submode-face))
:insert ((?% erb-code nil @ "<%" @ " " _ " " @ "%>" @)
(?# erb-comment nil @ "<%#" @ " " _ " " @ "%>" @)
- (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @)))
+ (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @))
+ :creation-hook mmm-erb-mark-as-special)
(ejs :submode js-mode :front "<%[#=]?" :back "-?%>"
:match-face (("<%#" . mmm-comment-submode-face)
("<%=" . mmm-output-submode-face)
("<%" . mmm-code-submode-face))
:insert ((?% ejs-code nil @ "<%" @ " " _ " " @ "%>" @)
(?# ejs-comment nil @ "<%#" @ " " _ " " @ "%>" @)
- (?= ejs-expression nil @ "<%=" @ " " _ " " @ "%>" @)))))
+ (?= ejs-expression nil @ "<%=" @ " " _ " " @ "%>" @))
+ :creation-hook mmm-erb-mark-as-special)))
(pushnew '(indent-line-function buffer) mmm-save-local-variables)
@@ -114,6 +116,10 @@
"Hook function to run after primary or submode major mode function."
(setq indent-line-function 'mmm-erb-indent-line))
+(defun mmm-erb-mark-as-special ()
+ "Hook function to run in ERB and EJS tag regions."
+ (overlay-put mmm-current-overlay 'mmm-special-tag t))
+
(defun mmm-erb-indent-line ()
"Indent the current line intelligently."
(interactive)
@@ -205,11 +211,12 @@
(let ((scan-fn (plist-get '(ruby-mode mmm-erb-scan-erb
js-mode mmm-erb-scan-ejs)
submode)))
- (when scan-fn
- (save-excursion
- (goto-char beg)
- (skip-syntax-forward "-")
- (funcall scan-fn end)))))))
+ (and scan-fn
+ (overlay-get (mmm-overlay-at beg) 'mmm-special-tag)
+ (save-excursion
+ (goto-char beg)
+ (skip-syntax-forward "-")
+ (funcall scan-fn end)))))))
(defconst mmm-erb-ruby-close-re "\\<end\\>\\|}"
"Regexp to match the end of a Ruby block.")
- [elpa] master 4085494 402/433: Release 0.5.4, (continued)
- [elpa] master 4085494 402/433: Release 0.5.4, Dmitry Gutov, 2018/03/15
- [elpa] master 99539e8 340/433: Rewrite mmm-regions-alist for performance, Dmitry Gutov, 2018/03/15
- [elpa] master 4f79b74 373/433: Add two failing tests, Dmitry Gutov, 2018/03/15
- [elpa] master bdc7d47 273/433: (html-js): Support JS version in language attribute., Dmitry Gutov, 2018/03/15
- [elpa] master f926613 206/433: # Applied patch from Alan Shutko <address@hidden>., Dmitry Gutov, 2018/03/15
- [elpa] master c68cee0 411/433: Merge pull request #73 from AdamNiederer/master, Dmitry Gutov, 2018/03/15
- [elpa] master 15c766d 216/433: * mmm-vars.el (mmm-classes-alist): Document new keywords., Dmitry Gutov, 2018/03/15
- [elpa] master 6e50485 268/433: Added html-php submode class., Dmitry Gutov, 2018/03/15
- [elpa] master c6a30e3 251/433: Trimmed ancient docstring., Dmitry Gutov, 2018/03/15
- [elpa] master 30811bc 249/433: Added new files to be byte-compiled (Joe Kelsey), Dmitry Gutov, 2018/03/15
- [elpa] master 7b783ee 308/433: Don't confuse script tags with EJS tags,
Dmitry Gutov <=
- [elpa] master 00c99c7 278/433: (lisp_LISP): Added mmm-myghty.el., Dmitry Gutov, 2018/03/15
- [elpa] master ad24c9d 275/433: * mmm-noweb.el (mmm-syntax-region-list), Dmitry Gutov, 2018/03/15
- [elpa] master a27d7af 329/433: Allow toggling whitespace-mode after initialization, Dmitry Gutov, 2018/03/15
- [elpa] master ce3cb79 367/433: * mmm-update-mode-info: bind `buffer-file-truename' to nil, Dmitry Gutov, 2018/03/15
- [elpa] master 37f6dea 396/433: mmm-indent-line: Use primary mode if submode ends right here, Dmitry Gutov, 2018/03/15
- [elpa] master 1b9406d 361/433: Released 0.5.0, Dmitry Gutov, 2018/03/15
- [elpa] master f9e4dd5 376/433: Fix #26, Dmitry Gutov, 2018/03/15
- [elpa] master f5ea03a 399/433: Don't try to enable jit-lock in temp buffers, Dmitry Gutov, 2018/03/15
- [elpa] master 18bb050 392/433: Released 0.5.2, Dmitry Gutov, 2018/03/15
- [elpa] master 0cc4df5 410/433: Document mode transition hooks, Dmitry Gutov, 2018/03/15