emacs-devel
[Top][All Lists]
Advanced

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

Re: A bad indentation made by C


From: Lennart Borgman (gmail)
Subject: Re: A bad indentation made by C
Date: Sun, 22 Apr 2007 14:42:00 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666

Alan Mackenzie wrote:
Hi, Lennart!

Hi, Alan!

On Sun, Apr 22, 2007 at 01:28:25PM +0200, Lennart Borgman (gmail) wrote:
but for php-mode.el. The php-mode I am using/distributing is derived from c-mode. It uses c-indent-line. That works in many circumstances but not all.

Just as an aside, your bug report could have been a little more
detailed and helpful, for example by saying where you got php-mode.el
from (it isn't part of Emacs 22), and being a bit more precise about the
indentation (you've pictured the "for" starting at column 2 despite
having said "on top level").  It could have been MUCH more helpful by
dumping CC Mode's configuration (C-c C-b).  :-)

Well everyone knows my bug reporting skills ;-)

Yes, you are right, but I actually hoped that you should guess the right things.


However, assuming that the "for" is really at column 0, and that
php-mode.el came from <http://php-mode.sourceforge.net/>

A rather annoying indentation is the following

  for (;;) {
   }

This happens only if the for-loop is on top level, but that happens
all the time in PHP. Maybe that little thing could be changed in
c-indent-line? Or maybe someone can help me a bit to fix this in
php-mode.el?

As a pure guess, the indentation of the "}" to column 1 probably comes
from `c-gnu-impose-minimum' which is installed on c-special-indent-hook
for the style "gnu".  If you set a different style (e.g. by C-c .), this
problem might go away.  Or remove it from c-special-indent-hook in
php-mode-hook or one of CC Mode's hooks.

Thanks, that helped. But now I have one of my favourite questions I seldom ask: How do I make a local hook so much nil so that the global hook is not run?


The php-mode.el at SourceForge, when I last looked at it, didn't look
like it was being actively maintained.  The latest release was from
2003, and it didn't appear to have been updated for CC Mode 5.30 (which
superseded 5.28 in summer 2003).

I have tried to contact the author, Turadg, but he has not replied (yet).


I think that php-mode.el needs a serious amount of work done on it to
bring it up to date with the current CC Mode.  It would probably be
better to wait till after the release to do this.  ;-)

I have done a bit of work on it, but not very much since I do not understand most of it.

I have uploaded the slightly changed version here:

  http://ourcomments.org/Emacs/DL/elisp/

Otherwise it is part of nXhtml. There are some problem with my webhost right now so it may be difficult to retrieve it. Mail me if you want it.

If you want to have a look at it it would be nice. I think that there can be some interest in it again, especially when used in nXhtml (or something similar perhaps).




reply via email to

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