Rakesh D
Rakesh D

Reputation: 11

emacs auto formatting when I type space at end of line

Hi i have the following issue with my emacs:

When typing a long line, sometimes, when I type a space at the end of a line the line automatically gets split into multiple lines.

e.g. Line I am typing emacs: 'This is my line 1. This is my line 2. This is my line 3'%space%

emacs automatically formats this to: 'This is my line 1. %emacs adds new line%
This is my line 2. %emacs adds new line% This is my line 3 %space% Please help me fix this annoyance :)

Upvotes: 1

Views: 349

Answers (2)

Jeffrey DeLeo
Jeffrey DeLeo

Reputation: 1712

What you are seeing is a feature (grin). "Auto Fill" mode is a buffer-local minor mode in which lines are broken automatically when they become too wide. "Minor mode" means it is additional functionality which is associated with a buffer.

If you look at the emacs mode line, it will say "Auto Fill" if this is active. To turn it off for that buffer, M-x auto-fill-mode.

If for a particular major mode you would always like it on, you can turn it on by modifying the hook for that. For example, if every time you edit a text file, you would like auto-fill on, you can customize the variable text-mode-hook to turn it on.

M-x customize-variable

when prompted for the variable, say:text-mode-hook. You can use the same mechanism to turn it on (or off) for other modes.

Upvotes: 1

Drew
Drew

Reputation: 30708

Turn off auto-fill-mode: Put this in your init file, or do it for a particular mode on the mode hook: (auto-fill-mode).

Upvotes: 0

Related Questions