Skip to content
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

mmm-mode crashes on gitit doc #65

Open
conal opened this issue Jul 15, 2016 · 3 comments
Open

mmm-mode crashes on gitit doc #65

conal opened this issue Jul 15, 2016 · 3 comments

Comments

@conal
Copy link

conal commented Jul 15, 2016

The following Markdown doc crashes mmm-mode breaks mmm-mode:


---
title: gitit doc
...


```
ham
```

More than three hyphens below, and mmm-mode crashes.

----

Note that in gitit pages, meta-data blocks end with three dots, not three hyphens.

The crash happens even when no mmm classes are added. In the scratch buffer:

mmm-classes-alist
((universal :front "{%\\([a-zA-Z-]+\\)%}" :back "{%/~1%}" :insert ((47 universal "Submode: " @ "{%" str "%}" @ "
" _ "
" @ "{%/" str "%}" @)) :match-submode mmm-univ-get-mode :save-matches 1))

I got mmm-mode version 0.5.4 from MELPA within the last few days.

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  markdown-match-inline-generic("\\(?:\\`\\|[^\\]\\)\\(\\(`+\\)\\(\\(?:.\\|\n[^\n]\\)*?[^`]\\)\\(\\2\\)\\)\\(?:[^`]\\|\\'\\)" 145)
  markdown-match-code(145)
  font-lock-fontify-keywords-region(1 145 nil)
  font-lock-default-fontify-region(1 145 nil)
  font-lock-fontify-region(1 145 nil)
  byte-code("\212\303 �\304\216\305ed   #\210\306 \210\307\211�+\207" [save-match-data-internal verbose font-lock-fontified match-data ((byte-code "\301�\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) font-lock-fontify-region font-lock-after-fontify-buffer t] 4)
  font-lock-default-fontify-buffer()
  font-lock-fontify-buffer()
  font-lock-initial-fontify()
  font-lock-mode(1)
  font-lock-refresh-defaults()
  markdown-reload-extensions()
  markdown-mode()
  mmm-update-mode-info(markdown-mode)
  mmm-mode-on()
  mmm-mode(nil)
  call-interactively(mmm-mode record nil)
  command-execute(mmm-mode record)
  execute-extended-command(nil "mmm-mode")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
@dgutov
Copy link
Owner

dgutov commented Jul 21, 2016

Hi! Sorry for the late reply.

The problem here seems to be than markdown-get-enclosing-fenced-block-construct returns a list where the second element is nil. This expression:

(save-match-data
 (set-match-data (markdown-text-property-at-point 'markdown-yaml-metadata-begin))
 (markdown-get-fenced-block-from-start 'markdown-yaml-metadata-begin))

returns (1 98) when you have 3 dashes at the end, and (1 nil) when you have four dashes. markdown-match-inline-generic uses the result with goto-char and fails as above.

Not sure why this is not a problem without mmm-mode, though. Maybe ask the maintainer of markdown-mode?

@conal
Copy link
Author

conal commented Jul 23, 2016

Thanks very much for the help, and sorry that I incorrectly flagged it as an mmm-mode issue. I'll take it up with the markdown-mode maintainer as you suggested.

@dgutov
Copy link
Owner

dgutov commented Jul 23, 2016

Thanks very much for the help, and sorry that I incorrectly flagged it as an mmm-mode issue.

There's probably something we could be doing better in mmm-mode, but it'll take more in-depth knowledge to determine what.

I'll take it up with the markdown-mode maintainer as you suggested.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants