This is similar to There's a way to use emacs like MS Word, to make text permanently colored, stylized, etc...? However, I do only wish to preserve linebreaks so that the pasted raw text from word looks somewhat readable and not just one long line. Are there any utilities in Emacs to achieve this?

  • Maybe, you are actually looking for visual-line-mode. You can switch that on by the menu item Options -> Line Wrapping In This Buffer -> Word Wrap (Visual Line Mode). I suggest to combine it with adaptive-wrap.
    – Tobias
    Jul 22, 2019 at 12:34
  • @Tobias Thank you for a quick response. I just tried it. It does not quite do what I need it to do. It looks like I want however when I copy-paste it into notepad I lose the linebreaks. So it is similar to the question I linked but I am not quite looking for the same thing I think. Using white-space mode I can see that no line breaks have been inserted
    – JKRT
    Jul 22, 2019 at 12:39
  • Are the linebreaks preserved when you copy directly from Word to Notepad? Note, that I very much assume that there are no linebreaks in the text copied from Word but Word also does linewrapping.
    – Tobias
    Jul 22, 2019 at 12:45
  • Sorry for not being familiar with the lingo Tobias. I basically want to keep the linebreaks as Emacs displays them in adaptive-wrap. When pasting to notepad
    – JKRT
    Jul 22, 2019 at 13:06
  • I figured out how to do it, alt q!
    – JKRT
    Jul 22, 2019 at 13:32

2 Answers 2


The linebreaks in a paragraph of a word document are usually not hard.

Therefore, in the text that you copy and paste from Word there are no linebreaks to be kept.

You can use Visual line mode (Menu item Options -> Line Wrapping in This Buffer -> Word Wrap (Visual Line Mode)) to get a similar filling of paragraphs in Emacs.

I suggest to use it in combination with adaptive-wrap. That mode can be installed from elpa with install-package.

Visual line mode adapts the line filling to the window-width. Thereby you can adjust the width of the text with the mouse by resizing Emacs or the window border.

If you want to keep the line ends found by Visual line mode for copying and pasting you can use the following command make-visual-lines-hard.

(require 'adaptive-wrap)
(defun make-visual-lines-hard (&optional beg end)
  "Insert ?\\n at each visual line end which is not a hard line end."
  (when (and (called-interactively-p 'any)
    (setq beg (region-beginning)
      end (set-marker (make-marker) (region-end))))
    (goto-char (or beg (point-min)))
    (unless end (setq end (set-marker (make-marker) (point-max))))
    (while (progn
         (< (point) end))
      (if (looking-at "\n")
    (insert "\n" (adaptive-wrap-fill-context-prefix (line-beginning-position) (line-end-position)))
    (looking-at "[[:space:]]*")
    (replace-match "")

Install adaptive-wrap, copy the above Elisp code to your init file and restart Emacs.

Afterwards you can use make-visual-lines-hard.

  • This works like a charm, Much better then meta-q! Cheers
    – JKRT
    Jul 23, 2019 at 2:02

Save as plain text from word. Dialog box appears and you select “Line breaks” as one of the options!

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.