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

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

bug#67462: 30.0.50; prog-fill-reindent-defun does not respect buffer-loc


From: Eli Zaretskii
Subject: bug#67462: 30.0.50; prog-fill-reindent-defun does not respect buffer-local fill-paragraph-function
Date: Wed, 29 Nov 2023 14:38:33 +0200

> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> Cc: 67462@debbugs.gnu.org,  dmitry@gutov.dev
> Date: Tue, 28 Nov 2023 22:10:13 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> >> Cc: 67462@debbugs.gnu.org,  dmitry@gutov.dev
> >> Date: Mon, 27 Nov 2023 21:08:32 +0100
> >>
> >> Eli Zaretskii <eliz@gnu.org> writes:
> >>
> >> >
> >> > What would it take to teach prog-fill-reindent-defun to DTRT outside
> >> > comments and strings?
> >
> > (I meant "inside", sorry.)
> >
> >> IMO the problem here is that some modes already have an idea of what
> >> could be TRT outside comments and strings, implemented in a
> >> mode-specific fill-paragraph-function.
> >
> > But isn't filling inside comments and strings basically very similar
> > in these modes?
> 
> You lost me here, sorry.
> 
> *Inside* comments and strings I don't see any issues: In these the
> result of M-q should be identical before or after commit b889eced4449
> introduced function `prog-fill-reindent-defun'.  Because inside comment
> and strings `prog-fill-reindent-defun' just forwards to
> `fill-paragraph'.
> 
> It's outside comment and strings where behavior can differ.  Or where
> behavior actually differs, as shown in my initial report.

And you are saying that prog-fill-reindent-defun cannot be easily
taught to DTRT outside of comments and strings, and that the only
feasible approach is to reuse the old mode-specific functions in that
case?  I'm not sure I understand why is that, since the doc string of
prog-fill-reindent-defun says:

  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.

And its code does:

      (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))))))

So you are saying that indent-region doesn't do its job in some/many
major modes?  Can we fix that?  Or what am I missing now?





reply via email to

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