8000 Vue mode, derived from mmm-mode, fails with latest version · Issue #112 · dgutov/mmm-mode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Vue mode, derived from mmm-mode, fails with latest version #112
Open
@garyo

Description

@garyo

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.

Debugger entered--Lisp error: (cl-assertion-failed ((>= (cadr sgml--syntax-propertize-ppss) 0) nil))
  cl--assertion-failed((>= (cadr sgml--syntax-propertize-ppss) 0))
  (or (>= (car (cdr sgml--syntax-propertize-ppss)) 0) (cl--assertion-failed '(>= (cadr sgml--syntax-propertize-ppss) 0)))
  (progn (or (>= (car (cdr sgml--syntax-propertize-ppss)) 0) (cl--assertion-failed '(>= (cadr sgml--syntax-propertize-ppss) 0))) nil)
  sgml-syntax-propertize(578 603)
  funcall(sgml-syntax-propertize 578 603)
  (cond (func (funcall func beg end)) (font-lock-syntactic-keywords (let ((syntax-propertize-function nil)) (font-lock-fontify-syntactic-keywords-region beg end))))
  (save-restriction (if mmm-current-overlay (progn (narrow-to-region (overlay-start mmm-current-overlay) (overlay-end mmm-current-overlay)))) (cond (func (funcall func beg end)) (font-lock-syntactic-keywords (let ((syntax-propertize-function nil)) (font-lock-fontify-syntactic-keywords-region beg end)))) (run-hook-with-args 'mmm-after-syntax-propertize-functions mmm-current-overlay mode beg end))
  (let* ((mode (car elt)) (func (get mode 'mmm-syntax-propertize-function)) (beg (car (cdr elt))) (end (nth 2 elt)) (ovl (nth 3 elt)) syntax-ppss-cache syntax-ppss-last) (goto-char beg) (mmm-set-current-pair mode ovl) (mmm-set-local-variables mode mmm-current-overlay) (save-restriction (if mmm-current-overlay (progn (narrow-to-region (overlay-start mmm-current-overlay) (overlay-end mmm-current-overlay)))) (cond (func (funcall func beg end)) (font-lock-syntactic-keywords (let ((syntax-propertize-function nil)) (font-lock-fontify-syntactic-keywords-region beg end)))) (run-hook-with-args 'mmm-after-syntax-propertize-functions mmm-current-overlay mode beg end)))
  (lambda (elt) (let* ((mode (car elt)) (func (get mode 'mmm-syntax-propertize-function)) (beg (car (cdr elt))) (end (nth 2 elt)) (ovl (nth 3 elt)) syntax-ppss-cache syntax-ppss-last) (goto-char beg) (mmm-set-current-pair mode ovl) (mmm-set-local-variables mode mmm-current-overlay) (save-restriction (if mmm-current-overlay (progn (narrow-to-region (overlay-start mmm-current-overlay) (overlay-end mmm-current-overlay)))) (cond (func (funcall func beg end)) (font-lock-syntactic-keywords (let (...) (font-lock-fontify-syntactic-keywords-region beg end)))) (run-hook-with-args 'mmm-after-syntax-propertize-functions mmm-current-overlay mode beg end))))((vue-mode 578 603 nil))
  mapc((lambda (elt) (let* ((mode (car elt)) (func (get mode 'mmm-syntax-propertize-function)) (beg (car (cdr elt))) (end (nth 2 elt)) (ovl (nth 3 elt)) syntax-ppss-cache syntax-ppss-last) (goto-char beg) (mmm-set-current-pair mode ovl) (mmm-set-local-variables mode mmm-current-overlay) (save-restriction (if mmm-current-overlay (progn (narrow-to-region (overlay-start mmm-current-overlay) (overlay-end mmm-current-overlay)))) (cond (func (funcall func beg end)) (font-lock-syntactic-keywords (let (...) (font-lock-fontify-syntactic-keywords-region beg end)))) (run-hook-with-args 'mmm-after-syntax-propertize-functions mmm-current-overlay mode beg end)))) ((vue-mode 1 12 nil) (vue-html-mode 12 94 #<overlay from 12 to 94 in foo.vue</tmp>>) (vue-mode 94 125 nil) (nil 125 578 #<overlay from 125 to 578 in foo.vue</tmp>>) (vue-mode 578 603 nil) (css-mode 603 862 #<overlay from 603 to 862 in foo.vue</tmp>>) (vue-mode 862 871 nil)))
  (unwind-protect (mapc #'(lambda (elt) (let* ((mode (car elt)) (func (get mode ...)) (beg (car ...)) (end (nth 2 elt)) (ovl (nth 3 elt)) syntax-ppss-cache syntax-ppss-last) (goto-char beg) (mmm-set-current-pair mode ovl) (mmm-set-local-variables mode mmm-current-overlay) (save-restriction (if mmm-current-overlay (progn ...)) (cond (func ...) (font-lock-syntactic-keywords ...)) (run-hook-with-args 'mmm-after-syntax-propertize-functions mmm-current-overlay mode beg end)))) (mmm-regions-in start stop)) (mmm-set-current-pair saved-mode saved-ovl) (mmm-set-local-variables (or saved-mode mmm-primary-mode) saved-ovl))
  (let ((saved-mode mmm-current-submode) (saved-ovl mmm-current-o
6661
verlay)) (mmm-save-changed-local-variables mmm-current-submode mmm-current-overlay) (unwind-protect (mapc #'(lambda (elt) (let* ((mode ...) (func ...) (beg ...) (end ...) (ovl ...) syntax-ppss-cache syntax-ppss-last) (goto-char beg) (mmm-set-current-pair mode ovl) (mmm-set-local-variables mode mmm-current-overlay) (save-restriction (if mmm-current-overlay ...) (cond ... ...) (run-hook-with-args ... mmm-current-overlay mode beg end)))) (mmm-regions-in start stop)) (mmm-set-current-pair saved-mode saved-ovl) (mmm-set-local-variables (or saved-mode mmm-primary-mode) saved-ovl)))
  mmm-syntax-propertize-function(1 871)
  syntax-propertize(871)
  mmm-apply-all()
  mmm-parse-buffer()
  vue-mode-reparse()
  funcall-interactively(vue-mode-reparse)
  call-interactively(vue-mode-reparse nil nil)
  command-execute(vue-mode-reparse)

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):

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'vue-mode)

The vue file for testing is this. Just load it, and if needed do C-c C-l to reparse.

<template>
  <div class="review">
    <v-container class="pt-0">
    </v-container>
  </div>
</template>
<script lang="ts">
@Component({
  components: {
    VuePerfectScrollbar,
  }
})
export default class Review extends Vue {

  sortedTasks(taskGroupIds: string[]) {
    const copy = [...taskGroupIds]
    return copy.sort((e1, e2) => {
      return this.taskGroupDates[e2].seconds - this.taskGroupDates[e1].seconds
    })
  }

  shot(shotId: string) {
    return shotStore?.shots.find(shot => shot.id === shotId)
  }

  async mounted() {
    await this.getPostDocs()
  }
}
</script>
<style scoped>
  .scroll-area {
    position: relative;
    margin: auto;
    height: 80vh;
  }
  .video-placeholder {
      width: 1066px;
      height: 100px;
      line-height: 100px;
      text-align: center;
      background-color: #8888aa;
      margin-bottom: 0;
  }
</style>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0