I would like to change the behavior of fill-paragraph
in certain modes (e.g. LaTeX-mode
provided by AucTeX
).
I could just rebind the key M-q
, but I am also using evil-mode
whose implementation of evil-fill-and-move
uses fill-region
. Ideally, my custom fill function to override both the functions fill-paragraph
(so it works with M-q
) and fill-region
(so it works with evil
).
Assuming that I have a standalone program format
that takes in LaTeX code via stdin
and output formatted code on stdout
, how would I go about override the above two fill functions to use format
?
(Note: this is similar to vim
's formatprg
option.)