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#60360: 30.0.50; prog-fill-reindent-defun doesn't use region Date: Tue, 27 Dec 2022 22:01:28 +0100 Message-ID: <871qoky313.fsf@thornhill.no> References: <865ydwc3p1.fsf@mail.linkov.net> 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="34903"; mail-complaints-to="usenet@ciao.gmane.io" To: Juri Linkov , 60360@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 27 22:02:31 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 1pAH5i-0008pY-8P for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Dec 2022 22:02:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAH5R-0004Ww-Om; Tue, 27 Dec 2022 16:02:13 -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 1pAH5G-0004SC-On for bug-gnu-emacs@gnu.org; Tue, 27 Dec 2022 16:02:05 -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 1pAH5G-0007u5-GC for bug-gnu-emacs@gnu.org; Tue, 27 Dec 2022 16:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pAH5G-0007Gf-1Z for bug-gnu-emacs@gnu.org; Tue, 27 Dec 2022 16:02: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: Tue, 27 Dec 2022 21:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60360 X-GNU-PR-Package: emacs Original-Received: via spool by 60360-submit@debbugs.gnu.org id=B60360.167217489627905 (code B ref 60360); Tue, 27 Dec 2022 21:02:02 +0000 Original-Received: (at 60360) by debbugs.gnu.org; 27 Dec 2022 21:01:36 +0000 Original-Received: from localhost ([127.0.0.1]:56564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAH4p-0007G1-RU for submit@debbugs.gnu.org; Tue, 27 Dec 2022 16:01:36 -0500 Original-Received: from out-28.mta0.migadu.com ([91.218.175.28]:58899) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAH4n-0007Fr-27 for 60360@debbugs.gnu.org; Tue, 27 Dec 2022 16:01:34 -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=1672174891; 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=RWsw4NBrgeEe53RG6k58JKzETJYrmx30I83xosRj02A=; b=CMYTmiqTn95LyXpwJnlwqZzGT9OyFI7JQcwjdM2n9ZN6cYLpGkE74UCtmD4K4MFhR6x/RS zRUsOhyVzseP8aTZSet61GVowGPjJR9tfHmlQoJxjwh1OHo9jW4tyTcT700gxIQu7k6RhR pJBKWDe6xASfZlzZLEUH/uk9L7ytS8KFIpDsgUrQC17jd4ezcB6zWA+wWAvnvuzpJlNUAI oQRNAEKeYLOtNcSR7FIy0MiwO8iJ9j8xIhxJWsy4QHgvyvFczAQokiqZBB7oTUFOQW8V24 dBjYOWFmFa5Y+rsf74YMeFN8ZNpfwfRCgY/8xTQyChWOYqeNnhwzR0eBeEe/fw== In-Reply-To: <865ydwc3p1.fsf@mail.linkov.net> 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:251966 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Juri! > X-Debbugs-CC: Theodor Thornhill > > After selecting the region in a docstring, M-q used to fill the region, > but new prog-fill-reindent-defun doesn't do this. The original > function had the argument REGION for that, described thusly: > > The REGION argument is non-nil if called interactively; in that > case, if Transient Mark mode is enabled and the mark is active, > call =E2=80=98fill-region=E2=80=99 to fill each of the paragraphs in th= e active > region, instead of just filling the current paragraph. Thanks, does the below patch solve your problem? If so, feel free to install it, as I can't :-) Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fixes-in-prog-fill-reindent-defun.patch >From bafb70b02577aaabec3d92a4a25557504dec25f3 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sun, 25 Dec 2022 22:47:36 +0100 Subject: [PATCH] Fixes in prog-fill-reindent-defun Ensure that we don't consider lines such as switch (foo) { case 2: // If point on 'c' in 'case' return 2; not to be considered for filling. Also make sure we check for the active region, to replicate the normal fill-paragraph behavior. * lisp/progmodes/prog-mode.el (prog-fill-reindent-defun): Adjust regex, and make sure fill-paragraph checks for active region. (bug#60360, bug#60322) --- lisp/progmodes/prog-mode.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index aa37a4ac86..5e692980b2 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -164,10 +164,8 @@ prog-fill-reindent-defun (treesit-node-type (treesit-node-at (point))))))) (if (or treesit-text-node (nth 8 (syntax-ppss)) - (re-search-forward comment-start-skip (line-end-position) t)) - (if (memq fill-paragraph-function '(t nil)) - (lisp-fill-paragraph argument) - (funcall fill-paragraph-function argument)) + (re-search-forward "^\\s<" (line-end-position) t)) + (fill-paragraph argument (region-active-p)) (beginning-of-defun) (let ((start (point))) (end-of-defun) -- 2.34.1 --=-=-=--