bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64439: 28.2; auto-fill-mode gets turned on all over the place


From: Stefan Monnier
Subject: bug#64439: 28.2; auto-fill-mode gets turned on all over the place
Date: Tue, 11 Jul 2023 14:44:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> For anyone who's interested, here's what I did to work around the bug in
> Emacs 29 and earlier:
>
> --------------------
>
> (use-package text-mode
>   :preface
>   (defun user/turn-on-auto-fill (&optional recursive)
>     "Turn on `auto-fill-mode', but fix things if it got set globally.
> See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64439>."
>     (turn-on-auto-fill)
>     (when (default-value 'auto-fill-function)
>       (message "`auto-fill-function' got set globally; fixing it...")
>       (setq-default auto-fill-function nil)
>       (when recursive
>         (error (concat "Recursively setting the default value of "
>                        "`auto-fill-function'!")))
>       (run-with-timer 0 nil
>                       (lambda (buf)
>                         (with-current-buffer buf
>                           (user/turn-on-auto-fill)))
>                       (current-buffer))))

I suspect (i.e. don't take my word for it) a simpler workaround is to
(make-local-variable 'auto-fill-function) just before calling
`turn-on-auto-fill`.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]