Go to the first, previous, next, last section, table of contents.

How do I tell Emacs to automatically indent a new line to the

 indentation of the previous line?

One solution is Indented Text Mode (M-x indented-text-mode).

If you have Auto-Fill mode on (a minor mode, see section How do I turn on Auto-Fill mode 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.

NOTE: 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. Look up `fill' and `indent' in the Lisp Code Directory for guidance.


Go to the first, previous, next, last section, table of contents.