From: Alan Mackenzie <acm@muc.de>
To: "Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>
Cc: emacs-pretest-bug@gnu.org
Subject: bug#880: 23.0.60; c-mode indentation and php
Date: Thu, 4 Sep 2008 08:33:17 +0000 [thread overview]
Message-ID: <20080904083317.GA1611@muc.de> (raw)
In-Reply-To: <48BF02CC.1010704@gmail.com>
Hi, Lennart,
On Wed, Sep 03, 2008 at 11:34:04PM +0200, Lennart Borgman (gmail) wrote:
> In php-mode.el (not yet a part of Emacs, but has been discussed for
> inclusion) c-indent-line is used for indentation.
UUURRRKKK!!!
> That works nicely for the php code part of a php template page, but
> there is a disturbing glitch that probably can be fixed.
> Constructs like the one below are rather common.
> if (1) {
> ?>
> ...
> <?php
> }
> If you try to indent the line with the single "}" in c-mode it does not
> get aligned with "if (1) {". I have narrowed this down to
> if (1) {
> ?php
> }
> Adding a semicolon after "?php" makes everything work.
Without the semicolon, the close brace is on a "statement continued"
(statement-cont) line.
> Is the current indentation behaviour in this case useful in some way?
Yes. I'm characterising your "in this case" as "after a line lacking ;
or }". It's essential to normal C indentation. E.g.:
a = b + c // no semicolon
+ d ; // statement-cont (use C-s C-c) gets more indentation.
> Is there some option to change it?
Yes. Write a PHP-specific function to determine whether a line ends with
a "virtual semicolon", and set `c-at-vsemi-p-fn' to this function. This
mechanism is used for AWK Mode, and is described in detail in cc-defs.el
(search for "virtual").
> The example came from a bug report/question for nXhtml:
> https://answers.launchpad.net/nxhtml/+question/43320
> In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
> of 2008-09-03
> Windowing system distributor `Microsoft Corp.', version 5.1.2600
> configured using `configure --with-gcc (3.4) --no-opt --cflags
> -Ic:/g/include -fno-crossjumping'
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2008-09-04 8:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-03 21:34 bug#877: 23.0.60; c-mode indentation and php Lennart Borgman (gmail)
2008-09-04 8:33 ` Alan Mackenzie [this message]
2008-09-04 16:42 ` bug#880: " Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080904083317.GA1611@muc.de \
--to=acm@muc.de \
--cc=880@emacsbugs.donarmstrong.com \
--cc=emacs-pretest-bug@gnu.org \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.