* bug#37099: 26.2 Comment-dwim
@ 2019-08-20 15:39 Charles Jackson via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <mailman.512.1566315667.30381.bug-gnu-emacs@gnu.org>
0 siblings, 1 reply; 3+ messages in thread
From: Charles Jackson via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2019-08-20 15:39 UTC (permalink / raw)
To: 37099
[-- Attachment #1: Type: text/plain, Size: 342 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 372 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#37099: 26.2 Comment-dwim
[not found] ` <mailman.512.1566315667.30381.bug-gnu-emacs@gnu.org>
@ 2019-08-21 16:42 ` Alan Mackenzie
2021-01-30 7:40 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2019-08-21 16:42 UTC (permalink / raw)
To: gnu-emacs-bug
Hello, Charles.
Charles Jackson <charles.b.jackson@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).
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#37099: 26.2 Comment-dwim
2019-08-21 16:42 ` Alan Mackenzie
@ 2021-01-30 7:40 ` Lars Ingebrigtsen
0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-30 7:40 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: 37099
Alan Mackenzie <acm@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-30 7:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 15:39 bug#37099: 26.2 Comment-dwim Charles Jackson via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <mailman.512.1566315667.30381.bug-gnu-emacs@gnu.org>
2019-08-21 16:42 ` Alan Mackenzie
2021-01-30 7:40 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).