More fontification problems with PHP

Bug #753610 reported by nurikabe on 2011-04-07
38
This bug affects 8 people
Affects Status Importance Assigned to Milestone
nXhtml
Undecided
Unassigned

Bug Description

After using nXhtml for awhile, eventually fontification breaks. I'm not sure the cause, but the result is always the following for any .php file:

mumamo-fontify-region-with: fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))
MU:mumamo-fontify-region: fun-var-sym=mumamo-eval-in-php-mode, use-major-entry=(php-mode (mumamo-eval-in-php-mode mumamo-def-eval-in-php-mode mumamo-kw-eval-in-php-mode))
** In buffer _group.php
  backtrace()
  (let ((standard-output standard-output)) (backtrace))
  (progn (let (...) (backtrace)) (with-current-buffer standard-output (buffer-string)))
  (unwind-protect (progn (let ... ...) (with-current-buffer standard-output ...)) (kill-buffer standard-output))
  (let ((standard-output ...)) (unwind-protect (progn ... ...) (kill-buffer standard-output)))
  (with-output-to-string (backtrace))
  (let ((format-string2 ...) (bt ...)) (mumamo-message-with-face (concat ... "
" ... bt) (quote highlight)) (apply (quote message) format-string2 lwarn-type args) (run-with-idle-timer 1 nil (quote mumamo-show-report-message)) (when mumamo-display-error-stop (setq font-lock-mode nil) (when ... ...) (when ... ...) (apply ... format-string2 lwarn-type args)))
  mumamo-display-error(mumamo-fontify-region "%s" "fun-var-sym=mumamo-eval-in-php-mode, use-major-entry=(php-mode (mumamo-eval-in-php-mode mumamo-def-eval-in-php-mode mumamo-kw-eval-in-php-mode))")
  (condition-case err (mumamo-fontify-region-1 start end verbose) (error (mumamo-display-error ... "%s" ...)))
  (if (not mumamo-use-condition-case) (let* (... ...) (mumamo-fontify-region-1 start end verbose)) (condition-case err (mumamo-fontify-region-1 start end verbose) (error ...)))
  (mumamo-condition-case err (mumamo-fontify-region-1 start end verbose) (error (mumamo-display-error ... "%s" ...)))
  (if (and mumamo-just-changed-major nil (= 0 ...)) (mumamo-display-error (quote mumamo-fontify-region) "Just changed major, should not happen") (mumamo-condition-case err (mumamo-fontify-region-1 start end verbose) (error ...)))
  mumamo-fontify-region(1 297 nil)
  font-lock-fontify-region(1 297)
  run-hook-with-args(font-lock-fontify-region 1 297)
  byte-code("\302\303 #\207" [start next run-hook-with-args jit-lock-functions] 4)
  jit-lock-fontify-now(1 501)
  jit-lock-function(1)
  (let ((ret ...)) (mumamo-msgfntfy "mumamo-jit-lock-function EXIT %s, ff=%s, just-changed=%s" start (when start ...) mumamo-just-changed-major) ret)
  mumamo-jit-lock-function(1)

phil-s (phil-s) wrote :

I'm trying out the latest dev version of nxhtml from git (installed via el-get) in emacs 23.3.1 under Ubuntu 11.04, and I'm also seeing these errors.

Once it starts to happen, it seems a pretty much constant issue, and I can create a new empty buffer, switch to nxhtml-mumamo-mode, and immediately run into the error. Setting debug-on-error gives me the following in that situation:

Debugger entered--Lisp error: (error "fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))")
  signal(error ("fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))"))
  error("fun-var-sym=%S, use-major-entry=%S" mumamo-eval-in-html-mode (html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode)))
  mumamo-get-major-mode-setup(html-mode)
  mumamo-new-create-chunk(((1 1 nxhtml-mode nil nil nil (mumamo-chunk-xml-pi mumamo-chunk-alt-php mumamo-chunk-inlined-style mumamo-chunk-inlined-script mumamo-chunk-style= mumamo-chunk-onjs=) nil nil t) (nil nil nil 0 nil)))
  mumamo-find-chunks-1(1 "mumamo-get-chunk-save-buffer-state")
  mumamo-find-chunks(1 "mumamo-get-chunk-save-buffer-state")
  mumamo-get-chunk-save-buffer-state(1)
  mumamo-turn-on-actions(fundamental-mode)
  nxhtml-mumamo-mode()
  call-interactively(nxhtml-mumamo-mode t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

If I quit the debugger and then type something (e.g. SPC), I get:

Debugger entered--Lisp error: (error "fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))")
  signal(error ("fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))"))
  error("fun-var-sym=%S, use-major-entry=%S" mumamo-eval-in-html-mode (html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode)))
  mumamo-get-major-mode-setup(html-mode)
  mumamo-jit-lock-after-change-1(1 2 0 nxhtml-mode)
  mumamo-jit-lock-after-change(1 2 0)
  mumamo-after-change(1 2 0)

phil-s (phil-s) wrote :

Using edebug on mumamo-get-major-mode-setup, it's dying (fairly obviously) at line 3555:

    (unless (functionp (symbol-value fun-var-sym))
      (error "fun-var-sym=%S, use-major-entry=%S" fun-var-sym use-major-entry))

fun-var-sym is 'mumamo-eval-in-html-mode
(eq fun-var-sym 'mumamo-eval-in-html-mode) is true

(symbol-value fun-var-sym) is nil
hence (functionp (symbol-value fun-var-sym)) is nil and the error occurs.

phil-s (phil-s) wrote :

So the mumamo-eval-in-html-mode variable obviously has value nil when it shouldn't. When I do C-h v mumamo-eval-in-html-mode RET it tells me that the variable is defined in my desktop file, but I think that is just a consequence of desktop.el invoking the remembered major mode when it reloads the files. Still, I've expunged those files from the desktop file and will test without that factor.

phil-s (phil-s) wrote :

Okay, so if I don't load my desktop file, then start nxhtml, that variable has a value.

If I do load my desktop, I get a bunch of these messages:

File mode specification error: (error "fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))")

and also:
mumamo-eval-in-html-mode is a variable defined in `emacs.desktop'.
Its value is nil

phil-s (phil-s) wrote :

Hmmm.... this time that didn't happen, but I did re-save the desktop file after removing some buffers that were accessed via tramp's sudo method (I was getting annoyed by entering my password repeatedly with all of the restarts I was doing).

It still tells me that the variable is defined in my desktop file (I still have some .php files, so it's still getting invoked), but it now the variable has a proper value.

Well, this is interesting...

I decided to open another file via /sudo::/ (an apache virtual host config file), then saved the desktop file, quit, and restarted. That didn't change things.

I then looked at the desktop file and noticed that the sudo'd file appeared first in the list of files to restore. I manually put it last, saved the file, quit, restarted, and this time that variable had value nil.

phil-s (phil-s) wrote :

I didn't get any "File mode specification error" messages that time, though, FWIW.

phil-s (phil-s) wrote :

Okay, the whole desktop thing is probably a red herring, as I managed to replicate this without touching my desktop file; but it doesn't seem to be consistent, so I'm having difficulty finding what is actually triggering the behaviour I've been seeing.

phil-s (phil-s) wrote :

Is there any way to watch for changes to a variable?

I guess I could advise the various "set" functions to drop into the debugger if the variable is the one I'm interested in.

Any other ideas?

Damon Haley (damon-haley) wrote :

I am getting the same behavior in emacs 24.0.90.15.

I get this message when I open certain php files.

Debugger entered--Lisp error: (error "fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))")
  signal(error ("fun-var-sym=mumamo-eval-in-html-mode, use-major-entry=(html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode))"))
  error("fun-var-sym=%S, use-major-entry=%S" mumamo-eval-in-html-mode (html-mode (mumamo-eval-in-html-mode mumamo-def-eval-in-html-mode mumamo-kw-eval-in-html-mode)))
  mumamo-get-major-mode-setup(html-mode)
  mumamo-new-create-chunk(((1 1 nxhtml-mode 6 5045 nil (mumamo-chunk-xml-pi mumamo-chunk-alt-php mumamo-chunk-inlined-style mumamo-chunk-inlined-script mumamo-chunk-style= mumamo-chunk-onjs= mumamo-chunk-hrefjs=) nil nil t) (php-mode mumamo-search-fw-exc-end-xml-pi mumamo-find-borders-xml-pi 1 nil)))
  mumamo-find-chunks-1(1 "mumamo-turn-on-actions")
  mumamo-find-chunks(1 "mumamo-turn-on-actions")
  mumamo-turn-on-actions(fundamental-mode)
  nxhtml-mumamo-mode()
  mumamo-ad-set-auto-mode-0(nxhtml-mumamo-mode nil)
  set-auto-mode-0(nxhtml-mumamo-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer class/proposal.php> "/home/www/competitions_devel/comp_adm/class/proposal.php" nil nil "/home/www/competitions_devel/comp_adm_trunk/class/proposal.php" (5161304 65029))
  find-file-noselect("/home/www/competitions_devel/comp_adm/class/proposal.php" nil nil)
  ido-file-internal(raise-frame)
  ido-find-file()
  call-interactively(ido-find-file nil nil)
  recursive-edit()
  byte-code("\304\305\306\307!\310\230\203

I'm getting this too on 23.3.1 and nxhtml from bzr.

I haven't had a chance to track down the problem, and it's too sporadic to really pin down.

I was suspecting that it had something to do with recentf and/or desktop.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers