Malabarba / latex-extra

A series of usability improvements for Emacs latex-mode.
GNU General Public License v3.0
69 stars 14 forks source link

value of autofill changes when enabling this mode #31

Open ppareit opened 5 years ago

ppareit commented 5 years ago

I've never used auto-fill (I prefer visual-line-mode), yet enabling this mode enabled auto-fill-mode for my latex buffer. This is unexpected.

The following emacs configuration fixed the issue for me:

(add-hook 'latex-extra-mode-hook 'turn-off-auto-fill)
Malabarba commented 5 years ago

That's odd. latex-extra doesn't contain a single reference to the auto-fill-mode variable. The only thing it does is change the function used for filling (but it doesn't actually turn on the mode).

This could be some side-effect of your custom settings.

MathieuSchopfer commented 5 years ago

I had the same issue. @ppareit solution fixed it for me too.

iffsid commented 3 years ago

The following worked for me (on v1.3, and I presume anything higher)

(setq latex/cleanup-do-fill nil)

Simply adding turn-off-auto-fill to latex-extra-mode-hook didn't fix things for me.

bernardjoseph commented 2 years ago

I think the problem is that auto-fill-function, which is the variable which holds the state for auto-fill-mode, is set by latex/auto-fill-function. Instead, a local value for normal-auto-fill-function should be set. That is for example what fortran-mode does. The following patch works for me:

  (defun latex/setup-auto-fill ()
    "Set the function used to fill a paragraph to `latex/auto-fill-function'."
    (interactive)
    (setq-local normal-auto-fill-function 'latex/auto-fill-function)
    (and auto-fill-function
         (setq auto-fill-function 'latex/auto-fill-function))))

The last two lines modify auto-fill-function in case it is alread set to another value, for example if auto-fill-mode has been turned on before latex-mode-extra.