GNU bug report logs - #37099
26.2 Comment-dwim

Previous Next

Package: emacs;

Reported by: Charles Jackson <charles.b.jackson <at> protonmail.com>

Date: Tue, 20 Aug 2019 15:41:01 UTC

Severity: wishlist

Tags: wontfix

Found in version 26.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 37099 in the body.
You can then email your comments to 37099 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#37099; Package emacs. (Tue, 20 Aug 2019 15:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Charles Jackson <charles.b.jackson <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 20 Aug 2019 15:41:02 GMT) Full text and rfc822 format available.

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

From: Charles Jackson <charles.b.jackson <at> protonmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 26.2 Comment-dwim
Date: Tue, 20 Aug 2019 15:39:58 +0000
[Message part 1 (text/plain, inline)]
I would like the comment-dwim function to be able to differentiate end-of-line comments from whole-line comments.
For example in java mode it would make sense for // to be the end-of-line comment, but if point is on an empty line then comment-dwim would insert /* */ with point inside the /* */ like so: /* | */ where | is the point location.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37099; Package emacs. (Wed, 21 Aug 2019 17:36:01 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: gnu-emacs-bug <at> moderators.isc.org
Subject: Re: bug#37099: 26.2 Comment-dwim
Date: Wed, 21 Aug 2019 16:42:35 -0000 (UTC)
Hello, Charles.

Charles Jackson <charles.b.jackson <at> protonmail.com> wrote:
> [-- text/plain, encoding base64, charset: UTF-8, 8 lines --]

> I would like the comment-dwim function to be able to differentiate
> end-of-line comments from whole-line comments.

OK.  What should happen when a whole-line comment becomes and end-of-line
comment (by inserting text before it), or vice versa?

> For example in java mode it would make sense for // to be the
> end-of-line comment, but if point is on an empty line then comment-dwim
> would insert /* */ with point inside the /* */ like so: /* | */ where |
> is the point location.

Why would this make sense?  For example, how big is the community of
users who would want such a facility.

A general solution to this wish would be surprisingly difficult and
time-consuming to write.  The Emacs source file, newcomment.el (which
contains the command comment-dwim) contains no representation of
different pairs of comment delimiters, and this would have to be added.

It is CC Mode here which maintains the two different pairs of comment
delimiters, /* .... */ and // .... \n.  In a CC Mode mode (such as Java
Mode) you can manually switch between the delimiter pairs with C-c C-k,
c-toggle-comment-style.

It would be relatively easy to add Lisp "advice" to the function
comment-dwim just for Java Mode, which would use c-toggle-comment-style
to set the comment delimiters after having determined the required pair
of comment delimiters.

Again, how useful a facility would this really be?  Useful enough to
justify the time and effort to write a full solution, or rather a
localised need which would best be satisfied with a careful hack (such as
outlined above)?

-- 
Alan Mackenzie (Nuremberg, Germany).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37099; Package emacs. (Sat, 30 Jan 2021 07:41:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 37099 <at> debbugs.gnu.org
Subject: Re: bug#37099: 26.2 Comment-dwim
Date: Sat, 30 Jan 2021 08:40:37 +0100
Alan Mackenzie <acm <at> muc.de> writes:

>> For example in java mode it would make sense for // to be the
>> end-of-line comment, but if point is on an empty line then comment-dwim
>> would insert /* */ with point inside the /* */ like so: /* | */ where |
>> is the point location.
>
> Why would this make sense?  For example, how big is the community of
> users who would want such a facility.

There didn't seem to be much enthusiasm for the proposed functionality,
so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 30 Jan 2021 07:41:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 37099 <at> debbugs.gnu.org and Charles Jackson <charles.b.jackson <at> protonmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 30 Jan 2021 07:41: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. (Sat, 27 Feb 2021 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 31 days ago.

Previous Next


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