GNU Info

Info Node: (efaq)Automatic indentation

(efaq)Automatic indentation


Next: Matching parentheses Prev: Turning the volume down Up: Common requests
Enter node , (file) or (file)node

How do I tell Emacs to automatically indent a new line to the indentation of the previous line?
===============================================================================================

   Such behavior is automatic in Emacs 20 and later.  From the
`etc/NEWS' file for Emacs 20.2:

     ** In Text mode, now only blank lines separate paragraphs.  This makes
     it possible to get the full benefit of Adaptive Fill mode in Text mode,
     and other modes derived from it (such as Mail mode).  <TAB> in Text
     mode now runs the command `indent-relative'; this makes a practical
     difference only when you use indented paragraphs.
     
     As a result, the old Indented Text mode is now identical to Text mode,
     and is an alias for it.
     
     If you want spaces at the beginning of a line to start a paragraph, use
     the new mode, Paragraph Indent Text mode.

   If you have `auto-fill-mode' turned on (Note: Turning on auto-fill
by default), you can tell Emacs to prefix every line with a certain
character sequence, the "fill prefix".  Type the prefix at the
beginning of a line, position point after it, and then type `C-x .'
(`set-fill-prefix') to set the fill prefix.  Thereafter, auto-filling
will automatically put the fill prefix at the beginning of new lines,
and `M-q' (`fill-paragraph') will maintain any fill prefix when
refilling the paragraph.

   If you have paragraphs with different levels of indentation, you will
have to set the fill prefix to the correct value each time you move to a
new paragraph.  To avoid this hassle, try one of the many packages
available from the Emacs Lisp Archive (Note: Packages that do not come
with Emacs.)  Look up "fill" and "indent" in the Lisp Code Directory
for guidance.


automatically generated by info2www version 1.2.2.9