I'm using Emacs (24.4+1-5) and org mode for writing prose, which means that I need some mechanism for line wrapping that just works, and preferably the same way each time. At the moment I'm using visual-line-mode with fill-column set to 80. However, opening an old text file (having ascertained that org-mode, visual-line-mode, and the fill-column parameter are all set) and entering some additional text, the lines easily exceed 80 characters and have to be re-wrapped manually using M-q. What am I not getting here?

Here's my .emacs:

(setq sentence-end-double-space nil)

(add-hook 'text-mode-hook 'visual-line-mode)

(menu-bar-mode -1)

(defun margins ()

(setq left-margin-width 20)

(setq right-margin-width 20))

(add-hook 'text-mode-hook 'margins)

(setq-default fill-column 80)
  • I mean, for my purposes it doesn't really matter whether the lines are exactly 80 characters -- my preference would be for visual-line-mode to just take care of this by itself and wrap text according to the margins. But then I can't use M-q because it defaults to 70 characters.
    – Eirik S.
    May 1, 2016 at 11:11
  • Are you expecting visual-line-mode to do its soft-wrapping at fill-column? It doesn't. fill-column is for filling and nothing else. AFAIK visual-line-mode always soft-wraps at the width of the window. Filling text adds/removes newline characters. visual-line-mode does not modify the text at all. The two features are quite different.
    – phils
    May 1, 2016 at 11:50
  • auto-fill-mode is possibly what you're looking for? (I would suggest experimenting with it with visual-line-mode off.)
    – phils
    May 1, 2016 at 11:55
  • Well, I'd be happy with either. But just riddle me this: when processing an existing document in Emacs, the text width more often than not is not the same as the one dictated by visual-line-mode. Is there some command like the vi command vipJ that would join the lines to let visual-line-mode re-wrap them?
    – Eirik S.
    May 1, 2016 at 12:33
  • 1

1 Answer 1


Here's the answer to a post where I struggled with a similar problem concering visual-line-mode.

@YoungFrog describes how visual-line-mode works pretty well in a comment. Long story short, visual-line-mode involves only 'soft' new lines, i.e. it does not actually edit the formatting of your text at all, it only makes it look like your text is a certain line length. Further, it will allow you to modify the text as if the placement of the text, as presented by visual-line-mode, was real. However, the moment you turn visual-line-mode off, open a file without visual-line-mode, etc, you will see the true formatting of your text (read: messy, no new lines, ridiculous column lengths).

A very useful mode I discovered to overcome this while still keeping the nice formatting of visual-line-mode was a MELPA package called visual-line-column-mode that makes visual-line-mode wrap at fill-column when reached AND at the edge of the window. Together, you still get the visual benefit of visual-line-mode while also maintaining a healthy column length/formatting. In other words, visual line mode will now format your text according to 1) your column length and the 2) the edge of your screen. Set your column length to whatever you want, and it will handle the rest.

Your Answer

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

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