3

The LaTeX Layer by default wraps a line after column 85 by inserting a new line while typing and moving the current word to the new line. When the line is a comment, it even automatically inserts the comment prefix.

How can one disable this behaviour?

The emacs variables word-wrap and truncate-lines seem to have nothing to do with this, they only change how text is displayed while the above behaviour actually inserts new lines.

user905686
  • 327
  • 2
  • 11
  • It's probably using `auto-fill-mode`. You can add a hook to `latex-mode` to disable it, or maybe there's some other way to configure that in spacemacs. –  Jun 27 '18 at 16:50
  • @DoMiNeLa10 Thanks, this seems to be the mode I was looking for. – user905686 Jun 28 '18 at 16:43

2 Answers2

3

Update 2022-07: This does not work anymore. See other answers for a working solution.

The automatic wrapping is done by the minor mode auto-fill-mode (as hinted by DoMiNeLa10).

To disable it, add this to function dotspacemacs/user-config in .spacemacs:

(add-hook 'latex-mode-hook #'spacemacs/toggle-auto-fill-mode-off)

There is also the latex/auto-fill-mode, but that doesn't seem to be a mode itself (doc: "Toggle auto-fill-mode using the custom auto-fill function.").

See the layer documentation for auto-fill for fine-grained (latex specific) control of where auto-fill should be enabled.

user905686
  • 327
  • 2
  • 11
  • 2
    While this worked at first, recently auto-fill-mode would be active again when loading latex mode, with the same settings. Now it works again (emacs 26.1, spacemacs 0.200.13 (didn't change), packages updated ~28.08.18). – user905686 Aug 31 '18 at 15:01
  • Not working on spacemacs dev by the way. – tigerjack Mar 06 '19 at 18:14
  • this doesn't work any more; the other answer here works – Niles Dec 22 '21 at 20:51
2

As largely seen on the web, adding off-switch for the auto-fill minor mode to the (La)TeX major mode won't work anymore, not even with 'append. As duianto states, the solution has been properly documented in the auto-fill section of the LaTeX layer (in development).

Change LaTeX's layer line

latex

to

(latex :variables latex-enable-auto-fill nil)
vitaminace33
  • 206
  • 1
  • 6