I added the following settings to my dot-Emacs:

(add-hook 'org-mode-hook 'turn-on-auto-fill)
(add-hook 'org-mode-hook
        (lambda() (set-fill-column 80)))

When I'm typing sentences in an existing Org-file which are longer than 80 columns, it places on the next line in the Org-file. It works fine.

However, I have in the same Org-file already sentences that I typed in the past, which are longer than 80 columns.

How could I tell Emacs that he must format all sentences in the buffer which are longer than 80 columns. So that the existing words, which exceed 80 columns-limit will begin on the next line?


If you don't mind filling paragraphs rather than just individual sentences, the simplest way to do it is probably to select the entire buffer and use fill-region. Here's a simple command that will automate the process:

(defun fill-buffer ()
      (fill-region (point-min) (point-max)))))
  • Simple, and such clever. Dan, you still manage to amaze me with such commands that I would spent many hours looking up and I could never worked out then.
    – ReneFroger
    Nov 15 '15 at 22:17
  • 1
    @ReneFroger: thanks. As you get more experience working with elisp, some of these things will become like second nature. Never stop learning!
    – Dan
    Nov 15 '15 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.