From unknown Sat Jun 21 03:30:29 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#41793 <41793@debbugs.gnu.org> To: bug#41793 <41793@debbugs.gnu.org> Subject: Status: `comment-only-p' erroneously flags blank lines as comments Reply-To: bug#41793 <41793@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:30:29 +0000 retitle 41793 `comment-only-p' erroneously flags blank lines as comments reassign 41793 emacs submitter 41793 Toby Cubitt severity 41793 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 14:01:26 2020 Received: (at submit) by debbugs.gnu.org; 10 Jun 2020 18:01:26 +0000 Received: from localhost ([127.0.0.1]:35299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj52T-0007T2-UR for submit@debbugs.gnu.org; Wed, 10 Jun 2020 14:01:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:53022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj52R-0007Su-Tn for submit@debbugs.gnu.org; Wed, 10 Jun 2020 14:01:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jj52R-00066O-Ln for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 14:01:23 -0400 Received: from sanddollar.geekisp.com ([216.168.135.167]:45176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1jj52Q-0001s3-SD for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 14:01:23 -0400 Received: (qmail 11990 invoked by uid 1003); 10 Jun 2020 17:54:46 -0000 Received: from bb84.localdomain (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Wed, 10 Jun 2020 13:54:44 -0400 Received: by bb84.localdomain (Postfix, from userid 1000) id 3C2DFC2A4C; Wed, 10 Jun 2020 18:53:31 +0100 (BST) Date: Wed, 10 Jun 2020 18:53:31 +0100 To: bug-gnu-emacs@gnu.org Subject: `comment-only-p' erroneously flags blank lines as comments Message-ID: <20200610175331.GA23889@bb84> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org Received-SPF: neutral client-ip=216.168.135.167; envelope-from=tsc25@cantab.net; helo=sanddollar.geekisp.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/10 13:54:40 X-ACL-Warn: Detected OS = OpenBSD 4.x-5.x [fuzzy] X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.6 (-) 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: , Reply-To: Toby Cubitt Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.16) of 2020-04-28 On the following text, with point at | (comment-only-p (point) (1+ (point))) returns t when it should probably return nil: " | test" This impacts commands like `comment-or-uncomment-region'. This is because the current implementation of `comment-only-p' fails to check the return value of (comment-forward): (defun comment-only-p (beg end) "Return non-nil if the text between BEG and END is all comments." (save-excursion (goto-char beg) (comment-forward (point-max)) (<= end (point)))) The correct implementation should probably be: (defun comment-only-p (beg end) "Return non-nil if the text between BEG and END is all comments." (save-excursion (goto-char beg) (and (comment-forward (point-max)) (<= end (point))))) Tested on 26.3, but implementation of `comment-only-p' is unchanged in latest git. Cheers, Toby -- Dr T. S. Cubitt Reader (Associate Professor) in Quantum Information Royal Society University Research Fellow Department of Computer Science University College London email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 14:54:14 2020 Received: (at 41793) by debbugs.gnu.org; 10 Jun 2020 18:54:14 +0000 Received: from localhost ([127.0.0.1]:35365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj5ra-0000Pq-4g for submit@debbugs.gnu.org; Wed, 10 Jun 2020 14:54:14 -0400 Received: from sanddollar.geekisp.com ([216.168.135.167]:9884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj5rX-0000Pa-Vn for 41793@debbugs.gnu.org; Wed, 10 Jun 2020 14:54:12 -0400 Received: (qmail 29311 invoked by uid 1003); 10 Jun 2020 18:54:11 -0000 Received: from bb84.localdomain (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Wed, 10 Jun 2020 14:54:04 -0400 Received: by bb84.localdomain (Postfix, from userid 1000) id 882BDC2A4C; Wed, 10 Jun 2020 19:52:51 +0100 (BST) Date: Wed, 10 Jun 2020 19:52:51 +0100 To: 41793@debbugs.gnu.org Subject: Re: bug#41793: `comment-only-p' erroneously flags blank lines as comments Message-ID: <20200610185251.GA25375@bb84> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200610175331.GA23889@bb84> X-PGP-Key: http://www.dr-qubit.org/gpg-toby-pub.asc User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41793 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 (-) On Wed, Jun 10, 2020 at 06:53:31PM +0100, Toby Cubitt wrote: > In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.16) > of 2020-04-28 > > On the following text, with point at | > (comment-only-p (point) (1+ (point))) > returns t when it should probably return nil: > > " > | > > test" > > This impacts commands like `comment-or-uncomment-region'. > > This is because the current implementation of `comment-only-p' fails to check the return value of (comment-forward): > > The correct implementation should probably be: [snip] Gah. That attempt breaks flagging of comments separated by whitespace-only lines. Maybe this? (defun comment-only-p (beg end) "Return non-nil if the text between BEG and END is all comments." (if (string-blank-p (buffer-substring beg end)) nil (save-excursion (goto-char beg) (comment-forward (point-max)) (<= end (point))))) This fix successfully makes `comment-or-uncomment-region' call `comment-region' when fed empty lines, instead of calling `uncomment-region' (which seems wrong). It doesn't fix the main issue I was trying to address, namely that `comment-or-uncomment-region' fails to comment out a region consisting only of blank lines, even when `comment-empty-lines' is t. Without the above fix, it calls `uncomment-region' which does nothing as there's nothing to comment. With the above fix, it calls `comment-region'. But the latter refuses to comment out the lines, throwing a "Nothing to comment" error. Fixing that (assuming it's considered a bug) would require more changes to `comment-region-default' and `comment-region-internal'. The use-case for this was editing a LaTeX document, where empty lines are semantically significant (they demark paragraph breaks). It's fairly common (especially when editing co-authored documents) to comment out the empty lines in order to run two paragraphs together, whilst keeping the commented-out empty lines in the source so it's easy to revert. Best, Toby -- Dr T. S. Cubitt Reader (Associate Professor) in Quantum Information Royal Society University Research Fellow Department of Computer Science University College London email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 28 01:11:26 2021 Received: (at 41793) by debbugs.gnu.org; 28 Jan 2021 06:11:26 +0000 Received: from localhost ([127.0.0.1]:46827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l50WY-0008L8-MK for submit@debbugs.gnu.org; Thu, 28 Jan 2021 01:11:26 -0500 Received: from quimby.gnus.org ([95.216.78.240]:58482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l50WW-0008Ku-IR for 41793@debbugs.gnu.org; Thu, 28 Jan 2021 01:11:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rx3N39X5GFxeYmYIaF9EikLUMV2Xcl0ezOscD+sLOBw=; b=BPwQBhJP+AWfkxw2yqbPaoXaUz ToVW5z7D97jTt3zQxuam0YBi7SXNe6AgKztTUgSGC18BK7nfYhmCpNlTko6gQ+M0G/mRpT4T22DpU i4qApmpcxy6zbJnOOgIYkFxWDnvTTSt7fv2cmdj+Xrngq/qkgspjIzmTxeLrsPJv2TEs=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l50WK-0004y6-UV; Thu, 28 Jan 2021 07:11:13 +0100 From: Lars Ingebrigtsen To: Toby Cubitt Subject: Re: bug#41793: `comment-only-p' erroneously flags blank lines as comments References: <20200610175331.GA23889@bb84> <20200610185251.GA25375@bb84> X-Now-Playing: Tujiko Noriko's _Kuro (OST)_: "The Flood" Date: Thu, 28 Jan 2021 07:11:07 +0100 In-Reply-To: <20200610185251.GA25375@bb84> (Toby Cubitt's message of "Wed, 10 Jun 2020 19:52:51 +0100") Message-ID: <871re54mmc.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Toby Cubitt writes: > Gah. That attempt breaks flagging of comments separated by whitespace-only lines. Maybe this? > > (defun comment-only-p (beg end) > "Return non-nil if the text between BEG and END is all comments." [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41793 Cc: 41793@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 (-) Toby Cubitt writes: > Gah. That attempt breaks flagging of comments separated by whitespace-only lines. Maybe this? > > (defun comment-only-p (beg end) > "Return non-nil if the text between BEG and END is all comments." > (if (string-blank-p (buffer-substring beg end)) nil > (save-excursion > (goto-char beg) > (comment-forward (point-max)) > (<= end (point))))) I don't think that can be correct... for instance, it'll return nil on this C comment: /* | */ > This fix successfully makes `comment-or-uncomment-region' call > `comment-region' when fed empty lines, instead of calling > `uncomment-region' (which seems wrong). > > It doesn't fix the main issue I was trying to address, namely that > `comment-or-uncomment-region' fails to comment out a region consisting > only of blank lines, even when `comment-empty-lines' is t. Without the > above fix, it calls `uncomment-region' which does nothing as there's > nothing to comment. With the above fix, it calls `comment-region'. But > the latter refuses to comment out the lines, throwing a "Nothing to > comment" error. > > Fixing that (assuming it's considered a bug) would require more > changes to `comment-region-default' and `comment-region-internal'. > > The use-case for this was editing a LaTeX document, where empty lines > are semantically significant (they demark paragraph breaks). It's > fairly common (especially when editing co-authored documents) to > comment out the empty lines in order to run two paragraphs together, > whilst keeping the commented-out empty lines in the source so it's > easy to revert. Right -- `M-x comment-region' on a blank region will just say "Nothing to comment" here. Which makes sense in most modes, but not in LaTeX mode, I think. I've now fixed `M-x comment-region' for blank lines in `latex-mode' in Emacs 28, I think, but `M-x comment-or-uncomment-region' still doesn't work because `comment-only-p' is, as you say, wrong. Your first attempt looked like it had promise, but then you said: > Gah. That attempt breaks flagging of comments separated by > whitespace-only lines. Maybe this? Do you have an example of when that fails? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon May 09 07:14:56 2022 Received: (at 41793) by debbugs.gnu.org; 9 May 2022 11:14:56 +0000 Received: from localhost ([127.0.0.1]:56376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no1Lr-00089c-S0 for submit@debbugs.gnu.org; Mon, 09 May 2022 07:14:56 -0400 Received: from quimby.gnus.org ([95.216.78.240]:40928) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no1Lq-00089M-0f for 41793@debbugs.gnu.org; Mon, 09 May 2022 07:14:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FILU1U/KbAscBi7qWuk2wMRh4nBXbj96KdRaM9P71NE=; b=fq4cCqWetl5ggtKtYLlxNvDeN9 SPnOPbhAPgLXHD646cKz4b/dBZNXVRil3+i9FWnL3vpuK7fo6JdXaGMrqZdVcU8uCmQI6E/GtFWPY /E4LhZXV5GduC1SpfluAi92fJuiACws8Rk2bu0gKEcNML8QIZZ/7jU1SNyPeUpUFEkNA=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1no1Lg-00055G-W4; Mon, 09 May 2022 13:14:47 +0200 From: Lars Ingebrigtsen To: Toby Cubitt Subject: Re: bug#41793: `comment-only-p' erroneously flags blank lines as comments References: <20200610175331.GA23889@bb84> <20200610185251.GA25375@bb84> <871re54mmc.fsf@gnus.org> X-Now-Playing: Grace Jones's _Living My Life_: "Inspiration" Date: Mon, 09 May 2022 13:14:44 +0200 In-Reply-To: <871re54mmc.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 28 Jan 2021 07:11:07 +0100") Message-ID: <87sfpj7yaj.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: >> Gah. That attempt breaks flagging of comments separated by >> whitespace-only lines. Maybe this? > > Do you have an example of when that fails? The test was Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41793 Cc: 41793@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: -3.3 (---) Lars Ingebrigtsen writes: >> Gah. That attempt breaks flagging of comments separated by >> whitespace-only lines. Maybe this? > > Do you have an example of when that fails? The test was ;; foo ;; ;; bar where comment-only-p would give the wrong results. Anyway, I think it's ambiguous whether whitespace only should be a comment or not. The current algo considers this to be one comment: ;; foo ;; bar And I think that's correct. If we consider whitespace lines to not be comments, this would change how our comment navigation commands work. So there's some DWIM in this area, but I think how it currently works is basically the way we want it to work, so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon May 09 07:15:09 2022 Received: (at control) by debbugs.gnu.org; 9 May 2022 11:15:09 +0000 Received: from localhost ([127.0.0.1]:56380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no1M5-0008HN-2K for submit@debbugs.gnu.org; Mon, 09 May 2022 07:15:09 -0400 Received: from quimby.gnus.org ([95.216.78.240]:40942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no1Lt-00089T-Nf for control@debbugs.gnu.org; Mon, 09 May 2022 07:15:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oWZp+2SdfHj2MRuKCd1ym/1dKC5SRDs2FPQqCi4PyDI=; b=FWnNzm9rVEsMEuY5YogeCaeWEs lWMgqpZx4qQ5jc2koKcOPBgXwzqGl+EH01h72JapeTkHA7HWefXX7OGePZWekY2vAP29uD211VYbo V0z9ci+0wJFL9cIxYYs5u/k18NeevS052fDy9ET/1rNZoeftDjNYNlzhYM7tbPcfnaKQ=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1no1Lm-00055P-5g for control@debbugs.gnu.org; Mon, 09 May 2022 13:14:52 +0200 Date: Mon, 09 May 2022 13:14:49 +0200 Message-Id: <87r1537yae.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #41793 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 41793 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control 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: -3.3 (---) close 41793 quit From debbugs-submit-bounces@debbugs.gnu.org Mon May 09 11:07:23 2022 Received: (at 41793) by debbugs.gnu.org; 9 May 2022 15:07:23 +0000 Received: from localhost ([127.0.0.1]:59196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4ym-0005bn-0I for submit@debbugs.gnu.org; Mon, 09 May 2022 11:07:23 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:54290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4yi-0005bc-Ir for 41793@debbugs.gnu.org; Mon, 09 May 2022 11:07:18 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 249EpTCr023549; Mon, 9 May 2022 15:07:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=xVqqr3VO8MpdZCm90+xJmgxEC5RwoI9zWCEDCu3Lu0I=; b=x2Z3U8a6TeNPz0RKBhYFJZo6bojcy9UpsUplSjCR3ILsefEUiy2Bt4eD64dmGV+OapWu qoh+0XnO2xBgiGwuW8ig9KfXEodOzIT6OZG/kr+5FfRR5qfPisfiz8OXIdgHYfH1oFFz YUwuyKe6J8OwEhkMtpAiMtNt8rXPffoD6z0oZlsYh13vTCDrMaPb6uICa+IhSTEx57y+ kefaadviUYJrvz/AyGdQZyohwKGNFE2aRaJfBQFnbUDJRXRpOwoEt00uFKMl5FAv653h PCqhhTb9F6YYloIY0PzzsO678XuCbIUlm27Ylvrv3TrydgoK6PUb0BBU40PDNn+AzOpD sQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3fwgcsm06u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 May 2022 15:07:14 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 249F5GTY029032; Mon, 9 May 2022 15:07:13 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3fwf713cy6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 May 2022 15:07:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B3q1OWDYr8cTRaSGiWTbMnqMFn8JOF+Hp9mLhgcQcL9yMigVnt97N6yVHKjfYWQXA/Z58GwXVeadSNewwaKdE3PuD2Qhf5H94hu0XYbHYoryaZqOc8TYMHo8Q1G4Ki4bLv5OuI9krzAth19XAIpo+Cec14yLZWLJaeWmWgIdw4a1mYs03DfRfPmPyCYNklSq4p6HwyKTbRG7OLg4zVYXDGtNqSwznkyAw14mLYIMxSDfQFX2RhyouErNN59hZvu8IphMml5n/HGXst5pJR8Ch9fCF8KTN4v6KPfGCmcv0WrbrOZQXsxZdFwiVE1rCRbcrvNpeilizp0mLbiy9DsMZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xVqqr3VO8MpdZCm90+xJmgxEC5RwoI9zWCEDCu3Lu0I=; b=lxayUhl1p1fpHPgwkmM+TJN1AD1l/4Q0SPeOhdMnzF889VlNA6LPksUby8ED1XGgG1lAB9Zc6uBFbc3/H6t5Q2VKOYXcNZF8AyErvxGKCnY0rshPsYyENtt7evSI0uXn03Ynyhxr1Fec1McBj5U8ZkBy+aa71Rk3/AVLyPR/caReb9kPMFDRVzRhIilz/paqkq4Rgn1i/NuRG9DjHFgS9+zDLQqwbK8fGRWkpyDwGooia8rGxPH4DG4y6fCLTUyAfr4NEQElbS73OnGw+Z6bQBDWKJe6D0DNfIZIGyG8n1bs++UW7TlzjJr1N3IV8BQ92qP/dhl+5kd8KHV4B3Xi9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xVqqr3VO8MpdZCm90+xJmgxEC5RwoI9zWCEDCu3Lu0I=; b=PDbQRdERml7o6r3NaOXAgtz/BxXmQVvCp8gkZGqqpAT/uNiKtEz0dQ9iOzOUQLgcV9a22iEvw1nvvYUz/CKzkUs64Ciks/YF4tzsiiow9UaY0gltzU8OyCpWBSTf1y96sbCbwVfWZYx4shv969cowGel7LWBjlYLLnOQZg2NSk0= Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by MW5PR10MB5692.namprd10.prod.outlook.com (2603:10b6:303:1a3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20; Mon, 9 May 2022 15:07:11 +0000 Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::a0e7:5f38:ab50:5123]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::a0e7:5f38:ab50:5123%9]) with mapi id 15.20.5227.023; Mon, 9 May 2022 15:07:11 +0000 From: Drew Adams To: Lars Ingebrigtsen , Toby Cubitt Subject: RE: [External] : bug#41793: `comment-only-p' erroneously flags blank lines as comments Thread-Topic: [External] : bug#41793: `comment-only-p' erroneously flags blank lines as comments Thread-Index: AQHYY5hV7TYdHW1oy0CaCenbPER4aa0WnQjw Date: Mon, 9 May 2022 15:07:10 +0000 Message-ID: References: <20200610175331.GA23889@bb84> <20200610185251.GA25375@bb84> <871re54mmc.fsf@gnus.org> <87sfpj7yaj.fsf@gnus.org> In-Reply-To: <87sfpj7yaj.fsf@gnus.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 151d0085-590f-44de-be5a-08da31cd97b6 x-ms-traffictypediagnostic: MW5PR10MB5692:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vIhDITFzAxB2pw6PCkHlScPWrCth26q/siCDsPwCmmg7lp8vjCXgq12WM8WfqKWIGEFbXaT1SWEJF8FXheesddrDyZ1nUt8wmG3OHLG4fuH3Lmy+II1f26SH8STi0dy6/H3xE7W2QMeX9qfx71ifoLb97UVU4dvH/uC8Ip53AR/LiKSF3Q2mb0FRIWThSMmljj2Kf+vjORMl9nw0qeKrxFQwURPHpebq5z3oz3G5esMocnyHWzmYnCZnByvkq+Q8ZFX1XRnQ4ZcY8lb+/8MIQy8vo8LX3wyZy+EMKy9FRVjK1SM4LsoCJnkZrnaRPdp09+IrcNm1I46QZVC+ekkk552T61zSZ/su4ND0bvAA6CdkFzhl9nSkwNrltT2WY+zL4BZ3WxrdgsJ6jxzcUEXnUh8YAtasT2SnC+/wxVInxWJOW7wTu4i2ETJCh8OOoC0IhpesZ4CNgYDQ7YWA/OI9wdKSZjhesVVYJL3hdeQ4Bh8zU+US2VPTaRQqbF2dntbNq8Ckq9tWRpedmsO9cC6V38a/zHEH/858jteoAGpH27SWpHmh1j5UsFxFfhjyUj+CP4aE0nvesPyb0Og1JXkPU5e0y9bYwserCtWPImU5hsd/2eeEorjA/7+azyrt2r9D4mHAeEPrSQiT6YtBR3b/nhTjFFS85a+nt6SjjomHhULTAxmf9mDV3ADesXeXkN8Vw25RwwNWgtVEP+FA532cuEQIFO9pcEZbMWJQNdHa3v0= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(71200400001)(186003)(86362001)(66946007)(83380400001)(8936002)(5660300002)(122000001)(38100700002)(2906002)(52536014)(8676002)(4326008)(33656002)(110136005)(76116006)(508600001)(66556008)(55016003)(38070700005)(64756008)(316002)(7696005)(66446008)(66476007)(44832011)(26005)(6506007)(9686003)(81973001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?YVDCvXtLW7u6/fkv0ivMPgMNe+s/1nUNtnzAlb1N5CZhXof4z7yPJjXC7lQF?= =?us-ascii?Q?MunssrZDdLiAMYHHmYiMW73JvJsjF8rJEkb6giYEVOmSe5/p2njrkuSVryuu?= =?us-ascii?Q?Suzvz0V7sGzO20Brr9FkVvToz62LSolOT3pnOB36bdFivbPoiFK4B5XY8hBl?= =?us-ascii?Q?y3flqzKvZb89WaS2FpFSRe14Tn8hDwaaswVlazYsTDYDI0gTLHPdO3ks5ty4?= =?us-ascii?Q?P5HE2Ia58DuLtPbHdipnF75ES6zM/JRyZDFwOBsRaMvxhUat/Raf0y65OEKP?= =?us-ascii?Q?VY7PWT75zmB0XvZbDFCofp+OkIfTmUWgEJniSqn0VCTwMwFlIfasj2i+TFII?= =?us-ascii?Q?xORNpVVuFEmqALFcjZ02xQSZ3r5ROxoZzGSZ7U1HEYjULUpcrS/ItoOSJI7l?= =?us-ascii?Q?UBBmoFwbhNRNjnick4VBAtJURXavOye/2DkSL4tp0ZPLfGEgUus74L53EPJo?= =?us-ascii?Q?Uezv0TFn6aUnlwozJ5JRpFfzH8qd3hRe98mjbI7N36zK0+q43Upa5LqkzBxC?= =?us-ascii?Q?UJ+ostlqRuRuGoJhdQjFXx9OY3a9jB1xHLLTX/+CpdVvXPsnr1mq7sBG7Qmy?= =?us-ascii?Q?SAqW6SRdLGEIwVOdcJIxDFCgEhHMTJ4gVR56qQYxdY/sL/c8hxC5A7b2Boct?= =?us-ascii?Q?xBXbj3djo/nlAlYrLk40qyrTDhL325B+QtHMdWfpJk2qD0CRzCP0o1WROkPD?= =?us-ascii?Q?TmO1uYAcY/k7Ca2CR4tBNB7ljVivHlt6Y0kU1Z7P+Vxa3JenR3eJTgLHeKYI?= =?us-ascii?Q?AlHJuATac5KtImJZjf4BRk71tBr8z8fLCjm2c5zWAhgbXLl6y2zGZH53H5ew?= =?us-ascii?Q?255MuE5RVSEOvFSSDmnvL28FV1hX0GYjj149JOFDD4RzYpdiIcuAnmEzNCn+?= =?us-ascii?Q?Nyfop+lCpWg6Hn0zk11IjoSIMjNltWnbU0lQRG3+IQuNRmCxNtc3FeF5283g?= =?us-ascii?Q?5NXQOgT3WcnUH7a2jRuK90E3aWHGqeFD2Xljes1VQXwo6QoT0dVrKX08ek/h?= =?us-ascii?Q?TmvH9BuYe4ZjzVIaq97iF+g/btEH1XvK6hevxJH15aXd/aYfvzDQdrq1/p64?= =?us-ascii?Q?mXca+ZIMB8YeEqXsFsKyKSUv5hPKR+m6YfBHENXUptZXWBFKO/xJEjDm9n65?= =?us-ascii?Q?x+A1cWKGOfWFOgHed97PiHjxhI4B3foC9AReQIya6MNDNNNps9xXTwqrJkRf?= =?us-ascii?Q?GOgO9eR4x2bF4sNt9fkNnkaYjI/xLcGE22PvMtrhg7Hi7ln4iHCWvVJ8sqCL?= =?us-ascii?Q?0+Xaa0lZy4Oj4R0mYxxDpE5STGp+yvhGV/NyBVM0gV/Yzm52jgb8PtiDB15T?= =?us-ascii?Q?cG9rTroojL+sb6HirWqz/BeW/ovhvA0b2KZ9HaGansevZSRm8k7C0u0NUBpm?= =?us-ascii?Q?vTZ+m1NSFwkoXFQ6SkMi3T/FrWyuyjUxW0Q0hfQuUXgj7nsYWGYMlUaUnSsB?= =?us-ascii?Q?ZXhODd9gatd6a0n3829sK2ysVvOPMxVudJXXoWH53ONC4pCiHgJlqLRtC0Za?= =?us-ascii?Q?85MlBHpACUMjyroo8eTwtRVvb3uB3y+rj2Osm4dADyLQ0yWBsL2ErVGD8bjC?= =?us-ascii?Q?zVa2eKLtqrFZsq6ij/i3iegD5BL3igKSg+ushPLVpvdPjccbDQfTKyPO/ZAq?= =?us-ascii?Q?+CyOT8jmYcnlBWvZNtSFYiZd+Sxa/4Lzx44gKLKq71MHq3B6A2nHGpXND84T?= =?us-ascii?Q?7LDnEOlQJTMYh8pjRaHETyM1qrr2kN3h3XHHrFXIKXOcZRnM0Jnm+HriAoN7?= =?us-ascii?Q?Wn3bGihokQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 151d0085-590f-44de-be5a-08da31cd97b6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2022 15:07:10.9582 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mIVuEwZ/uvYW8SHmn84+no9XhHsuWlRH1nHN6PU8KEjn7eu7XJy95kNWjBjN+8RYJSspPuABpwsKwqbzhwVprA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR10MB5692 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.858 definitions=2022-05-09_04:2022-05-09, 2022-05-09 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 mlxlogscore=802 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205090086 X-Proofpoint-GUID: 9xRNy9EpjhjmJkCbcgST_2z_EniTSH-z X-Proofpoint-ORIG-GUID: 9xRNy9EpjhjmJkCbcgST_2z_EniTSH-z X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 41793 Cc: "41793@debbugs.gnu.org" <41793@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.7 (-) > Anyway, I think it's ambiguous whether whitespace only=20 > should be a comment or not. The current algo considers > this to be one comment: >=20 > ;; foo >=20 > ;; bar >=20 > And I think that's correct. If we consider whitespace lines to not be > comments, this would change how our comment navigation commands work. We do NOT consider that to be the case. Never have. > So there's some DWIM in this area, but I think how it currently works > is basically the way we want it to work, so I'm closing this bug report. Those are two separate comments. The line between them is NOT commented out. A comment is delimited by `comment-start' and `comment-end'. (And `comment-(start|end)-skip' and `comment-end-can-be-escaped', if you like.) Comments that have "" as `comment-end' "are terminated by end-of-line" (to quote the doc string). The doc is quite clear about all of this, IMO - in doc strings, in the Emacs manual, and in the Elisp manual. A Lisp comment "continues to the end of the line" - no further. ((elisp) `Comments'.) Beyond the doc, this is fundamental to Elisp behavior. Try `(forward-comment 1) on your test case, for example. Code depends on `forward-comment' and the like, including thingatpt.el code. ___ Whether `comment-only-p' should or should not report `t' here is a different question from what I addressed above. That depends on what the intention of `comment-only-p is. I suggest you find out what that function was intended for, and what existing code might depend on its current behavior. But one thing is certain: what you said about the example you show being a single comment is 100% wrong. It is two comments. The same thing is true for this example, BTW: ;; foo ;; bar Those are two comments. It's possible, maybe even likely, that the intention of `comment-only-p' is to return non-nil when one comment is immediately followed by another. Or maybe even when one is followed by whitespace and then by another. TBD. But those are two separate comments, each delimited by the first `;' on each line and the first end-of-line that follows that first `;'. From unknown Sat Jun 21 03:30:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 07 Jun 2022 11:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator