unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Cc: 67462@debbugs.gnu.org, dmitry@gutov.dev
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	[thread overview]
Message-ID: <83sf4o7n06.fsf@gnu.org> (raw)
In-Reply-To: <87jzq1bn4a.fsf@sappc2.fritz.box> (message from Jens Schmidt on Tue, 28 Nov 2023 22:10:13 +0100)

> 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?





  parent reply	other threads:[~2023-11-29 12:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26 21:08 bug#67462: 30.0.50; prog-fill-reindent-defun does not respect buffer-local fill-paragraph-function Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26 21:23 ` Dmitry Gutov
2023-11-26 22:52   ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-27 12:16     ` Eli Zaretskii
2023-11-27 20:08       ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-27 20:40         ` Dmitry Gutov
2023-11-28 21:28           ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-27 20:55         ` Eli Zaretskii
2023-11-28 21:10           ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-28 21:41             ` Dmitry Gutov
2023-11-29 12:38             ` Eli Zaretskii [this message]
2023-11-29 21:28               ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-30  6:39                 ` Eli Zaretskii
2023-11-30 20:40                   ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-30 23:56                     ` Dmitry Gutov
2023-11-27 17:02     ` Juri Linkov
2023-11-27 19:46     ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-27 20:46       ` Dmitry Gutov
2023-11-27 12:05   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sf4o7n06.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=67462@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=jschmidt4gnu@vodafonemail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).