On Thu, Nov 6, 2025 at 8:44 PM Arash Esbati <[email protected]> wrote:
>
> Hongyi Zhao <[email protected]> writes:
>
> > But in my case, when I'm in a LaTeX mode buffer defined by AUCTeX,
> > `C-h v fill-paragraph-function RET` gives the following:
> >
> > ```
> > fill-paragraph-function is a variable defined in ‘fill.el’.
> >
> > Its value is nil
> >
> > Mode-specific function to fill a paragraph, or nil if there is none.
> > If the function returns nil, then ‘fill-paragraph’ does its normal work.
> > A value of t means explicitly "do nothing special".
> > Note: This only affects ‘fill-paragraph’ and not ‘fill-region’
> > nor ‘auto-fill-mode’, so it is often better to use some other hook,
> > such as ‘fill-forward-paragraph-function’.
> >
> >   This variable may be risky if used as a file-local variable.
> >   Probably introduced at or before Emacs version 19.29.
> >
> > [back]
>
> This is what AUCTeX has in latex.el:
>
>   (defun LaTeX-common-initialization ()
>     "Common initialization for LaTeX derived modes."
>     (setq-local indent-line-function #'LaTeX-indent-line)
>
>     ;; Filling
>     (setq-local paragraph-ignore-fill-prefix t)
>     (setq-local fill-paragraph-function #'LaTeX-fill-paragraph)
>     (setq-local adaptive-fill-mode nil)
>     ...)
>
> Again, I can't tell why you get something else.  You should investigate
> with a recipe starting with "emacs -Q" and activate only AUCTeX.  But
> you know by now 👍

The culprit is the following code snippet in my init.el:

 (use-package adaptive-wrap
   :config
   (setq-default adaptive-wrap-extra-indent 1)
   (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)
   (global-visual-line-mode +1))

After I commented out the settings above, I got the following result
when I was in a LaTeX mode buffer defined by AUCTeX:

```C-h k fill-paragraph-function RET
fill-paragraph-function is a variable defined in ‘fill.el’.

Its value is ‘LaTeX-fill-paragraph’
Local in buffer test.tex; global value is nil

Mode-specific function to fill a paragraph, or nil if there is none.
If the function returns nil, then ‘fill-paragraph’ does its normal work.
A value of t means explicitly "do nothing special".
Note: This only affects ‘fill-paragraph’ and not ‘fill-region’
nor ‘auto-fill-mode’, so it is often better to use some other hook,
such as ‘fill-forward-paragraph-function’.

  This variable may be risky if used as a file-local variable.
  Probably introduced at or before Emacs version 19.29.
```

> Best, Arash
Regards, Zhao

Reply via email to