From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66670: [PATCH] Use buffer-local comment-continue in comment-indent-new-line Date: Sat, 21 Oct 2023 17:23:35 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="499"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66670@debbugs.gnu.org, monnier@gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 21 23:24:48 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 1quJSh-000ASe-6V for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 21 Oct 2023 23:24:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quJSW-0004Mo-HQ; Sat, 21 Oct 2023 17:24:36 -0400 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 1quJSV-0004FY-7d for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2023 17:24:35 -0400 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 1quJSU-0006kc-Ui for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2023 17:24:34 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1quJSw-0007iO-HA for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2023 17:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Oct 2023 21:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66670 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, Stefan Monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.169792347029607 (code B ref -1); Sat, 21 Oct 2023 21:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Oct 2023 21:24:30 +0000 Original-Received: from localhost ([127.0.0.1]:45175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quJSQ-0007hT-8W for submit@debbugs.gnu.org; Sat, 21 Oct 2023 17:24:30 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:34828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quJSN-0007hC-TE for submit@debbugs.gnu.org; Sat, 21 Oct 2023 17:24:29 -0400 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 1quJRq-0001HI-8b for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2023 17:23:54 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quJRl-0006ai-Rq; Sat, 21 Oct 2023 17:23:53 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id ECC74100126; Sat, 21 Oct 2023 17:23:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1697923421; bh=kGMnFfyLf3GjLeE1RVEgaSG2qVs+AiwvPtH/JbyuXYU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=oxT5YGf4rzSFycbfiJUVFyTBjkUn8jtfBEXUdnUpt22zQApKJ7EHJKC7I4WV1T0Ld JD+SrXKPmpflWnQd4KCyx51uGxtH0vS8LCVNktD7o6NSiPHjj2FX3ryaRJCZ9AB69V LXn0tn6T88sqfVmYDP9vekwfUQE7ngnLRzbzed+4lp/ZXsjQZJUpBZF10qwb4SXIrI ZRbjR14bWVqTsugIYptMDzl0+Ac75W/KRnfxJlOUNAUDESvF3uUjapmGt5TRoXgAfN pT74aVzzMd4FAVZhpsm35pUzqIi32ZZpP+E+56Utj1Z24x5/BbXeXPwogDqE6uDEqN FsE7iq2hTb7Ug== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AD11A10006B; Sat, 21 Oct 2023 17:23:41 -0400 (EDT) Original-Received: from pastel (unknown [45.72.216.111]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 82A0412036E; Sat, 21 Oct 2023 17:23:41 -0400 (EDT) In-Reply-To: (Spencer Baugh's message of "Sat, 21 Oct 2023 16:08:42 -0400") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:272940 Archived-At: > ;; Recreate comment-continue from comment-start. > - ;; FIXME: wrong if comment-continue was set explicitly! > ;; FIXME: use prev line's continuation if available. > - (comment-continue nil)) > + (comment-continue (if (local-variable-p 'comment-continue) > + comment-continue > + nil))) Are you sure? `comment-continue` is very rarely set globally. Usually it's set buffer-locally by `comment-normalize-vars`. > +(ert-deftest local-comment-continue-in-comment-indent-new-line () > + (with-temp-buffer > + (setq-local comment-start "/* ") > + (setq-local comment-end "*/") ^^ Out of symmetry, I'd have expected a SPC here. > + (insert "foo") > + (newline) > + (insert "bar") > + (forward-line -1) > + (end-of-line) > + (comment-region (point-min) (point-max)) > + (should (equal (thing-at-point 'line) "/* foo\n")) > + (comment-indent-new-line) You should also test it with that very same comment but when `comment-start` and `comment-end` have been set to something like "// " and "". Stefan