unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately
@ 2009-05-24 22:31 Drew Adams
  2009-05-25 13:41 ` Stefan Monnier
  0 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2009-05-24 22:31 UTC (permalink / raw)
  To: emacs-pretest-bug

emacs -Q
 
In buffer *scratch*, type this: SPC SPC ` a b c d e f ' RET
 
That inserts this line, followed by a newline:
  `abcdef'
 

Select the line, including the newline at its end: `M-< C-SPC C-n'.
 
M-x comment-region
 
In Emacs 23, this is the result:
 
  ;; `abcdef'
 
In all previous versions of Emacs, the comment chars are inserted at
the start of the line - they are not indented two spaces:
 
;;   `abcdef'
 
This is so for Emacs 20, 21, and 22. (Though in Emacs 20 only one
semicolon is used.)
 
This breaks any code that depends on the traditional behavior.  For
instance, I have code that updates file-header lines, and now, instead
of this:
 
;; Features that might be required by this library:
;;
;;   `abcdef', `ghijk', `lmnop'.
;;
 
I get this;
 
;; Features that might be required by this library:
;;
  ;; `abcdef', `ghijk', `lmnop'.
;;
 
I need this code to work in all Emacs versions. I certainly hope you
do not consider this change to be a feature instead of a bug.
 
 
 
In GNU Emacs 23.0.94.1 (i386-mingw-nt5.1.2600)
 of 2009-05-24 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
 






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately
@ 2009-05-24 23:31 Chong Yidong
  2009-05-24 23:57 ` Drew Adams
  2009-05-25  0:04 ` Lennart Borgman
  0 siblings, 2 replies; 23+ messages in thread
From: Chong Yidong @ 2009-05-24 23:31 UTC (permalink / raw)
  To: Drew Adams; +Cc: 3370

> In buffer *scratch*, type this: SPC SPC ` a b c d e f ' RET
>
> Select the line, including the newline at its end: `M-< C-SPC C-n'.
> M-x comment-region
> 
> In Emacs 23, this is the result:
> 
>   ;; `abcdef'
> 
> In all previous versions of Emacs, the comment chars are inserted at
> the start of the line - they are not indented two spaces

Wrong.  The behavior is identical in Emacs 22.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately
  2009-05-24 23:31 bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately Chong Yidong
@ 2009-05-24 23:57 ` Drew Adams
  2009-05-25  0:04 ` Lennart Borgman
  1 sibling, 0 replies; 23+ messages in thread
From: Drew Adams @ 2009-05-24 23:57 UTC (permalink / raw)
  To: 'Chong Yidong'; +Cc: 3370

> From: Chong Yidong Sent: Sunday, May 24, 2009 4:32 PM
> > In buffer *scratch*, type this: SPC SPC ` a b c d e f ' RET
> >
> > Select the line, including the newline at its end: `M-< C-SPC C-n'.
> > M-x comment-region
> > 
> > In Emacs 23, this is the result:
> > 
> >   ;; `abcdef'
> > 
> > In all previous versions of Emacs, the comment chars are inserted at
> > the start of the line - they are not indented two spaces
> 
> Wrong.  The behavior is identical in Emacs 22.

You are absolutely incorrect.

I just did it again, in `emacs -Q' in 22.3:

GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600)
 of 2008-09-06 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

The result is, exactly as I stated:

;;   `abcdef'

Please do not reply that way, without even trying the recipe. It doesn't help.

Let me repeat the instructions differently, just so you are clear. Insert this
text at the beginning of *scratch*: "  `abcdef'". Follow that by hitting RET to
insert a newline.

Put point at bob and hit C-SPC to set mark. Use C-n to move past the inserted
line.

Do M-x comment-region

You will *NOT* see this in Emacs 22 (or 21 or 20 or ...):

  ;; `abcdef'

You WILL see this in Emacs 22:

;;   `abcdef'






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-24 23:31 bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately Chong Yidong
  2009-05-24 23:57 ` Drew Adams
@ 2009-05-25  0:04 ` Lennart Borgman
  2009-05-25  0:54   ` Chong Yidong
  1 sibling, 1 reply; 23+ messages in thread
From: Lennart Borgman @ 2009-05-25  0:04 UTC (permalink / raw)
  To: Chong Yidong, 3370

On Mon, May 25, 2009 at 1:31 AM, Chong Yidong <cyd@stupidchicken.com> wrote:
>> In buffer *scratch*, type this: SPC SPC ` a b c d e f ' RET
>>
>> Select the line, including the newline at its end: `M-< C-SPC C-n'.
>> M-x comment-region
>>
>> In Emacs 23, this is the result:
>>
>>   ;; `abcdef'
>>
>> In all previous versions of Emacs, the comment chars are inserted at
>> the start of the line - they are not indented two spaces
>
> Wrong.  The behavior is identical in Emacs 22.

Are you sure? I never noticed it there.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  0:04 ` Lennart Borgman
@ 2009-05-25  0:54   ` Chong Yidong
  2009-05-25  1:28     ` Jason Rumney
  0 siblings, 1 reply; 23+ messages in thread
From: Chong Yidong @ 2009-05-25  0:54 UTC (permalink / raw)
  To: Drew Adams; +Cc: Dan Nicolaescu, rms, 3370

> > In buffer *scratch*, type this: SPC SPC ` a b c d e f ' RET
> >
> > Select the line, including the newline at its end: `M-< C-SPC C-n'.
> > M-x comment-region
> > 
> > In Emacs 23, this is the result:
> > 
> >   ;; `abcdef'
> > 
> > In all previous versions of Emacs, the comment chars are inserted at
> > the start of the line - they are not indented two spaces

> Wrong.  The behavior is identical in Emacs 22.

Aha, I was mistaken.  Sorry for the confusion.

The default for `comment-style' has been changed, it is no longer
`plain'.  See Richard's 2007-10-26 changing it to `indent-or-tripe', and
Dan's 2008-12-18 change making it `indent' (Bug#1153).

This should have been documented in NEWS; I'll do that.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  0:54   ` Chong Yidong
@ 2009-05-25  1:28     ` Jason Rumney
  2009-05-25  2:09       ` Drew Adams
                         ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Jason Rumney @ 2009-05-25  1:28 UTC (permalink / raw)
  To: Chong Yidong, 3370; +Cc: Dan Nicolaescu, rms

Chong Yidong wrote:
> Aha, I was mistaken.  Sorry for the confusion.
>
> The default for `comment-style' has been changed, it is no longer
> `plain'.  See Richard's 2007-10-26 changing it to `indent-or-tripe', and
> Dan's 2008-12-18 change making it `indent' (Bug#1153).
>
> This should have been documented in NEWS; I'll do that.
>   

Or perhaps it would have been better putting it back to plain if 
Richard's new indent-or-triple option was found to not be a suitable 
default.  I'm not sure that Dan looked into the history when he changed 
it to indent.






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  1:28     ` Jason Rumney
@ 2009-05-25  2:09       ` Drew Adams
  2009-05-25  4:47       ` Chong Yidong
  2009-05-25  5:26       ` Dan Nicolaescu
  2 siblings, 0 replies; 23+ messages in thread
From: Drew Adams @ 2009-05-25  2:09 UTC (permalink / raw)
  To: 'Jason Rumney', 'Chong Yidong', 3370
  Cc: 'Dan Nicolaescu', rms

> > Aha, I was mistaken.  Sorry for the confusion.
> >
> > The default for `comment-style' has been changed, it is no longer
> > `plain'.  See Richard's 2007-10-26 changing it to 
> > `indent-or-tripe', and Dan's 2008-12-18 change making it
> > `indent' (Bug#1153).
> >
> > This should have been documented in NEWS; I'll do that.
> 
> Or perhaps it would have been better putting it back to plain if 
> Richard's new indent-or-triple option was found to not be a suitable 
> default.  I'm not sure that Dan looked into the history when 
> he changed it to indent.

Please restore the traditional behavior.
A mere doc change does not cut the mustard.







^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  1:28     ` Jason Rumney
  2009-05-25  2:09       ` Drew Adams
@ 2009-05-25  4:47       ` Chong Yidong
  2009-05-25  7:01         ` Drew Adams
  2009-05-25  5:26       ` Dan Nicolaescu
  2 siblings, 1 reply; 23+ messages in thread
From: Chong Yidong @ 2009-05-25  4:47 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Dan Nicolaescu, rms, 3370

Jason Rumney <jasonr@gnu.org> writes:

> Or perhaps it would have been better putting it back to plain if
> Richard's new indent-or-triple option was found to not be a suitable
> default.  I'm not sure that Dan looked into the history when he
> changed it to indent.

Maybe.  Could Dan or Richard weigh in on this?

Personally, all else being equal, I think `indent' is a better comment
style.  For instance, all the Emacs sources use that style.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  1:28     ` Jason Rumney
  2009-05-25  2:09       ` Drew Adams
  2009-05-25  4:47       ` Chong Yidong
@ 2009-05-25  5:26       ` Dan Nicolaescu
  2009-05-25  7:02         ` Drew Adams
  2 siblings, 1 reply; 23+ messages in thread
From: Dan Nicolaescu @ 2009-05-25  5:26 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Chong Yidong, rms, 3370

Jason Rumney <jasonr@gnu.org> writes:

  > Chong Yidong wrote:
  > > Aha, I was mistaken.  Sorry for the confusion.
  > >
  > > The default for `comment-style' has been changed, it is no longer
  > > `plain'.  See Richard's 2007-10-26 changing it to `indent-or-tripe', and
  > > Dan's 2008-12-18 change making it `indent' (Bug#1153).
  > >
  > > This should have been documented in NEWS; I'll do that.
  > >   
  > 
  > Or perhaps it would have been better putting it back to plain if
  > Richard's new indent-or-triple option was found to not be a suitable
  > default.  I'm not sure that Dan looked into the history when he
  > changed it to indent.

I am quite sure I did.
'indent was also the preference of the person that wrote the new
incarnation of the region indent code and who explicitly approved the
change: Stefan.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  4:47       ` Chong Yidong
@ 2009-05-25  7:01         ` Drew Adams
  2009-05-25 13:27           ` Chong Yidong
  2009-05-25 13:38           ` Stefan Monnier
  0 siblings, 2 replies; 23+ messages in thread
From: Drew Adams @ 2009-05-25  7:01 UTC (permalink / raw)
  To: 'Chong Yidong', 'Jason Rumney'
  Cc: 'Dan Nicolaescu', rms, 3370

> > Or perhaps it would have been better putting it back to plain if
> > Richard's new indent-or-triple option was found to not be a suitable
> > default.  I'm not sure that Dan looked into the history when he
> > changed it to indent.
> 
> Maybe.  Could Dan or Richard weigh in on this?
> 
> Personally, all else being equal,

Why would everything else be equal? What's wrong with considering what Emacs has
always done, and perhaps even thinking about breaking existing code (such as
what I reported)? Everything else is not equal.

> I think `indent' is a better comment
> style.  For instance, all the Emacs sources use that style.

I don't know what `comment-style' is, so it's difficult for me to discuss it.
There is no doc for it that explains anything - see bug #2271.

What do you mean by "all the Emacs sources use that style"? I was guessing from
your previous mail that `comment-style' somehow controls `comment-region' (which
is what this bug report is about), which performs an action. How can static
source code be said to "use that style"?

If you are referring to ;; always being indented instead of starting a line
(which is not what I reported about), then no, there are plenty of source code
lines that start with ;; - in file headers, for instance.






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  5:26       ` Dan Nicolaescu
@ 2009-05-25  7:02         ` Drew Adams
  2009-05-25 13:30           ` Chong Yidong
  2009-05-25 13:39           ` Stefan Monnier
  0 siblings, 2 replies; 23+ messages in thread
