From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jens Schmidt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#67462: 30.0.50; prog-fill-reindent-defun does not respect buffer-local fill-paragraph-function Date: Sun, 26 Nov 2023 23:52:00 +0100 Message-ID: <87wmu49lgv.fsf@sappc2.fritz.box> References: <87zfz09q9d.fsf@sappc2.fritz.box> Reply-To: Jens Schmidt Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30524"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cc: 67462@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 26 23:53:15 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 1r7O02-0007iE-Qk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Nov 2023 23:53:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7Nzl-0006mn-RX; Sun, 26 Nov 2023 17:52:57 -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 1r7Nzk-0006kP-Ph for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 17:52:56 -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 1r7Nzk-0002v0-GK for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 17:52:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7Nzq-0006Fb-19 for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 17:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jens Schmidt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Nov 2023 22:53:02 +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.170103915023980 (code B ref 67462); Sun, 26 Nov 2023 22:53:02 +0000 Original-Received: (at 67462) by debbugs.gnu.org; 26 Nov 2023 22:52:30 +0000 Original-Received: from localhost ([127.0.0.1]:42842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7NzK-0006Eh-EW for submit@debbugs.gnu.org; Sun, 26 Nov 2023 17:52:30 -0500 Original-Received: from mr5.vodafonemail.de ([145.253.228.165]:52686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7NzF-0006EK-Ea for 67462@debbugs.gnu.org; Sun, 26 Nov 2023 17:52:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1701039132; bh=CyGr61z25mOxKgL3MReRFKSJQ+iue7/A6WOG0ZRqWsI=; h=From:To:Subject:References:Date:In-Reply-To:Message-ID:User-Agent: Content-Type:From; b=E/haLHp77XnLCxAYXc6LDQbGgNYeB1xHL1eQSKo/ZAjCgo6L299MRNN9hcH/SAUqc 6EumeDMghf0VvnesF0mqh59VOnmFl9UcnFY4TgNUXkO/dO0mNSDHtYk/FwLft9DD/6 0XCNjoE8D57ghuh5f3ZYZNQFQI10ODULkme42/9I= Original-Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr5.vodafonemail.de (Postfix) with ESMTPS id 4SdkW00Nwtz1y9x; Sun, 26 Nov 2023 22:52:11 +0000 (UTC) Original-Received: from sappc2 (port-83-236-7-18.dynamic.as20676.net [83.236.7.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4SdkVr3ZTYzHnHn; Sun, 26 Nov 2023 22:52:01 +0000 (UTC) In-Reply-To: (Dmitry Gutov's message of "Sun, 26 Nov 2023 23:23:04 +0200") X-purgate-type: clean X-purgate: clean X-purgate-size: 1986 X-purgate-ID: 155817::1701039127-02FF818D-89621683/0/0 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:275092 Archived-At: Dmitry Gutov 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'.