emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

js-mode not working properly with mmm-mode


From: Darren Hoo
Subject: js-mode not working properly with mmm-mode
Date: Wed, 29 Sep 2010 10:55:25 +0800

Hi,
here's my config of mmm-mode:
       (setq mmm-global-mode 'html-mode)
       (mmm-add-mode-ext-class 'html-mode nil 'html-js)
       (mmm-add-mode-ext-class 'html-mode nil 'embedded-css)

when editing an html file with javacript in it and M-x mmm-parse-buffer
font-lock on the script fails with:
      js--ensure-cache: Wrong type argument: stringp, nil
      Error during redisplay: (wrong-type-argument stringp nil)

the problem is that js--quick-match-re-func is nil which make regex
search fails.
So I made this change:

--- -   2010-09-29 10:34:38.038867089 +0800
+++ js.el       2010-09-29 10:33:44.010224625 +0800
@@ -1098,6 +1098,7 @@

           (narrow-to-region (point-min) limit)

+         (or js--quick-match-re-func (js--update-quick-match-re))
           (loop while (re-search-forward js--quick-match-re-func nil t)
                 for orig-match-start = (goto-char (match-beginning 0))
                 for orig-match-end = (match-end 0)


I've made some changes to the original mmm-mode because of  its bugs,
I wonder whether the above bug is brought by the changes I made with
mmm-mode:

diff -r 2b86df1ec776 mmm-region.el
--- a/mmm-region.el     Sun Sep 26 19:53:58 2010 +0800
+++ b/mmm-region.el     Wed Sep 29 10:38:55 2010 +0800
@@ -415,14 +415,15 @@
        (overlay-put back-ovl 'region region-ovl)
        (overlay-put back-ovl 'match match-back)))
     ;; Update everything and run all the hooks
-    (mmm-save-all
-     (goto-char (overlay-start region-ovl))
-     (mmm-set-current-submode submode)
-     (mmm-set-local-variables submode)
-     (mmm-run-submode-hook submode)
-     (when creation-hook
-       (funcall creation-hook))
-     (mmm-save-changed-local-variables region-ovl submode))
+    (and (overlay-start region-ovl)
+        (mmm-save-all
+         (goto-char (overlay-start region-ovl))
+         (mmm-set-current-submode submode)
+         (mmm-set-local-variables submode)
+         (mmm-run-submode-hook submode)
+         (when creation-hook
+           (funcall creation-hook))
+         (mmm-save-changed-local-variables region-ovl submode)))
     (setq mmm-previous-submode submode
           mmm-previous-overlay region-ovl)
     (mmm-update-submode-region)
diff -r 2b86df1ec776 mmm-utils.el
--- a/mmm-utils.el      Sun Sep 26 19:53:58 2010 +0800
+++ b/mmm-utils.el      Wed Sep 29 10:38:55 2010 +0800
@@ -78,7 +78,11 @@
     (save-match-data
       (dolist (pair arg-pairs)
         (while (string-match (car pair) string)
-          (setq string (replace-match (cdr pair) t t string))))))
+          (setq string (replace-match
+                       (if (fboundp 'format-mode-line)
+                           (format-mode-line (cdr pair))
+                         (cdr pair))
+                       t t string))))))
   string)

 (defun mmm-format-matches (string &optional on-string)

The first hunk is to deal with things like:
    <script src="test.js"></script>
ie: emtpy between script tag which mmm-mode does not handle well.

and the second hunk is from  http://bugs.gentoo.org/311259



reply via email to

[Prev in Thread] Current Thread [Next in Thread]