From: Drew Adams @ 2009-05-25  7:02 UTC (permalink / raw)
  To: 'Dan Nicolaescu', 'Jason Rumney'
  Cc: 'Chong Yidong', rms, 3370

> 'indent was also the preference of the person that wrote the new
> incarnation of the region indent code and who explicitly approved the
> change: Stefan.

`comment-region' is not, or at least was not, about indenting. It is about
commenting out the code in the region.

There is nothing in the Elisp manual about `comment-region'. What there is about
it in the Emacs manual does not mention at all how it affects indenting or is
affected by indenting, and it does not mention `comment-style' at all.

The only mention of indenting in a node that talks also about `comment-region'
is the mention that lines with multiple comment delimiters can sometimes be
indented differently, depending on the number of comment delimiters. That has
always been the case in Emacs (;;; vs ;; vs ; - indented differently by TAB or
C-M-q etc.). Previously, there was no relation between `comment-region' and
indenting, AFAIK. And there is still no documented relation, that I can find.

Finally, the doc string for `comment-region' still says exactly what it said for
Emacs 22. And it says that it comments (or uncomments) "each line" in the
region. Not just some text in the line, starting after some whitespace, but the
(whole) line. And it says nothing about indenting the commented line.

And it says, "By default, comments start at the left margin". Admittedly, that
is vague and could be interpreted to mean different things. But there is
definitely no mention that `comment-region' indents lines that it comments, that
is, that it produces an indented comment.






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  7:01         ` Drew Adams
@ 2009-05-25 13:27           ` Chong Yidong
  2009-05-25 17:42             ` Drew Adams
  2009-05-25 13:38           ` Stefan Monnier
  1 sibling, 1 reply; 23+ messages in thread
From: Chong Yidong @ 2009-05-25 13:27 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Dan Nicolaescu', 3370, rms

"Drew Adams" <drew.adams@oracle.com> writes:

> Why would everything else be equal? What's wrong with considering what
> Emacs has always done, and perhaps even thinking about breaking
> existing code (such as what I reported)? Everything else is not equal.

Obviously.  But if changing the default provides significantly better
behavior, there is case for doing it anyway.  My point is that this
default is indeed better.

>> I think `indent' is a better comment style.  For instance, all the
>> Emacs sources use that style.
>
> If you are referring to ;; always being indented instead of starting a
> line (which is not what I reported about), then no, there are plenty
> of source code lines that start with ;; - in file headers, for
> instance.

The overwhelming majority of commented lines are indented, including
file headers, which are indented to top-level (column 0).





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  7:02         ` Drew Adams
@ 2009-05-25 13:30           ` Chong Yidong
  2009-05-25 13:39           ` Stefan Monnier
  1 sibling, 0 replies; 23+ messages in thread
From: Chong Yidong @ 2009-05-25 13:30 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Dan Nicolaescu', 3370, rms

"Drew Adams" <drew.adams@oracle.com> writes:

> Finally, the doc string for `comment-region' still says exactly what
> it said for Emacs 22.

I will fix this.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  7:01         ` Drew Adams
  2009-05-25 13:27           ` Chong Yidong
@ 2009-05-25 13:38           ` Stefan Monnier
  2009-05-25 17:42             ` Drew Adams
  1 sibling, 1 reply; 23+ messages in thread
From: Stefan Monnier @ 2009-05-25 13:38 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Dan Nicolaescu', 'Chong Yidong', rms, 3370

> Why would everything else be equal? What's wrong with considering what
> Emacs has always done, and perhaps even thinking about breaking
> existing code (such as what I reported)? Everything else is not equal.

