Next: Motion, Previous: Installation, Up: Top
Certain characters when inserted in Emacs have
electricity. Emacs recognizes them as “electric”
and automatically reacts in some way to their insertion.
This is unlike the self-insert-command
– the
conventional manner Emacs inserts most characters into the
buffer and without side-effect.
For example, the indent commands for programming language modes – including PHP mode – are electric. Hitting TAB (or C-i) typically indents the line to the correct column based on the nested declaration blocks or conditional (control) syntax statements. Other examples of electric characters include braces ({ and }), characters related to comments (#, / and *), and semicolons. Inserting “electric” characters causes the line to be automatically be indented appropriately by PHP mode.
Should PHP mode ever do something you wish it didn't, like
indenting incorrectly after inserting a character when you
wish it didn't, then you've been electrocuted. To
avoid this, use quoted-insert
by prefixing the
character with C-q. For example, C-q TAB for a
tab. Alternatively, disable the electric effect of PHP mode
with C-c C-l. Issue C-c C-l again to activate
the electric effect again.