help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: one key-press to comment out lines of code?


From: Drew Adams
Subject: RE: one key-press to comment out lines of code?
Date: Thu, 1 May 2014 07:39:51 -0700 (PDT)

> > `M-;' cannot uncomment the commented lines in the
> > region when there are also uncommented lines.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
> Alright, nested comments! I never did that so I never
> thought about it. But what I can see, M-; works for
> those as well:
> 
> ;; ;; commented-out comment
> into
> ;; commented-out comment

See above: "^^^^^".  I already pointed out that M-; will nest.
And that it will unnest, but only if the region contains only
commented lines.

> and
> ;; (message "done") ; redundant comment
> into
> (message "done") ; redundant comment
> as well as "mulit-;" comments:
> ;;;; IMPORTANT
> into
> IMPORTANT

See above - same story.  And my previous mails about this.
And the doc.  And witness the behavior.

> I don't really comment-out code - but when I do, M-;
> always worked.
> 
> What are the use-cases where M-; doesn't work? Perhaps
> that could be solved somehow - depends on how varied,
> and how advanced, those situations are, of course.

See what I wrote previously.  Or look at the doc of
`comment-dwim' vs `comment-region'.  Or experiment and see.

It's not about "solving" `comment-dwim's differences.  They
are different on purpose, presumably.  It is a compromise.
If it works well enough for what you want, great.

> > A DWIM command is often limited this way; it is a
> > compromise.
> 
> It doesn't have to be.

It has to be.  It is a guess wrt what any given user wants
at any given time.

Compromises can be good or bad, handy or not, depending on
the algorithm, the user, and the situation.  All commands
are compromises, of course.  Some give the user more control.

`comment-dwim' doesn't give you the `comment-region' behavior
and control.  In my case that means it doesn't give me what
I want.  YMMV.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]