2

Is it possible to wrap text automatically at 80 column length? I mean, writing code or text and then, when I reach 80 characters, put a breakline and continue on the next line (not wrapping the word but putting on the next line).

Thank you!

2 Answers 2

3

You can customize fill-column or do (setq-default fill-column 80) in your init file and use auto-fill-mode.

You can activate it per mode by using (add-hook 'text-mode-hook 'turn-on-auto-fill) or with key binding: (global-set-key (kbd "C-c q") 'auto-fill-mode). See emacswiki for more.

4
  • I did it, but it doesn't work :(
    – user11867
    Jul 24, 2016 at 11:21
  • Did you also try auto-fill-mode?
    – theldoria
    Jul 24, 2016 at 11:23
  • Yes, and it only add spaces when the 80 characters are reached...
    – user11867
    Jul 24, 2016 at 11:58
  • 1
    OP: Try starting from emacs -Q (no init file). If you still see a problem then provide a step-by-step recipe to reproduce it, saying what you see at each step and what you expected to see. If you do not see a problem, with emacs -Q, then recursively bisect your init file to find where you are introducing the problem.
    – Drew
    Jul 24, 2016 at 15:47
1

I know you asked for "automatically" (and 5 years ago...) but...

I do it manually with the command fill-paragraph (M-Q). Having (setq fill-column 80) in the init file. It even understands some text structure, e.g. that the text is a comment. Which could be good or bad, depending on your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.