From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60322: 30.0.50; [PATCH]: Search for comment at bol in prog-fill-reindent-defun Date: Thu, 29 Dec 2022 20:23:08 +0100 Message-ID: <87tu1eovz7.fsf@thornhill.no> References: <87r0wn87yz.fsf@thornhill.no> <1a6503f9-31be-7015-64a4-6776e510a855@yandex.ru> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14378"; mail-complaints-to="usenet@ciao.gmane.io" To: Dmitry Gutov , 60322@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 29 20:24:14 2022 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 1pAyVi-0003aJ-9t for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Dec 2022 20:24:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAyVZ-0006vk-Qm; Thu, 29 Dec 2022 14:24:05 -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 1pAyVW-0006sX-So for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2022 14:24:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAyVW-0002yF-Jx for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2022 14:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pAyVW-000338-4S for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2022 14:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Dec 2022 19:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60322 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60322-submit@debbugs.gnu.org id=B60322.167234179511664 (code B ref 60322); Thu, 29 Dec 2022 19:24:02 +0000 Original-Received: (at 60322) by debbugs.gnu.org; 29 Dec 2022 19:23:15 +0000 Original-Received: from localhost ([127.0.0.1]:32923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAyUk-000324-Pv for submit@debbugs.gnu.org; Thu, 29 Dec 2022 14:23:15 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:46412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAyUh-00031u-T2 for 60322@debbugs.gnu.org; Thu, 29 Dec 2022 14:23:13 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1672341790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SvH71ID7dif3G0IPFXpnhZv1KH6MOmzox4vFRGtMRL4=; b=AqtDlPK8FRGhoAqk7yryLXxLn8av4jCW4+FcGhh3YZEIrPwkWitvmurYh7qnrpf1xvn0VM rW0rZF9VYRG4W9IPmi6qGE5whI84sTzEy/ANde/vCYnJIpL2+ebDkG+7LnpdtvCMaZFCMq UtKI4XylHoFhOT3N9WmJctpq1mVJUWmvqzP53omEj8bwJD1SEiJOV3r2IvIDXjXAkzzGZM VmWnt84+oY1SVR31rQ9hO6dlNi1hmzZ/zdAf3Xknw+B17dJUP0ClQXdQGqqCpOJUtr840B ZitBoV2emU8tMQPJsr6XCPSeYYmoUBmfyuDqFXLHmqA8iByFYCJ+1reLlJ8CEA== In-Reply-To: <1a6503f9-31be-7015-64a4-6776e510a855@yandex.ru> X-Migadu-Flow: FLOW_OUT 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:252055 Archived-At: --=-=-= Content-Type: text/plain Dmitry Gutov writes: > On 25/12/2022 23:54, Theodor Thornhill via Bug reports for GNU Emacs, > the Swiss army knife of text editors wrote: >> Attached is a small adjustment to the regex used in >> prog-fill-reindent-defun. The point is that we shouldn't consider lines >> where comments come after actual code as inside a comment. > > How about we allow indentation? > > And allow to be called not from BOL too? > > (re-search-forward "\\s-*\\s<" (line-end-position) t) Sure! Will you install it for me? Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Allow-for-indentation-in-prog-fill-reindent-defun.patch >From b92043c5f1c3f835d19aa9d632920804283eccfd Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Thu, 29 Dec 2022 20:19:46 +0100 Subject: [PATCH] Allow for indentation in prog-fill-reindent-defun (bug#60322) * lisp/progmodes/prog-mode.el (prog-fill-reindent-defun): Adjust regexp. --- lisp/progmodes/prog-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 5e692980b2..2e0cb6cd25 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -164,7 +164,7 @@ prog-fill-reindent-defun (treesit-node-type (treesit-node-at (point))))))) (if (or treesit-text-node (nth 8 (syntax-ppss)) - (re-search-forward "^\\s<" (line-end-position) t)) + (re-search-forward "\\s-*\\s<" (line-end-position) t)) (fill-paragraph argument (region-active-p)) (beginning-of-defun) (let ((start (point))) -- 2.34.1 --=-=-=--