-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vue mode, derived from mmm-mode, fails with latest version #112
Comments
You may also need |
Here's a shorter test case file:
The key line is the body of function |
It seems that while reparsing, it calls Aha, I think I see what's happening. It's not the parsing of the typescript submode regionb, it's the parsing of the part after that (from char 131 to 165). The part immediately after the typescript doesn't have an associated submode (it's just "vue"), so And based on that, this patch works for me in this particular case: modified mmm-region.el
@@ -868,9 +868,10 @@ calls each respective submode's `syntax-propertize-function'."
(mmm-set-current-pair mode ovl)
(mmm-set-local-variables mode mmm-current-overlay)
(save-restriction
- (when mmm-current-overlay
+ (if mmm-current-overlay
(narrow-to-region (overlay-start mmm-current-overlay)
- (overlay-end mmm-current-overlay)))
+ (overlay-end mmm-current-overlay))
+ (narrow-to-region beg end))
(cond
(func
(funcall func beg end)) but someone with more experience will have to see if that's the proper solution or just a hack for my case. I suppose an alternative answer is that |
Hi! Sorry for the late reply. It seems like the same problem Curious it has only come up now. But vue-mode can probably copy As a result, that Narrowing in the "else" case, like you suggested, could work, but it's likely to bring other unwanted side-effects as well. Like when some particular tricky literal has a subregion inside, it wouldn't be propertized as a whole. |
Hi all, |
I'm using this, some of which may no longer be needed with newer versions of mmm-mode:
|
No luck, i keep getting this kind of errors :| Are you compiling mmm-mode yourself ? |
I'm using straight.el so getting it "straight" from the source. |
@garyo If you're using I mean all but one (the one with |
Very good. Now, about that last line. It doesn't help in my testing, I still get that "assertion failed" with your example (only I tried it with
(defun html-after-syntax-propertize (overlay _mode beg end)
(when overlay
(with-silent-modifications
(funcall
(syntax-propertize-rules ("<\\|>" (0 ".")))
beg end))))
(add-hook 'mmm-after-syntax-propertize-functions #'html-after-syntax-propertize nil t)
So I think |
Here's an alternative fix you could try, too: diff --git a/mmm-region.el b/mmm-region.el
index a0c5b4f..7791e07 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -870,7 +870,10 @@ calls each respective submode's `syntax-propertize-function'."
(save-restriction
(when mmm-current-overlay
(narrow-to-region (overlay-start mmm-current-overlay)
- (overlay-end mmm-current-overlay)))
+ (overlay-end mmm-current-overlay))
+ (put-text-property
+ (point-min) (point-max)
+ 'syntax-table (syntax-table)))
(cond
(func
(funcall func beg end)) I'm hesitant to apply it here, though (it feels pretty dirty on the high level). Wish overlays supported this property. Perhaps we should migrate off overlays first. |
This problem went away for me for a while without applying your fix, @dgutov, but now it's back, and I had to apply your "alternative fix" above (put-text-property...) to my |
I just wanted to see if you plan to apply your fix above. It definitely does help for me. (I accidentally lost my local version with this change and the errors came back.) |
The issue's been temporarily fixed after applying this, though only until I called vue-mode-reparse on any of the affected buffers. Debugger output looks the same as in the original post, though I'll have to check on the latest emacs build (mine is 'master' branch as of Aug 5). |
Can confirm, the errors went away after I applied the fix. |
I'm using Emacs trunk build from today, and most recent mmm-mode and vue-mode. I have a Vue-mode file that causes mmm-mode to get a CL assertion failure when it syntax-parses the buffer.
At the point of failure,
(cadr sgml--syntax-propertize-ppss)
is-3
. But the typescript syntax in that section of the file is OK, there are no mismatched parens.To repro, use this emacs startup file (emacs -Q -l mmm-bug-test.el):
The vue file for testing is this. Just load it, and if needed do C-c C-l to reparse.
The text was updated successfully, but these errors were encountered: