From unknown Sun Jun 22 00:55:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70520: 30.0.50; [PATCH] c-ts-common-comment-indent-new-line does nothing when the comment line in a block starts with whitespace. Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Apr 2024 20:17:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70520 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 70520@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171381700013084 (code B ref -1); Mon, 22 Apr 2024 20:17:03 +0000 Received: (at submit) by debbugs.gnu.org; 22 Apr 2024 20:16:40 +0000 Received: from localhost ([127.0.0.1]:47685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz05e-0003Om-9q for submit@debbugs.gnu.org; Mon, 22 Apr 2024 16:16:39 -0400 Received: from lists.gnu.org ([2001:470:142::17]:45580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz05a-0003NS-4a for submit@debbugs.gnu.org; Mon, 22 Apr 2024 16:16:37 -0400 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 1rz05E-0002p0-JX for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 16:16:12 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rz05D-0006Tn-2i for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 16:16:12 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41a1d2a7b81so10105335e9.0 for ; Mon, 22 Apr 2024 13:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713816969; x=1714421769; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=hh8ek54sGa9sjuHUsI+FmznlESH/dwuQhTEzdYAhzVk=; b=b0ygw/UCqTe7YwFowmEzi02qF1ausUOh9C661o31WEO9VYEbJHh+c+6Lx8WX3+4jEn jJKpgTSXWq/q8hYUgHUrvev4yJAZuSCWj/xEVyL4eBB418Vs0wOGUTv3s/EA0NmGbT2k vKINADVqBGhWUEQK7hLdyGt/6fhMuMoMc6mhDqWiyvienJyv5zst1g9ET9Z4MAcYFGjG rNb5kZAqxpYy1Wf3n41mjwkrnu4Y3VfIeC72oCCTShSI1B+0hrHhAEAeFXg69xtc2SwA h9t1dGEYWrrS8X6yS6DwXRaoUcBowiNIDvettqxChIQ02bUpcqzKAWufzLPYQd1pc2m/ ad8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713816969; x=1714421769; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hh8ek54sGa9sjuHUsI+FmznlESH/dwuQhTEzdYAhzVk=; b=riyH9s1U73LOLGGPe407Oichuq90McB3quHRpbYVnmJBcaiQ7flYjyH4FhJrEgyWLC mZSlqVxr0+F3BqltVXPd/mhgP/h/U0nZUam9Eh/Xf25OMSrV+F6MqgcWCF4zJNsC1GuL ZTPA9X7XTZ+W/uPSrk7NgwxJ/XnnxX+/DZJW8xOu+a5ItTA8ZTNryntA8UWeJqNd6uej 24WOue4I3+jP/e1+wONKz6DzW9MXSLdpoL/Et73CDpZRMz+5VahYxmhpIXJgBONaxehl 70mO5SUeYrLCE4ZS4MZQsz6WM8cfUn4ncOKX7qlRwuN36ajUV7oUCTUsfJ6v+d9EBzIV 6KGg== X-Gm-Message-State: AOJu0YzyVxf0Pe7f68XWEI7yx8m0cpGk2sHNf+q+Gb3yV4BVOXo/0ARQ uuSnGOuRasNXuHTPTB+KS22f0cQ2ixHRodj739GSCyBj9uo3vDSUwRzAyA== X-Google-Smtp-Source: AGHT+IF0HcXlpELQjDykmnO4xYVDMXsR5uxoeikbTe17p6QQhIMrqWB2/lY3bsM3N8NJlqrZPA6skg== X-Received: by 2002:a05:600c:1ca9:b0:418:9d4a:1ba5 with SMTP id k41-20020a05600c1ca900b004189d4a1ba5mr483091wms.6.1713816968970; Mon, 22 Apr 2024 13:16:08 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id j1-20020a05600c1c0100b00419ea5fb0cbsm9912396wms.42.2024.04.22.13.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 13:16:08 -0700 (PDT) From: Vincenzo Pupillo Date: Mon, 22 Apr 2024 22:16:07 +0200 Message-ID: <13523084.uLZWGnKmhe@fedora> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2958064.e9J7NaK4W3" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=v.pupillo@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --nextPart2958064.e9J7NaK4W3 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hello, the new function c-ts-common-comment-indent-new-line has a different behavior from comment-indent-new-line in c-mode. In a comment block like this: /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua */ M-j does not break the line or indent. The cursor simply stands still. The attached patch handles this case. Thank you. V. --nextPart2958064.e9J7NaK4W3 Content-Disposition: attachment; filename="0001-Cover-more-c-ts-common-comment-indent-new-line.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-Cover-more-c-ts-common-comment-indent-new-line.patch" >From aa0b1f1d25a068b0386eeb81bab564465b31399e Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 22 Apr 2024 21:05:49 +0200 Subject: [PATCH] Cover more c-ts-common-comment-indent-new-line. * lisp/progmodes/c-ts-common.el: (c-ts-common-comment-indent-new-line): Handles the case of comments in a comment block that begin with whitespaces. --- lisp/progmodes/c-ts-common.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 735126e1eac..025703d7fce 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -317,7 +317,16 @@ c-ts-common-comment-indent-new-line (let ((prefix (match-string 1))) (if soft (insert-and-inherit ?\n) (newline 1)) (delete-region (line-beginning-position) (point)) - (insert prefix))))) + (insert prefix))) + + ;; Line starts with whitespaces + ((save-excursion + (beginning-of-line) + (looking-at (rx (* " ")))) + (let ((whitespaces (match-string 0))) + (if soft (insert-and-inherit ?\n) (newline 1)) + (delete-region (line-beginning-position) (point)) + (insert whitespaces))))) ;;; Statement indent -- 2.44.0 --nextPart2958064.e9J7NaK4W3-- From unknown Sun Jun 22 00:55:11 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Vincenzo Pupillo Subject: bug#70520: closed (Re: bug#70520: 30.0.50; [PATCH] c-ts-common-comment-indent-new-line does nothing when the comment line in a block starts with whitespace.) Message-ID: References: <0D0F8221-6E3E-4D9E-9AFE-708FD46C460C@gmail.com> <13523084.uLZWGnKmhe@fedora> X-Gnu-PR-Message: they-closed 70520 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 70520@debbugs.gnu.org Date: Tue, 23 Apr 2024 04:58:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1713848282-15848-1" This is a multi-part message in MIME format... ------------=_1713848282-15848-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #70520: 30.0.50; [PATCH] c-ts-common-comment-indent-new-line does nothing w= hen the comment line in a block starts with whitespace. which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 70520@debbugs.gnu.org. --=20 70520: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D70520 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1713848282-15848-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 70520-done) by debbugs.gnu.org; 23 Apr 2024 04:57:49 +0000 Received: from localhost ([127.0.0.1]:49805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz8E0-000465-NL for submit@debbugs.gnu.org; Tue, 23 Apr 2024 00:57:49 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:50558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz8Dw-00044d-Ev for 70520-done@debbugs.gnu.org; Tue, 23 Apr 2024 00:57:46 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1e651a9f3ffso29051365ad.1 for <70520-done@debbugs.gnu.org>; Mon, 22 Apr 2024 21:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713848242; x=1714453042; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=T8kfDLZARt9giQJ1LIznXeFn/zU13rpMFW15b1MkmSQ=; b=UTcYaedU7jtvXe0f5kwA0a7GcSt8LMR3NhlcXa+FQ8KaWcEdPMB7ET6M2z1DNuMDMN 9NnzjXjeW37nN4VscwxrBRb/O+bMd3xlAX8KNnUn5Dk3q+Eo53TOArQ8WO2iLiPLdV1m JsdHhzyrfNGaIkfl1i6q5wk34SsNJCeW0f/YCoJMaEMQ8vfyRbcjUGE893bDgEvMB3gr +3EKYRBuHs1xb+yxSLVDwSvYDhK2Q/ABDbyGw3S+Kb2BD7LNs/hSTNvaTIILQcbUeZTx Vey/QjkeSY5w6k9z/c5FxFvbJKyitnrWj8TkvweeRC4UDF47qQjDN6E/pwg5wvDykaS+ 99UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713848242; x=1714453042; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T8kfDLZARt9giQJ1LIznXeFn/zU13rpMFW15b1MkmSQ=; b=uEvoUc2CjOP+FtylRW/1HJDulyeRZC6e3QNU1zMN9NfKAj31dyq9pGNgO1C2U67ZTn HFDnOKxB/uL71fniGvhxQTG5KW0s/nUdbyKfm+9GPDMrJ+5RON7UtgmxguxCOII87SNg 9y++GQXcjy/8C2XbfXaoRW+eFnZXC0yq+C0xC4V2DESqcuONMcTRW6u5MoYSK9iLEWh9 14BW06wBNyf1vu1pZqkf8TXBnQHJIU+6W4IF9AtMKgoFl67UFImykS2Uq60wWEU85S0P hUp7qCYAgHI3oLJrJs0/jn2v3TpSH8tK3dFdrTojTZjJwky5ffQWc9/8vhoHeKeDfWF3 7iZQ== X-Gm-Message-State: AOJu0Yy5JQqKerxhjYv7Al5h72qvTZgUZuU3f1fwjaM+DFRkwl3ij9gB CsyrHgX4Sw2wgPwI2DMZfwmP24PVh0DeqSMJLLubOkBcv4vYZL3f X-Google-Smtp-Source: AGHT+IF8ZO5XySbvAj6AaphCFotFpc8p26BAznJGpLWGaoPLYxT3x7qvdBqXTMiJ5suPjRW/bF96GQ== X-Received: by 2002:a17:902:cf0d:b0:1e4:7ca3:8a33 with SMTP id i13-20020a170902cf0d00b001e47ca38a33mr15078311plg.17.1713848242074; Mon, 22 Apr 2024 21:57:22 -0700 (PDT) Received: from smtpclient.apple ([2601:641:300:4910:e4f6:f0b8:c91d:e40b]) by smtp.gmail.com with ESMTPSA id h15-20020a170902680f00b001e89e7b2b74sm8352406plk.235.2024.04.22.21.57.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2024 21:57:21 -0700 (PDT) From: Yuan Fu Message-Id: <0D0F8221-6E3E-4D9E-9AFE-708FD46C460C@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_3E67BCA8-886B-4C3C-BF8D-563305F31AA4" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\)) Subject: Re: bug#70520: 30.0.50; [PATCH] c-ts-common-comment-indent-new-line does nothing when the comment line in a block starts with whitespace. Date: Mon, 22 Apr 2024 21:57:10 -0700 In-Reply-To: <13523084.uLZWGnKmhe@fedora> To: Vincenzo Pupillo References: <13523084.uLZWGnKmhe@fedora> X-Mailer: Apple Mail (2.3731.700.6.1.1) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70520-done Cc: 70520-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Apple-Mail=_3E67BCA8-886B-4C3C-BF8D-563305F31AA4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Apr 22, 2024, at 1:16 PM, Vincenzo Pupillo = wrote: >=20 > Hello,=20 > the new function c-ts-common-comment-indent-new-line has a different = behavior=20 > from comment-indent-new-line in c-mode. > In a comment block like this: > /* > Lorem ipsum dolor sit amet, consectetur adipiscing elit,=20 > sed do eiusmod tempor incididunt ut labore et dolore magna aliqua > */ > M-j does not break the line or indent. The cursor simply stands still. > The attached patch handles this case. >=20 > Thank you. > V. --Apple-Mail=_3E67BCA8-886B-4C3C-BF8D-563305F31AA4 Content-Disposition: attachment; filename=0001-Cover-more-c-ts-common-comment-indent-new-line.patch Content-Type: text/x-patch; x-unix-mode=0644; name="0001-Cover-more-c-ts-common-comment-indent-new-line.patch" Content-Transfer-Encoding: quoted-printable =46rom aa0b1f1d25a068b0386eeb81bab564465b31399e Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 22 Apr 2024 21:05:49 +0200 Subject: [PATCH] Cover more c-ts-common-comment-indent-new-line. * lisp/progmodes/c-ts-common.el: (c-ts-common-comment-indent-new-line): Handles the case of comments in a comment block that begin with whitespaces. --- lisp/progmodes/c-ts-common.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/c-ts-common.el = b/lisp/progmodes/c-ts-common.el index 735126e1eac..025703d7fce 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -317,7 +317,16 @@ c-ts-common-comment-indent-new-line (let ((prefix (match-string 1))) (if soft (insert-and-inherit ?\n) (newline 1)) (delete-region (line-beginning-position) (point)) - (insert prefix))))) + (insert prefix))) + + ;; Line starts with whitespaces + ((save-excursion + (beginning-of-line) + (looking-at (rx (* " ")))) + (let ((whitespaces (match-string 0))) + (if soft (insert-and-inherit ?\n) (newline 1)) + (delete-region (line-beginning-position) (point)) + (insert whitespaces))))) =20 ;;; Statement indent =20 --=20 2.44.0 --Apple-Mail=_3E67BCA8-886B-4C3C-BF8D-563305F31AA4 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Merged, thank you! Yuan --Apple-Mail=_3E67BCA8-886B-4C3C-BF8D-563305F31AA4-- ------------=_1713848282-15848-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Apr 2024 20:16:40 +0000 Received: from localhost ([127.0.0.1]:47685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz05e-0003Om-9q for submit@debbugs.gnu.org; Mon, 22 Apr 2024 16:16:39 -0400 Received: from lists.gnu.org ([2001:470:142::17]:45580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz05a-0003NS-4a for submit@debbugs.gnu.org; Mon, 22 Apr 2024 16:16:37 -0400 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 1rz05E-0002p0-JX for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 16:16:12 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rz05D-0006Tn-2i for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 16:16:12 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41a1d2a7b81so10105335e9.0 for ; Mon, 22 Apr 2024 13:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713816969; x=1714421769; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=hh8ek54sGa9sjuHUsI+FmznlESH/dwuQhTEzdYAhzVk=; b=b0ygw/UCqTe7YwFowmEzi02qF1ausUOh9C661o31WEO9VYEbJHh+c+6Lx8WX3+4jEn jJKpgTSXWq/q8hYUgHUrvev4yJAZuSCWj/xEVyL4eBB418Vs0wOGUTv3s/EA0NmGbT2k vKINADVqBGhWUEQK7hLdyGt/6fhMuMoMc6mhDqWiyvienJyv5zst1g9ET9Z4MAcYFGjG rNb5kZAqxpYy1Wf3n41mjwkrnu4Y3VfIeC72oCCTShSI1B+0hrHhAEAeFXg69xtc2SwA h9t1dGEYWrrS8X6yS6DwXRaoUcBowiNIDvettqxChIQ02bUpcqzKAWufzLPYQd1pc2m/ ad8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713816969; x=1714421769; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hh8ek54sGa9sjuHUsI+FmznlESH/dwuQhTEzdYAhzVk=; b=riyH9s1U73LOLGGPe407Oichuq90McB3quHRpbYVnmJBcaiQ7flYjyH4FhJrEgyWLC mZSlqVxr0+F3BqltVXPd/mhgP/h/U0nZUam9Eh/Xf25OMSrV+F6MqgcWCF4zJNsC1GuL ZTPA9X7XTZ+W/uPSrk7NgwxJ/XnnxX+/DZJW8xOu+a5ItTA8ZTNryntA8UWeJqNd6uej 24WOue4I3+jP/e1+wONKz6DzW9MXSLdpoL/Et73CDpZRMz+5VahYxmhpIXJgBONaxehl 70mO5SUeYrLCE4ZS4MZQsz6WM8cfUn4ncOKX7qlRwuN36ajUV7oUCTUsfJ6v+d9EBzIV 6KGg== X-Gm-Message-State: AOJu0YzyVxf0Pe7f68XWEI7yx8m0cpGk2sHNf+q+Gb3yV4BVOXo/0ARQ uuSnGOuRasNXuHTPTB+KS22f0cQ2ixHRodj739GSCyBj9uo3vDSUwRzAyA== X-Google-Smtp-Source: AGHT+IF0HcXlpELQjDykmnO4xYVDMXsR5uxoeikbTe17p6QQhIMrqWB2/lY3bsM3N8NJlqrZPA6skg== X-Received: by 2002:a05:600c:1ca9:b0:418:9d4a:1ba5 with SMTP id k41-20020a05600c1ca900b004189d4a1ba5mr483091wms.6.1713816968970; Mon, 22 Apr 2024 13:16:08 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id j1-20020a05600c1c0100b00419ea5fb0cbsm9912396wms.42.2024.04.22.13.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 13:16:08 -0700 (PDT) From: Vincenzo Pupillo To: bug-gnu-emacs@gnu.org Subject: 30.0.50; [PATCH] c-ts-common-comment-indent-new-line does nothing when the comment line in a block starts with whitespace. Date: Mon, 22 Apr 2024 22:16:07 +0200 Message-ID: <13523084.uLZWGnKmhe@fedora> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2958064.e9J7NaK4W3" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=v.pupillo@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --nextPart2958064.e9J7NaK4W3 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hello, the new function c-ts-common-comment-indent-new-line has a different behavior from comment-indent-new-line in c-mode. In a comment block like this: /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua */ M-j does not break the line or indent. The cursor simply stands still. The attached patch handles this case. Thank you. V. --nextPart2958064.e9J7NaK4W3 Content-Disposition: attachment; filename="0001-Cover-more-c-ts-common-comment-indent-new-line.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-Cover-more-c-ts-common-comment-indent-new-line.patch" >From aa0b1f1d25a068b0386eeb81bab564465b31399e Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 22 Apr 2024 21:05:49 +0200 Subject: [PATCH] Cover more c-ts-common-comment-indent-new-line. * lisp/progmodes/c-ts-common.el: (c-ts-common-comment-indent-new-line): Handles the case of comments in a comment block that begin with whitespaces. --- lisp/progmodes/c-ts-common.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 735126e1eac..025703d7fce 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -317,7 +317,16 @@ c-ts-common-comment-indent-new-line (let ((prefix (match-string 1))) (if soft (insert-and-inherit ?\n) (newline 1)) (delete-region (line-beginning-position) (point)) - (insert prefix))))) + (insert prefix))) + + ;; Line starts with whitespaces + ((save-excursion + (beginning-of-line) + (looking-at (rx (* " ")))) + (let ((whitespaces (match-string 0))) + (if soft (insert-and-inherit ?\n) (newline 1)) + (delete-region (line-beginning-position) (point)) + (insert whitespaces))))) ;;; Statement indent -- 2.44.0 --nextPart2958064.e9J7NaK4W3-- ------------=_1713848282-15848-1--