Emacs put the comment-starters at column-0 because that code was written
a looooonnng time ago and keeping things simple was more important
than now.  Emacs-21's new commenting code was improved to be able to
comment and uncomment at other columns than column-0, which made it more
useful since most commenting styles use other indentation styles.
Emacs-21's default (as well as 22) was set to `plain' because Richard
always puts such comments at column-0 (the `plain' setting had actually
to be added specifically for this).

If you don't like it, just (setq comment-style 'plain) and live happily
ever after.


        Stefan





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25  7:02         ` Drew Adams
  2009-05-25 13:30           ` Chong Yidong
@ 2009-05-25 13:39           ` Stefan Monnier
  1 sibling, 0 replies; 23+ messages in thread
From: Stefan Monnier @ 2009-05-25 13:39 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Chong Yidong', 'Dan Nicolaescu', 3370, rms

> C-M-q etc.). Previously, there was no relation between
> `comment-region' and indenting, AFAIK. And there is still no
> documented relation, that I can find.

And indeed, there isn't.  The new style just preserves the indentation
that's present when you call comment-region.  It doesn't use the
indentation code.


        Stefan





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately
  2009-05-24 22:31 Drew Adams
@ 2009-05-25 13:41 ` Stefan Monnier
  0 siblings, 0 replies; 23+ messages in thread
From: Stefan Monnier @ 2009-05-25 13:41 UTC (permalink / raw)
  To: Drew Adams; +Cc: 3370

The comment-syle was changed to `indent' because experience shows it to
be closer to the style used by most people.  But yes, thanks for
pointing out the fact that it was poorly mentioned in NEWS.


        Stefan





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25 13:38           ` Stefan Monnier
@ 2009-05-25 17:42             ` Drew Adams
  2009-05-25 21:22               ` Stefan Monnier
  0 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2009-05-25 17:42 UTC (permalink / raw)
  To: 'Stefan Monnier'
  Cc: 'Dan Nicolaescu', 'Chong Yidong', rms, 3370

> Emacs put the comment-starters at column-0 because that code 
> was written a looooonnng time ago and keeping things simple
> was more important than now.

Emacs Lisp files still use ;; in column 0 in file headers, AFAICT. What column
would you prefer to indent them to?

That is exactly the use case here: commenting a line that will be in a file
header. There is nothing in the surrounding code that would indicate an
indentation level (other than 0 indent).

> Emacs-21's new commenting code was improved to be able to
> comment and uncomment at other columns than column-0, 

I have no problem with that.

> which made it more useful since most commenting styles use
> other indentation styles.

No idea what that means. Please define "commenting style" and "indentation
style" or otherwise explain what you're trying to say here.

> Emacs-21's default (as well as 22) was set to `plain' because Richard
> always puts such comments at column-0 (the `plain' setting 
> had actually to be added specifically for this).

Well I don't always put "such comments" (depending on what you mean by that) at
column 0. I put `;;' comments where Emacs has always put them: at the same level
of indentation that TAB puts code.

This is about commenting out a region, however, not about inserting a comment at
the current indentation level. Commenting out this line:

  `abcdef'

gives this, prior to Emacs 23:

;;   `abcdef'

Commenting out the line is different from inserting a comment at the same level:

  ;;
  `abcdef'

> If you don't like it, just (setq comment-style 'plain) and 
> live happily ever after.

Done (just let-bound in the pertinent code context). That's all I needed.

I would prefer, however, to _understand_, by getting some information about
`comment-style', `comment-styles', etc. Please document `comment-style' and the
rest of what might be missing. Please document this change in NEWS also.

Thx.







^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25 13:27           ` Chong Yidong
@ 2009-05-25 17:42             ` Drew Adams
  0 siblings, 0 replies; 23+ messages in thread
From: Drew Adams @ 2009-05-25 17:42 UTC (permalink / raw)
  To: 'Chong Yidong'; +Cc: 'Dan Nicolaescu', 3370, rms

> > Why would everything else be equal? What's wrong with 
> > considering what Emacs has always done, and perhaps even
> > thinking about breaking existing code (such as what I
> > reported)? Everything else is not equal.
> 
> Obviously.  But if changing the default provides significantly better
> behavior, there is case for doing it anyway.  My point is that this
> default is indeed better.

Are you aware that you provide no reasons for your assertion that it "is indeed
better"? Better how? Why? For whom? In what contexts?

> >> I think `indent' is a better comment style. For instance, all the
> >> Emacs sources use that style.
> >
> > If you are referring to ;; always being indented instead of 
> > starting a line (which is not what I reported about), then no,
> > there are plenty of source code lines that start with ;; -
> > in file headers, for instance.
> 
> The overwhelming majority of commented lines are indented, including
> file headers, which are indented to top-level (column 0).

Indented to column 0? Are you just trying to win an argument? Sure, then
everything in the universe is indented. If you count no-op indentation as
indentation, then the third policeman going up the middle elevator is indented.

So far, you have provided zero content for this thread, AFAICT.

And we still have no definition of "comment style" or `comment-style'...






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25 17:42             ` Drew Adams
@ 2009-05-25 21:22               ` Stefan Monnier
  2009-05-25 21:56                 ` Drew Adams
  2009-05-25 22:46                 ` Jason Rumney
  0 siblings, 2 replies; 23+ messages in thread
From: Stefan Monnier @ 2009-05-25 21:22 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Dan Nicolaescu', 'Chong Yidong', rms, 3370

>> Emacs put the comment-starters at column-0 because that code 
>> was written a looooonnng time ago and keeping things simple
>> was more important than now.
> Emacs Lisp files still use ;; in column 0 in file headers,
> AFAICT.  What column would you prefer to indent them to?

If you use comment-region in such places, the result should also be at
column-0, AFAIK.

> That is exactly the use case here: commenting a line that will be in a file
> header. There is nothing in the surrounding code that would indicate an
> indentation level (other than 0 indent).

Then I misunderstood your use case.  Please give a recipe.  Normally,
code at top-level should have some part of it in column-0, so the
resulting commented-out version should also be placed at column-0.

>> Emacs-21's default (as well as 22) was set to `plain' because Richard
>> always puts such comments at column-0 (the `plain' setting 
>> had actually to be added specifically for this).

> Well I don't always put "such comments" (depending on what you mean by
> that) at column 0.  I put `;;' comments where Emacs has always put
> them: at the same level of indentation that TAB puts code.

Good.

> This is about commenting out a region, however, not about inserting
> a comment at the current indentation level.

Yes, I know that.

> Commenting out this line:
>   `abcdef'
> gives this, prior to Emacs 23:
> ;;   `abcdef'
> Commenting out the line is different from inserting a comment at the
> same level:
>   ;;
>   `abcdef'

I know.  Yet, most cases of commented-out code would use

    ;; `abcdef'

Obviously, you don't like it, just like Richard doesn't like it.  I do
believe you're in the minority, tho.


        Stefan





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25 21:22               ` Stefan Monnier
@ 2009-05-25 21:56                 ` Drew Adams
  2009-05-25 22:46                 ` Jason Rumney
  1 sibling, 0 replies; 23+ messages in thread
From: Drew Adams @ 2009-05-25 21:56 UTC (permalink / raw)
  To: 'Stefan Monnier'
  Cc: 'Dan Nicolaescu', 'Chong Yidong', rms, 3370

> Yes, I know that.
> 
> > Commenting out this line:
> >   `abcdef'
> > gives this, prior to Emacs 23:
> > ;;   `abcdef'
> > Commenting out the line is different from inserting a comment at the
> > same level:
> >   ;;
> >   `abcdef'
> 
> I know.  Yet, most cases of commented-out code would use
> 
>     ;; `abcdef'

No, that was not an example of commenting-out code. It was an example of
inserting a comment - as I said.

> Obviously, you don't like it, just like Richard doesn't like it.  I do
> believe you're in the minority, tho.

No, you're mistaken. I don't really care one way or the other about it.

The information that was missing (and is still missing) is about `comment-style'
and `comment-styles'. You gave me a solution for the code I have, but still no
explanation of `comment-style'. There is still no doc for it.

I don't need to use a different value of `comment-style' for my own use
interactively - I don't really care whether the commented lines are indented or
not. (At least I don't have a preference at the moment.) My question was about
use of `comment-region' in code, not interactively. See the original bug
report's use case.

The real bug I guess is that there is no explanation of `comment-style'.
Whenever things like this change, there is the potential (almost the certainty)
that existing code will break, as it did in my case. My real need, I came to
realize here, is not that `comment-region' act, by default, as it did before,
but that I know how to fix the broken code due to its behavior change. The
answer was to bind `comment-style', as you suggested.

But there is no explanation, hence no understanding, of that answer - no doc for
`comment-style'. And, as I said, the doc string for `comment-style' (which is
pretty much useless) refers to `comment-styles', which is not recognized (and
therefore has no link).







^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25 21:22               ` Stefan Monnier
  2009-05-25 21:56                 ` Drew Adams
@ 2009-05-25 22:46                 ` Jason Rumney
  2009-05-26  1:16                   ` Stefan Monnier
  1 sibling, 1 reply; 23+ messages in thread
From: Jason Rumney @ 2009-05-25 22:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 3370

Stefan Monnier wrote:
> Obviously, you don't like it, just like Richard doesn't like it.  I do
> believe you're in the minority, tho.
>   

I don't think we can say that without polling the users. FWIW, I prefer 
commented out code (as opposed to standard comments) to have plain 
style, and 99% of my use of comment-region would be to comment code. For 
the other 1%, there is indent-region.








^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-25 22:46                 ` Jason Rumney
@ 2009-05-26  1:16                   ` Stefan Monnier
  2012-02-22  2:46                     ` Glenn Morris
  0 siblings, 1 reply; 23+ messages in thread
From: Stefan Monnier @ 2009-05-26  1:16 UTC (permalink / raw)
  To: Jason Rumney; +Cc: 3370

>> Obviously, you don't like it, just like Richard doesn't like it.  I do
>> believe you're in the minority, tho.
> I don't think we can say that without polling the users.

It's based on examination of code rather than querying users.


        Stefan





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#3370: 23.0.94; `comment-region' indents comment chars  inappropriately
  2009-05-26  1:16                   ` Stefan Monnier
@ 2012-02-22  2:46                     ` Glenn Morris
  0 siblings, 0 replies; 23+ messages in thread
From: Glenn Morris @ 2012-02-22  2:46 UTC (permalink / raw)
  To: 3370-done


It was explained that this can be customized with comment-style.
The default isn't going to change.





^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2012-02-22  2:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-24 23:31 bug#3370: 23.0.94; `comment-region' indents comment chars inappropriately Chong Yidong
2009-05-24 23:57 ` Drew Adams
2009-05-25  0:04 ` Lennart Borgman
2009-05-25  0:54   ` Chong Yidong
2009-05-25  1:28     ` Jason Rumney
2009-05-25  2:09       ` Drew Adams
2009-05-25  4:47       ` Chong Yidong
2009-05-25  7:01         ` Drew Adams
2009-05-25 13:27           ` Chong Yidong
2009-05-25 17:42             ` Drew Adams
2009-05-25 13:38           ` Stefan Monnier
2009-05-25 17:42             ` Drew Adams
2009-05-25 21:22               ` Stefan Monnier
2009-05-25 21:56                 ` Drew Adams
2009-05-25 22:46                 ` Jason Rumney
2009-05-26  1:16                   ` Stefan Monnier
2012-02-22  2:46                     ` Glenn Morris
2009-05-25  5:26       ` Dan Nicolaescu
2009-05-25  7:02         ` Drew Adams
2009-05-25 13:30           ` Chong Yidong
2009-05-25 13:39           ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2009-05-24 22:31 Drew Adams
2009-05-25 13:41 ` Stefan Monnier

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).