[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TAB button behavior in C mode and PHP mode
From: |
Stefan Monnier |
Subject: |
Re: TAB button behavior in C mode and PHP mode |
Date: |
Thu, 09 Dec 2010 10:15:05 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> When I edit code in C mode or PHP mode and make additional indentation
> using TAB Emacs doesn't input this tabs.
The direct answer is: C-q TAB
C-q is a very convenient command that's worth knowing.
The longer answer is that there are usually two cases:
- the indentation you want corresponds to a different indentation style,
in which case you should try and see if you con configure the major
mode so as to indent the way you like it. If you can't, then maybe
you should report it as a bug to the major mode's maintainer.
- the indentation you want does not correspond to a particular style,
but is due to particular circumstances at this precise location (or
in other words, it does correspond to a particular style, but there's
little hope to make Emacs understand this style). In that case, you
want C-q TAB (or use SPC which works wonders as well :-).
In some major modes (the ones using SMIE), you can tell the major mode
that the indentation you've setup on a particular line should be trusted
as gospel. For SMIE based modes, you do that by adding a special
comment at the end of that line like /* fixindent */. For one-off
occurrences it can be convenient.
Stefan