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: Alan Mackenzie
Subject: Re: A bad indentation made by C
Date: 22 Apr 2007 14:02:26 +0200
Date: Sun, 22 Apr 2007 14:22:50 +0100
User-agent: Mutt/1.5.9i

Hi, Lennart!

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).  :-)

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.

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 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.  ;-)

-- 
Alan Mackenzie (Ittersbach, Germany)




reply via email to

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