Error When Indenting

Bug #585800 reported by Chris Van Dusen on 2010-05-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nXhtml
Medium
Unassigned

Bug Description

Just after opening a file containing just PHP, I tried to indent and received the following error. Is there a conflict with yasnippet?

I would also like to use company-mode and flymake-mode with PHP files. Do you know if I'm going to run into this same kind of issue?

Debugger entered--Lisp error: (error "indent-line-in-mirror error at pos 1943, php-mode, lines not eq after indentation")
  signal(error ("indent-line-in-mirror error at pos 1943, php-mode, lines not eq after indentation"))
  error("indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" 1943 php-mode)
  apply(error "indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" (1943 php-mode))
  msgerr("indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" 1943 php-mode)
  (if (or (with-current-buffer for-buffer ...)) nil (msgerr "indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" line-end major))
  (unless (or (with-current-buffer for-buffer ...)) (msgerr "indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" line-end major))
  (if (string= line-in-src line-in-mirror) nil (unless (or ...) (msgerr "indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" line-end major)))
  (unless (string= line-in-src line-in-mirror) (unless (or ...) (msgerr "indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" line-end major)))
  (let* ((major ...) (for-buffer ...) (mirror-buf ...) new-ind line-in-mirror line-in-mirror-is-blank line-in-src) (msgtrc "indent-in-mirror [%s]: %S line-end=%s" major chunk line-end) (with-current-buffer mirror-buf (goto-char line-beg) (funcall indent-line-function) (back-to-indentation) (setq new-ind ...) (setq line-in-mirror-is-blank ...) (setq line-in-mirror ...)) (with-current-buffer for-buffer (save-restriction ... ... ... ... ... ...)) (unless (string= line-in-src line-in-mirror) (unless ... ...)))
  mumamo-indent-line-in-mirror(#<overlay from 1 to 105347 in EventTemplateController.php> 1943 1943)
  (save-restriction (widen) (mumamo-indent-line-in-mirror chunk (point-at-bol) (point-at-eol)))
  mumamo-call-indent-line(#<overlay from 1 to 105347 in EventTemplateController.php>)
  (progn (activate-change-group --change-group-handle--) (mumamo-call-indent-line (nth 0 this-line-chunks)) (when (= 0 ...) (setq ind-zero t) (goto-char ...) (widen) (setq ind-on-first-sub-line ...) (goto-char here) (signal ... nil)) (setq --change-group-success-- t))
  (unwind-protect (progn (activate-change-group --change-group-handle--) (mumamo-call-indent-line ...) (when ... ... ... ... ... ... ...) (setq --change-group-success-- t)) (if --change-group-success-- (accept-change-group --change-group-handle--) (cancel-change-group --change-group-handle--)))
  (let ((--change-group-handle-- ...) (undo-outer-limit nil) (undo-limit most-positive-fixnum) (undo-strong-limit most-positive-fixnum) (--change-group-success-- nil)) (unwind-protect (progn ... ... ... ...) (if --change-group-success-- ... ...)))
  (atomic-change-group (mumamo-call-indent-line (nth 0 this-line-chunks)) (when (= 0 ...) (setq ind-zero t) (goto-char ...) (widen) (setq ind-on-first-sub-line ...) (goto-char here) (signal ... nil)))
  (condition-case nil (atomic-change-group (mumamo-call-indent-line ...) (when ... ... ... ... ... ... ...)) (mumamo-error-ind-0))
  (save-restriction (mumamo-update-obscure chunk here) (let (...) (narrow-to-region ... ...)) (condition-case nil (atomic-change-group ... ...) (mumamo-error-ind-0)) (when ind-zero (setq want-indent-major ...) (save-excursion ... ...)))
  (let ((chunk ...) (font-lock-dont-widen t) ind-zero (here ...) ind-on-first-sub-line) (save-restriction (mumamo-update-obscure chunk here) (let ... ...) (condition-case nil ... ...) (when ind-zero ... ...)))
  (if (mumamo-fun-eq this-line-major1 main-major) (let (... ...) (mumamo-msgindent " In main major mode") (forward-line 0) (skip-chars-backward " \n
\f") (forward-line 0) (if ... ... ... ...) (mumamo-msgindent " In main major mode B") (setq last-parent-major-indent ...)) (mumamo-msgindent " In sub major mode") (let (... ... ind-zero ... ind-on-first-sub-line) (save-restriction ... ... ... ...)))
  (cond (template-indent-abs (setq want-indent ...)) (leaving-submode (mumamo-msgindent " leaving last-parent-major-indent=%s" last-parent-major-indent) (if ... ... ... ...)) (entering-submode (setq this-line-indent-major ...) (mumamo-msgindent " this-line-indent-major=%s, major-mode=%s this0=%s" this-line-indent-major major-mode this-line-major0) (mumamo-msgindent " mumamo-submode-indent-offset=%s" mumamo-submode-indent-offset) (unless ... ...) (setq want-indent ...) (unless ... ...) (when ... ...) (if want-indent ... ...) (mumamo-msgindent " enter sub.want-indent=%s, curr=%s, last-main=%s" want-indent ... last-parent-major-indent)) (t (setq this-line-indent-major ...) (mumamo-msgindent " this-line-indent-major=%s" this-line-indent-major) (unless ... ...) (if ... ... ... ...)))
  (let* ((start-point ...) (prev-line-chunk0 ...) (prev-line-chunk2 ...) (prev-line-chunk3 ...) (prev-line-major0 ...) (prev-line-major1 ...) (prev-line-major2 ...) (prev-line-major3 ...) (prev-depth0 ...) (prev-depth2 ...) (prev-depth3 ...) (this-line-chunks ...) (this-line-chunk0 ...) (this-line-chunk2 ...) (this-line-chunk3 ...) (this-line-major0 ...) (this-line-major1 ...) (this-line-major2 ...) (this-line-major3 ...) (this-depth0 ...) (this-depth2 ...) (this-depth3 ...) this-line-indent-major major-indent-line-function (main-major ...) (old-indent ...) (next-entering-submode ...) (entering-submode ...) (leaving-submode ...) want-indent want-indent-major got-indent (here-on-line ...) this-pending-undo-list (n1-while 0) (n2-while 0) (n3-while 0) (this-line-indentor-chunk ...) (this-line-indentor-prev ...) (this-line-is-indentor ...) (this-template-shift ...) (prev-template-indentor ...) (prev-template-shift-rec ...) (template-shift ...) (template-indent-abs ...)) (when template-shift (unless template-indent-abs)) (when (and leaving-submode entering-submode) (message "Do not know how to indent here (both leaving and entering sub chunks)")) (when (or leaving-submode entering-submode) (unless last-parent-major-indent ...)) (mumamo-msgindent " leaving-submode=%s, entering-submode=%s" leaving-submode entering-submode) (cond (template-indent-abs ...) (leaving-submode ... ...) (entering-submode ... ... ... ... ... ... ... ... ...) (t ... ... ... ...)) (when want-indent (indent-line-to want-indent) (when want-indent-major ...)) (goto-char here-on-line) (list this-line-chunks last-parent-major-indent next-entering-submode))
  mumamo-indent-line-function-1(nil nil nil)
  (let ((here ...) fontification-functions rng-nxml-auto-validate-flag (before-text ...)) (mumamo-indent-line-function-1 nil nil nil) (if before-text (back-to-indentation) (goto-char here)))
  mumamo-indent-line-function()
  indent-for-tab-command(nil)
  call-interactively(indent-for-tab-command)
  (progn (setq this-command command) (call-interactively command))
  (if (and (commandp command) (not ...)) (progn (setq this-command command) (call-interactively command)))
  (when (and (commandp command) (not ...)) (setq this-command command) (call-interactively command))
  (let* ((yas/minor-mode nil) (yas/direct-keymaps nil) (keys-1 ...) (keys-2 ...) (command-1 ...) (command-2 ...) (command ...)) (when (and ... ...) (setq this-command command) (call-interactively command)))
  (cond ((eq yas/fallback-behavior ...) nil) ((eq yas/fallback-behavior ...) (let* ... ...)) ((and ... ... ...) (if ... ... ...)) (t nil))
  yas/fallback(trigger-key)
  (if (and templates-and-pos (first templates-and-pos)) (yas/expand-or-prompt-for-template (first templates-and-pos) (second templates-and-pos) (third templates-and-pos)) (yas/fallback (quote trigger-key)))
  (let (templates-and-pos) (unless (and yas/expand-only-for-last-commands ...) (setq templates-and-pos ...)) (if (and templates-and-pos ...) (yas/expand-or-prompt-for-template ... ... ...) (yas/fallback ...)))
  yas/expand()
  call-interactively(yas/expand nil nil)

Thanks,
Chris.

Changed in nxhtml:
importance: Undecided → Medium
status: New → In Progress
lborgman (lennart-borgman) wrote :

Hi Chris, thanks for the bug report.

I see you are using a recent checkout, because the error is from the new indentation code. That is not quite ready yet and I expect some bugs.

Could you please tell me more exactly what you are doing, including a small example? This error might have something to do with using templates, but I am not sure (have not thought of it yet).

flymake-mode should work just as before, it is only indentation that is a bit more shaky now.

I am not sure about company-mode at the moment. I do not remember because I gave up myself on using since it had some problems for my use cases. (I have taken that up on the Emacs developers list. We need a new way of handling menus like those company-mode uses.) However for php files I think the only problem would be that minor mode variables used by company-mode might get killed because they are not properly protected when changing major mode. If you see such problems then please send a bug report here.

Lennart,

I left out an important detail in my initial report. I had just opened the file. The part that I left out was that I typed ')' in the buffer and saw this message in the minibuffer:

MU:update-cmirr-buffer [php-mode] to-point=416

I removed the open paren via undo, then pressed TAB, and got the error that I originally sent. After I sent the bug, I pressed 'q' in the Backtrace buffer and got the following error. (I'm attaching it since it's not pasting in the Comment box.)

Thanks,
Chris.

I received a similar error when pressing TAB in a section of code that was in Javascript/nxhtml mode:

Debugger entered--Lisp error: (error "indent-line-in-mirror error at pos 1357, js-mode, lines not eq after indentation")
  signal(error ("indent-line-in-mirror error at pos 1357, js-mode, lines not eq after indentation"))
  error("indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" 1357 js-mode)
  apply(error "indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" (1357 js-mode))
  msgerr("indent-line-in-mirror error at pos %d, %s, lines not eq after indentation" 1357 js-mode)
  mumamo-indent-line-in-mirror(#<overlay from 548 to 1362 in createlocation.php> 1357 1357)
  mumamo-call-indent-line(#<overlay from 548 to 1362 in createlocation.php>)
  byte-code("\306 \307\211\307

\310\216\311
!\210\312@!\210\313 \314U\2033

lborgman (lennart-borgman) wrote :

Thanks, Chris for the details. However some small example files would also be good. (Attaching backtraces and files is always much better than pasting the content in the comment field here.)

Here's a typical file that gives me the error I first described.

lborgman (lennart-borgman) wrote :

Thanks Chris,

I think I have fixed the problem you reported first. I do not think that problem has anything to do with template packages like yasnippets.

What really helped me to find the problem was the detailed instructions, i.e. that you had deleted what you inserted again. It was a small, but important bug. (One of those +-1 position bugs that are a bit hard to find before testing.)

The messages you see now ("MU:...") are trace messages that can help me catch bugs before releasing 2.09.

Could you please test and tell me if the new beta 2.09 I just uploaded works? If you see any problem with yasnippets then please report that as a separate bug (it could be a bit complicated if there is a bug, but I think I know what to do if there is one).

Lennart,

It's fixed for the test case that first revealed the bug.

I didn't think that yasnippet was the culprit, but I noticed it at the bottom of the backtrace.

Thanks for addressing this so quickly.

Chris.

Changed in nxhtml:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers