GNU bug report logs -
#67462
30.0.50; prog-fill-reindent-defun does not respect buffer-local fill-paragraph-function
Previous Next
Full log
View this message in rfc822 format
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> On 26/11/2023 23:08, Jens Schmidt via Bug reports for GNU Emacs,
> the Swiss army knife of text editors wrote:
>> diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
>> index 37c54a90f42..1bb2b678d94 100644
>> --- a/lisp/progmodes/prog-mode.el
>> +++ b/lisp/progmodes/prog-mode.el
>> @@ -163,7 +163,8 @@ prog-fill-reindent-defun
>> (treesit-parser-list)
>> (treesit-node-match-p
>> (treesit-node-at (point)) 'text t))))
>> - (if (or treesit-text-node
>> + (if (or (local-variable-p 'fill-paragraph-function)
>> + treesit-text-node
>> (nth 8 (syntax-ppss))
>> (re-search-forward "\\s-*\\s<" (line-end-position) t))
>> (fill-paragraph argument (region-active-p))
>
> I'm not sure this is going to work well because c-mode (for
> example) also has a buffer-local value of
> fill-paragraph-function.
Uh. Good point.
> makefile-mode does look special in this regard. Perhaps it's one
> of those modes that don't really use indentation in the same way
> as an average "prog mode" does.
>
> Maybe makefile-mode-map should simply rebind "M-q" back to 'fill-paragraph'.
I tried a cursory grep '(defun .*-fill-paragraph' in lisp/progmodes/.el.
The following functions all seem to work outside of comments:
cfengine-fill-paragraph
f90-fill-paragraph
fortran-fill-paragraph
makefile-fill-paragraph
octave-fill-paragraph
I could be wrong with that list, though, and I cannot tell how useful
these functions are outside of comments. I just looked at docstrings or
for a prominent
(or (fill-comment-paragraph justify)
(do-something ...))
pattern.
Finally, there is `python-fill-paragraph', which tries to be smart
w.r.t. context. Not sure how its behavior outside of comments compares
to the one provided by `prog-fill-reindent-defun'.
This bug report was last modified 1 year and 199 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.