Indentation error when coding in php

Bug #463136 reported by Cheney Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nXhtml
Fix Released
Medium
Unassigned

Bug Description

Recently I am using nxhtml+emacsw32, but I find a very confusing
problem..
when I type <?php
The first line has a very well indentation, just like
<?php
    echo "test";
But when the second line is completed, when I press ";", the whole
line will move to the leftmost, it looks like
<?php
    echo "test";
echo "test2";
#
The cursor will move to the location of "#' above...

I think the right way should be
<?php
    echo "test";
    echo "test2;
#

I never change the emacs config file..
I am very troubled by this problem..
I don't know if this is a new bug?

Revision history for this message
lborgman (lennart-borgman) wrote :

Hi Cheney, thanks for the bug report. I need some more information:

- Are you using the latest nXhtml? Otherwise please try that and tell me how it works.

- Could you please give a more complete example? How does the start of the file look?

Revision history for this message
Cheney Chen (cheneytiod) wrote :

Hi, lborgman...

I'm very happy to see your reply...

I am new to Emacs, if I made any stupid mistakes, don't laugh at me ....

I downloaded EmacsW32 from this page : http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl, the EmacsW32 version is 1.58 and I changed the nxHtml in the patched file by the latest version which is 1.99.

The full code is like this:

<table border = "0">
  <tr bgcolor = "#cccccc">
    <td align = "center" width = "100"> Class ID </td>
    <td align = "center" width = "100"> Credit </td>
    <td align = "center" width = "100"> Grade </td>
  </tr>

  <?php
   echo "test"; // first line is good
echo "test2"; // if I go on coding it will be like this
echo "test3";

   $classqty = $_POST["num"];
   for ($i=1; $i<=$classqty; $i++)
     {
       echo '<tr>';
       echo '<td align = "center">'.$i.'</td>';
       echo '<td align = "center"> <input type = "text" name = "c'.$i.'" size = "3" maxlength = "2"/> </td>';
       echo '<td align = "center"> <input type = "text" name = "g'.$i.'" size = "3" maxlength = "3"/> </td>';
     }
  ?>
</table>

My .emacs file is like this:

(put 'dired-find-alternate-file 'disabled nil)

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(nxhtml-load t))

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )

I still find that if I use c-m-\ to indent all the codes, everything will be fine...
Can these informations help you? I'm very very very looking forward to your reply...

Revision history for this message
lborgman (lennart-borgman) wrote :

I am not sure what do to with this. I have sent an Emacs bug report, see

  http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4828

Changed in nxhtml:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Cheney Chen (cheneytiod) wrote :

Thank you a lot..
I hope this can be fixed soon..
I really want to coding well in nXhtml. Do you have any other way to try to let it work well?May be close the indentation when I type ";"?

Revision history for this message
lborgman (lennart-borgman) wrote :

You can probably write a function that you put on the the key ";" that just does:

- Insert the character ";"
- Call indent-according-to-mode

Revision history for this message
Cheney Chen (cheneytiod) wrote :

I'm sorry...It's too difficult for me to write a function by lisp, could you give me the codes, thanks a lot!

Revision history for this message
lborgman (lennart-borgman) wrote :

Hi Cheney,

I have suggested a fix for the problem in Emacs. Please go to the Emacs bug report if you want to get it. (It is only one line that should be changed. The changed file must be byte compiled afterwards.)

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.