1

Imagine I have a line that is longer than the available space. I want this one physical line to be displayed as multiple ones (so that I can see it in full without scrolling). In the screenshot below you see one logical line displayed as two (red rectangle):

Screenshot 1

When I open the same file in Emacs, Org mode, type :vsp, then that same line is truncated:

Screenshot 2

How can I make sure that this line is displayed in Emacs like it is in Vim (see screenshot above)?

I tried the following:

  1. Adding (setq-default truncate-lines nil) to .emacs file as suggested here (then restarting Emacs).
  2. M-x auto-fill-mode or M-x fill-region as suggested here.

None of this helped.

1

1 Answer 1

4

Click on Options / Line wrapping in this buffer / Wrap at window edge to change it for the current buffer.

To change it on a permanent basis, you will need to search your initialization file(s) for truncate-lines: somebody must be setting it to t for Org mode buffers. You will need to change that setting to nil. If it only happens on partial-width windows (as shown in your screenshots), you might want to look at truncate-partial-width-windows as Jean Pierre points out in a comment. Setting both of these variables to nil (and making sure that nobody overrides those settings) will ensure that lines are wrapped always.

Here's the doc string for truncate-lines:

truncate-lines is a variable defined in ‘C source code’. Its value is nil

Automatically becomes permanently buffer-local when set. Calls these functions when changed: (#) This variable is safe as a file local variable if its value satisfies the predicate ‘booleanp’. You can customize this variable. Probably introduced at or before Emacs version 1.7.

Documentation: Non-nil means do not display continuation lines. Instead, give each line of text just one screen line.

Note that this is overridden by the variable ‘truncate-partial-width-windows’ if that variable is non-nil and this buffer is not full-frame width.

Minibuffers set this variable to nil.

2
  • 2
    Note that the standard default value for truncate-partial-width-windows is 50, so this may need to be changed too.
    – JeanPierre
    Commented Nov 24, 2019 at 8:35
  • Yes, thank you. Edited the answer a bit.
    – NickD
    Commented Nov 24, 2019 at 20:03

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.