GNU bug report logs - #60034
comment character for org and python includes a space

Previous Next

Package: emacs;

Reported by: Heime <heimeborgia <at> protonmail.com>

Date: Tue, 13 Dec 2022 15:29:02 UTC

Severity: normal

Tags: notabug, wontfix

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60034 in the body.
You can then email your comments to 60034 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60034; Package emacs. (Tue, 13 Dec 2022 15:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Heime <heimeborgia <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 13 Dec 2022 15:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Heime <heimeborgia <at> protonmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: comment character for org and python includes a space
Date: Tue, 13 Dec 2022 15:27:58 +0000
How is it that the comment character for org and python include a space "# ", when
for all other languages it is only a single character?








Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60034; Package emacs. (Tue, 13 Dec 2022 18:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 60034 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Heime <heimeborgia <at> protonmail.com>, 60034 <at> debbugs.gnu.org
Subject: Re: bug#60034: comment character for org and python includes a space
Date: Tue, 13 Dec 2022 10:36:45 -0800
tags 60034 + moreinfo
thanks

Heime via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> How is it that the comment character for org and python include a space "# ", when
> for all other languages it is only a single character?

Could you explain which variable(s) you are looking at?

Are you reporting a bug in the behavior of python-mode and org-mode?  If
so, what is it?




Added tag(s) moreinfo. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 13 Dec 2022 18:37:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60034; Package emacs. (Wed, 14 Dec 2022 02:36:01 GMT) Full text and rfc822 format available.

Message #13 received at 60034 <at> debbugs.gnu.org (full text, mbox):

From: Heime <heimeborgia <at> protonmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 60034 <at> debbugs.gnu.org
Subject: Re: bug#60034: comment character for org and python includes a space
Date: Wed, 14 Dec 2022 02:35:40 +0000
------- Original Message -------
On Tuesday, December 13th, 2022 at 6:36 PM, Stefan Kangas <stefankangas <at> gmail.com> wrote:


> tags 60034 + moreinfo
> thanks
> 
> Heime via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" bug-gnu-emacs <at> gnu.org writes:
> 
> > How is it that the comment character for org and python include a space "# ", when
> > for all other languages it is only a single character?
> 
> 
> Could you explain which variable(s) you are looking at?
> 
> Are you reporting a bug in the behavior of python-mode and org-mode? If
> so, what is it?

It is about "comment-start".  I am constructing a "regexp" for use with hi-lock mode to highlight certain comments.

For elisp I am matching ";; [Text] More"

The regex is adapted for the particular programming mode.  Another difficulty has been that in "c-mode", "comment-start" returns "/*" with no possibility to get the alternative "//". 

(defun tegor ()
  "TODO."
  (interactive)

  (let ( (fm (format "%s%s" comment-start comment-start)) )

    (message "fm: %s" fm)
    (message "kmcategor: %s"
       (format "%s%s%s" "^\s*" fm "\s\\(\\[.+\\]\\).*$"))))







Removed tag(s) moreinfo. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 03 Sep 2023 09:39:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60034; Package emacs. (Sun, 10 Sep 2023 18:49:02 GMT) Full text and rfc822 format available.

Message #18 received at 60034 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Heime <heimeborgia <at> protonmail.com>
Cc: 60034 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> gnu.org>
Subject: Re: bug#60034: comment character for org and python includes a space
Date: Sun, 10 Sep 2023 11:47:47 -0700
Heime <heimeborgia <at> protonmail.com> writes:

>> Heime via "Bug reports for GNU Emacs, the Swiss army knife of text
>> editors" bug-gnu-emacs <at> gnu.org writes:
>>
>> > How is it that the comment character for org and python include a
>> > space "# ", when for all other languages it is only a single
>> > character?
>>
>> Could you explain which variable(s) you are looking at?
>>
>> Are you reporting a bug in the behavior of python-mode and org-mode?
>> If so, what is it?
>
> It is about "comment-start".  I am constructing a "regexp" for use
> with hi-lock mode to highlight certain comments.
>
> For elisp I am matching ";; [Text] More"
>
> The regex is adapted for the particular programming mode.

It seems like we do it both ways in our sources, so I'm not sure if it
matters, or what is the correct way.  It's not documented in the
`comment-start' docstring either.

Perhaps it's better to just leave it out unless it is a part of the
language grammar, but I don't know if it would have any adverse effects.

Stefan, what do you think?

> Another difficulty has been that in "c-mode", "comment-start" returns
> "/*" with no possibility to get the alternative "//".

Please report this as a separate bug report, and include the use case
you're looking at with all the details.

> (defun tegor ()
>   "TODO."  (interactive)
>   (let ( (fm (format "%s%s" comment-start comment-start)) )
>     (message "fm: %s" fm) (message "kmcategor: %s"
>        (format "%s%s%s" "^\s*" fm "\s\\(\\[.+\\]\\).*$"))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60034; Package emacs. (Mon, 11 Sep 2023 02:47:01 GMT) Full text and rfc822 format available.

Message #21 received at 60034 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 60034 <at> debbugs.gnu.org, Heime <heimeborgia <at> protonmail.com>,
 Stefan Monnier <monnier <at> gnu.org>
Subject: Re: bug#60034: comment character for org and python includes a space
Date: Sun, 10 Sep 2023 22:46:37 -0400
>>> > How is it that the comment character for org and python include a
>>> > space "# ", when for all other languages it is only a single
>>> > character?

FWIW, both options are valid and they lead to different results
when you do `M-;` (as well as as when `-comment-add` is 0).

E.g. ELisp uses ";" rather than "; " so that you can do `M-; ; hello` to
add a comment of the form `;; hello` at the end of the current line.

In modes where using repetitions of the comment char is unusual
(typically because indentation rules don't pay attention to the number
of consecutive comment chars), it's more common to add a space at the
end of `comment-start`.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60034; Package emacs. (Mon, 11 Sep 2023 08:25:02 GMT) Full text and rfc822 format available.

Message #24 received at 60034 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 60034 <at> debbugs.gnu.org, Heime <heimeborgia <at> protonmail.com>,
 Stefan Monnier <monnier <at> gnu.org>
Subject: Re: bug#60034: comment character for org and python includes a space
Date: Mon, 11 Sep 2023 01:24:04 -0700
tags 60034 + notabug wontfix
close 60034
thanks

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>>> > How is it that the comment character for org and python include a
>>>> > space "# ", when for all other languages it is only a single
>>>> > character?
>
> FWIW, both options are valid and they lead to different results
> when you do `M-;` (as well as as when `-comment-add` is 0).
>
> E.g. ELisp uses ";" rather than "; " so that you can do `M-; ; hello` to
> add a comment of the form `;; hello` at the end of the current line.
>
> In modes where using repetitions of the comment char is unusual
> (typically because indentation rules don't pay attention to the number
> of consecutive comment chars), it's more common to add a space at the
> end of `comment-start`.

Thanks, so I don't think there's anything to fix here.  If someone needs
the space-free version, they can use something like:

    (string-remove-suffix " " comment-start)

So I'm closing this as a wontfix.  Sorry.




Added tag(s) notabug and wontfix. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 11 Sep 2023 08:25:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 60034 <at> debbugs.gnu.org and Heime <heimeborgia <at> protonmail.com> Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 11 Sep 2023 08:25:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 09 Oct 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 172 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.