From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: A bad indentation made by C Date: Sun, 22 Apr 2007 14:42:00 +0200 Message-ID: <462B5818.8030008@gmail.com> References: <462B46D9.3050003@gmail.com> <20070422132250.GA2402@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1177245817 16536 80.91.229.12 (22 Apr 2007 12:43:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 Apr 2007 12:43:37 +0000 (UTC) Cc: Eric Lilja , Emacs Devel To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 22 14:43:30 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HfbPU-0005V9-Uh for ged-emacs-devel@m.gmane.org; Sun, 22 Apr 2007 14:43:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HfbUb-0003Ig-IB for ged-emacs-devel@m.gmane.org; Sun, 22 Apr 2007 08:48:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HfbUZ-0003Ib-4a for emacs-devel@gnu.org; Sun, 22 Apr 2007 08:48:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HfbUT-0003IC-LV for emacs-devel@gnu.org; Sun, 22 Apr 2007 08:48:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HfbUT-0003I9-Fg for emacs-devel@gnu.org; Sun, 22 Apr 2007 08:48:29 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HfbOy-0002Bx-Ej for emacs-devel@gnu.org; Sun, 22 Apr 2007 08:42:50 -0400 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:62387 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1HfbOH-0000Mr-97; Sun, 22 Apr 2007 14:42:07 +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 In-Reply-To: <20070422132250.GA2402@muc.de> X-Antivirus: avast! (VPS 000735-1, 2007-04-21), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1HfbOH-0000Mr-97. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1HfbOH-0000Mr-97 e7232443582bf79c39b9abf97e6beccf X-detected-kernel: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:69795 Archived-At: 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 > >> 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).