From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83sf4o7n06.fsf@gnu.org> References: <87zfz09q9d.fsf@sappc2.fritz.box> <87wmu49lgv.fsf@sappc2.fritz.box> <83a5qz9ysx.fsf@gnu.org> <87wmu3gdrz.fsf@sappc2.fritz.box> <83il5m9aqz.fsf@gnu.org> <87jzq1bn4a.fsf@sappc2.fritz.box> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36878"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67462@debbugs.gnu.org, dmitry@gutov.dev To: Jens Schmidt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 29 13:40:33 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r8Jrj-0009Kb-LH for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Nov 2023 13:40:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8JrK-0002x6-U4; Wed, 29 Nov 2023 07:40:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8Jr9-0002vU-Sp for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 07:40:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8Jr8-0003VY-QQ for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 07:39:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r8JrF-0008VS-Ud for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 07:40:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Nov 2023 12:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67462 X-GNU-PR-Package: emacs Original-Received: via spool by 67462-submit@debbugs.gnu.org id=B67462.170126154432624 (code B ref 67462); Wed, 29 Nov 2023 12:40:01 +0000 Original-Received: (at 67462) by debbugs.gnu.org; 29 Nov 2023 12:39:04 +0000 Original-Received: from localhost ([127.0.0.1]:49065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8JqJ-0008U7-FP for submit@debbugs.gnu.org; Wed, 29 Nov 2023 07:39:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8JqH-0008TY-9x for 67462@debbugs.gnu.org; Wed, 29 Nov 2023 07:39:02 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8Jq2-0003LF-IU; Wed, 29 Nov 2023 07:38:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=2M2jrguLBcIpfxPKsi+Ca3XHIgmHs0i5XrpnorNSei8=; b=oP8c/FtcwAws VjK49A5kQLT/c11JYOHwyCY6DjV7t00Mz3u8UJUaPebeRknx8hC8GxJ+n9ZW+grDxYYhsWSW5N6mH I6VparbwKbYiqOxbGBPpksFdTzRPafnrNTnY8+kvlE0sIXM+1qUu4AiLL5BNHPCerHhm9d0JXSk4H BkYGoMB0n54292vObCqg4flCXTcFJCbAe7j7UcWlK2KaThSSL6R33Tf7srCyOhWQSQSA7W8RHTxTY tS2CsndICq7mXQoMHzuxOI2oV90utebeVfVXgJhWNvHz8C31vFQD8SW5xWpNfMeQI1QZjwyffekcg miEskaH87vCFJXLv2D3hIw==; In-Reply-To: <87jzq1bn4a.fsf@sappc2.fritz.box> (message from Jens Schmidt on Tue, 28 Nov 2023 22:10:13 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275216 Archived-At: > From: Jens Schmidt > Cc: 67462@debbugs.gnu.org, dmitry@gutov.dev > Date: Tue, 28 Nov 2023 22:10:13 +0100 > > Eli Zaretskii writes: > > >> From: Jens Schmidt > >> Cc: 67462@debbugs.gnu.org, dmitry@gutov.dev > >> Date: Mon, 27 Nov 2023 21:08:32 +0100 > >> > >> Eli Zaretskii 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?