Function: prog-fill-reindent-defun
prog-fill-reindent-defun is an interactive and byte-compiled function
defined in prog-mode.el.gz.
Signature
(prog-fill-reindent-defun &optional ARGUMENT)
Documentation
Refill or reindent the paragraph or defun that contains point.
If the point is in a string or a comment, fill the paragraph that contains point or follows point.
Otherwise, reindent the function definition that contains point or follows point.
Probably introduced at or before Emacs version 30.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/prog-mode.el.gz
(defun prog-fill-reindent-defun (&optional argument)
"Refill or reindent the paragraph or defun that contains point.
If the point is in a string or a comment, fill the paragraph that
contains point or follows point.
Otherwise, reindent the function definition that contains point
or follows point."
(interactive "P")
(save-excursion
(let ((treesit-text-node
(and (treesit-available-p)
(treesit-parser-list)
(treesit-node-match-p
(treesit-node-at (point)) 'text t))))
(if (or treesit-text-node
(nth 8 (syntax-ppss))
(re-search-forward "\\s-*\\s<" (line-end-position) t))
(fill-paragraph argument (region-active-p))
(beginning-of-defun)
(let ((start (point)))
(end-of-defun)
(indent-region start (point) nil))))))