* bad comment indentation in Emacs Lisp
@ 2008-02-05 23:10 Drew Adams
2008-02-10 18:42 ` Richard Stallman
0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2008-02-05 23:10 UTC (permalink / raw)
To: emacs-pretest-bug
Put this in Emacs Lisp mode and use `C-M-q' at the beginning:
(let (;; foobar
;; toto
(titi...)))
You get this:
(let ( ;; foobar
;; toto
(titi...)))
However, if you just use TAB on each line, you don't get that.
To me, this is a bug. `;;' comments should be aligned just as
TAB would align them, always. `C-M-q' should be equivalent to
using both TAB and `M-;' on each line of the sexp.
Also, in a situation like the preceding, it is likely that you
want the two comments to line up.
In GNU Emacs 22.1.90.1 (i386-mingw-nt5.1.2600)
of 2008-01-30 on PRETEST
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: bad comment indentation in Emacs Lisp
2008-02-05 23:10 bad comment indentation in Emacs Lisp Drew Adams
@ 2008-02-10 18:42 ` Richard Stallman
2008-02-10 19:42 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2008-02-10 18:42 UTC (permalink / raw)
To: monnier; +Cc: emacs-pretest-bug
The principle he cites is correct -- could you please fix this
and ack?
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-pretest-bug@gnu.org>
Date: Tue, 5 Feb 2008 15:10:03 -0800
Message-ID: <009c01c8684c$3dcb3570$0059908d@us.oracle.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Thread-Index: AchoTDzauRqyzk14QqyPCDFIFcnvcQ==
Cc:
Subject: bad comment indentation in Emacs Lisp
Put this in Emacs Lisp mode and use `C-M-q' at the beginning:
(let (;; foobar
;; toto
(titi...)))
You get this:
(let ( ;; foobar
;; toto
(titi...)))
However, if you just use TAB on each line, you don't get that.
To me, this is a bug. `;;' comments should be aligned just as
TAB would align them, always. `C-M-q' should be equivalent to
using both TAB and `M-;' on each line of the sexp.
Also, in a situation like the preceding, it is likely that you
want the two comments to line up.
In GNU Emacs 22.1.90.1 (i386-mingw-nt5.1.2600)
of 2008-01-30 on PRETEST
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: bad comment indentation in Emacs Lisp
2008-02-10 18:42 ` Richard Stallman
@ 2008-02-10 19:42 ` Stefan Monnier
2008-02-10 22:38 ` Drew Adams
2008-02-11 13:34 ` Richard Stallman
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2008-02-10 19:42 UTC (permalink / raw)
To: rms; +Cc: emacs-pretest-bug
> The principle he cites is correct -- could you please fix this
> and ack?
I don't see in what way the behavior doesn't follow the principle proposed.
> Put this in Emacs Lisp mode and use `C-M-q' at the beginning:
> (let (;; foobar
> ;; toto
> (titi...)))
> You get this:
> (let ( ;; foobar
> ;; toto
> (titi...)))
> However, if you just use TAB on each line, you don't get that.
Right, because indent-region does both TAB and M-; on each line (more
or less).
> To me, this is a bug. `;;' comments should be aligned just as
> TAB would align them, always.
TAB generally doesn't touch the comments unless the line itself starts
with a comment.
> `C-M-q' should be equivalent to using both TAB and `M-;' on each line
> of the sexp.
That's indeed what it does.
> Also, in a situation like the preceding, it is likely that you
> want the two comments to line up.
It's possible, but not sure. Use a single ";" to get comments aligned.
And use ";;" but put each comment-line on its own line. This way,
there won't be any ambiguity and they'll be aligned.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: bad comment indentation in Emacs Lisp
2008-02-10 19:42 ` Stefan Monnier
@ 2008-02-10 22:38 ` Drew Adams
2008-02-10 23:09 ` Stefan Monnier
2008-02-11 13:34 ` Richard Stallman
1 sibling, 1 reply; 10+ messages in thread
From: Drew Adams @ 2008-02-10 22:38 UTC (permalink / raw)
To: 'Stefan Monnier', rms; +Cc: emacs-pretest-bug
> > The principle he cites is correct -- could you please fix this
> > and ack?
>
> I don't see in what way the behavior doesn't follow the
> principle proposed.
>
> > Put this in Emacs Lisp mode and use `C-M-q' at the beginning:
> > (let (;; foobar
> > ;; toto
> > (titi...)))
> >
> > You get this:
> > (let ( ;; foobar
> > ;; toto
> > (titi...)))
> >
> > However, if you just use TAB on each line, you don't get that.
>
> Right, because indent-region does both TAB and M-; on each line (more
> or less).
No. Neither `M-;' nor TAB moves `;;' comments, except that TAB can move a
line that *starts* with `;;'. That is not the case for the `;;' comment that
is moved here.
> > To me, this is a bug. `;;' comments should be aligned just as
> > TAB would align them, always.
>
> TAB generally doesn't touch the comments unless the line itself starts
> with a comment.
Precisely. But `C-M-q' *does* now move a comment that does not start a line.
TAB still (thankfully) does not (relative to the rest of its line). `C-M-q'
should not do what neither TAB nor `M-;' does.
> > `C-M-q' should be equivalent to using both TAB and `M-;' on
> > each line of the sexp.
>
> That's indeed what it does.
Not at all. See above. Neither TAB nor `M-;' moves the first comment of the
example.
Go line by line, and do both TAB and `M-;' on each line, and you will see
that the first comment does not move. But `C-M-q' now moves it. This is a
regression: As you have agreed, `C-M-q' should do only what TAB plus `M-;'
does.
> > Also, in a situation like the preceding, it is likely that you
> > want the two comments to line up.
>
> It's possible, but not sure. Use a single ";" to get
> comments aligned.
Why? Why should someone need to replace `;;' by `;'? Why should code that
has always used `;;' to resist in-line movement now be indented differently?
Users have always used `;;' that is not at the start of a line to make a
comment stay put - unlike what `;' does wrt `M-;'. That's precisely why
`M-;' was designed not to move `;;'. Inline `;;' has always let you align
(position) comments manually.
`C-M-q', like TAB, should leave `;;' comments alone, unless they start a
line.
> And use ";;" but put each comment-line on its own line.
Why? Why should someone now need to move `;;' comments to their own line,
just so `C-M-q' won't move them?
And note that this new behavior does not even indent the same as either (1)
`;' or (2) `;;' on a line by itself. This is some entirely new indentation:
(presumably) add a space before `;;'.
> This way, there won't be any ambiguity and they'll be aligned.
What ambiguity? There is no ambiguity. The `C-M-q' code has simply been
broken. It has previously always been equivalent to TAB + `M-;' on each
line. What problem is the new behavior intended to solve?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: bad comment indentation in Emacs Lisp
2008-02-10 22:38 ` Drew Adams
@ 2008-02-10 23:09 ` Stefan Monnier
2008-02-11 1:29 ` Drew Adams
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2008-02-10 23:09 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-pretest-bug, rms
>> > (let (;; foobar
>> > ;; toto
>> > (titi...)))
>> >
>> > You get this:
>> > (let ( ;; foobar
>> > ;; toto
>> > (titi...)))
>> >
>> > However, if you just use TAB on each line, you don't get that.
>>
>> Right, because indent-region does both TAB and M-; on each line (more
>> or less).
> No. Neither `M-;' nor TAB moves `;;' comments, except that TAB can move a
> line that *starts* with `;;'. That is not the case for the `;;' comment that
> is moved here.
Huh? Where do you get this idea? Have you tried M-; on the `let' line?
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: bad comment indentation in Emacs Lisp
2008-02-10 23:09 ` Stefan Monnier
@ 2008-02-11 1:29 ` Drew Adams
2008-02-11 2:22 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2008-02-11 1:29 UTC (permalink / raw)
To: 'Stefan Monnier'; +Cc: emacs-pretest-bug, rms
> >> > (let (;; foobar
> >> > ;; toto
> >> > (titi...)))
> >> >
> >> > You get this:
> >> > (let ( ;; foobar
> >> > ;; toto
> >> > (titi...)))
> >> >
> >> > However, if you just use TAB on each line, you don't get that.
> >>
> >> Right, because indent-region does both TAB and M-; on each
> >> line (more or less).
>
> > No. Neither `M-;' nor TAB moves `;;' comments, except that
> > TAB can move a line that *starts* with `;;'. That is not the
> > case for the `;;' comment that is moved here.
>
> Huh? Where do you get this idea? Have you tried M-; on the
> `let' line?
Hm. I stand corrected.
In Emacs 20 it behaves as I described (both for `M-;' and `C-M-q'). I
thought this was broken in Emacs 22, but it seems it was broken in Emacs 21.
;-)
I never used Emacs 21 (a giant regression compared with Emacs 20, at least
on Windows), and I didn't bother to test it for this - mea culpa.
What is the rationale for this kind of comment indentation? It certainly
doesn't indent the same as `;' or the same as `;;' at the beginning of a
line. Why insert a single space here - what's the rationale? Why move `;;'
ever, relative to the rest of its line?
Anyway, guess it's too late to complain now...
So please consider this a feature request. Please DTRT by not inserting a
space - never move `;;' (except for line indentation, when it starts a
line).
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: bad comment indentation in Emacs Lisp
2008-02-11 1:29 ` Drew Adams
@ 2008-02-11 2:22 ` Stefan Monnier
2008-02-11 2:29 ` Drew Adams
2008-02-11 2:41 ` Miles Bader
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2008-02-11 2:22 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-pretest-bug, rms
> What is the rationale for this kind of comment indentation? It certainly
> doesn't indent the same as `;' or the same as `;;' at the beginning of a
> line. Why insert a single space here - what's the rationale? Why move `;;'
> ever, relative to the rest of its line?
The space is there for aesthetic reasons as well as to make sure the
code and the comment are separate (makes a difference if the code ends
in \ for instance).
Why move it? Why not?
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: bad comment indentation in Emacs Lisp
2008-02-11 2:22 ` Stefan Monnier
@ 2008-02-11 2:29 ` Drew Adams
2008-02-11 2:41 ` Miles Bader
1 sibling, 0 replies; 10+ messages in thread
From: Drew Adams @ 2008-02-11 2:29 UTC (permalink / raw)
To: 'Stefan Monnier'; +Cc: emacs-pretest-bug, rms
> > What is the rationale for this kind of comment indentation?
> > It certainly doesn't indent the same as `;' or the same as
> > `;;' at the beginning of a line. Why insert a single space
> > here - what's the rationale? Why move `;;'
> > ever, relative to the rest of its line?
>
> The space is there for aesthetic reasons
Bof !
> as well as to make sure the code and the comment are separate
> (makes a difference if the code ends in \ for instance).
That would mean bugged code, that's all. Same as if you forget a space in
lots of other contexts. Same as if you type `?' or `"' or `x' instead of
`;'.
> Why move it? Why not?
Not moving it means programmers can put `;;' comments where they want them
(e.g. aligning) and have them stay put.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: bad comment indentation in Emacs Lisp
2008-02-11 2:22 ` Stefan Monnier
2008-02-11 2:29 ` Drew Adams
@ 2008-02-11 2:41 ` Miles Bader
1 sibling, 0 replies; 10+ messages in thread
From: Miles Bader @ 2008-02-11 2:41 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-pretest-bug, rms, Drew Adams
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> What is the rationale for this kind of comment indentation? It certainly
>> doesn't indent the same as `;' or the same as `;;' at the beginning of a
>> line. Why insert a single space here - what's the rationale? Why move `;;'
>> ever, relative to the rest of its line?
>
> The space is there for aesthetic reasons as well as to make sure the
> code and the comment are separate (makes a difference if the code ends
> in \ for instance).
I guess the proper place of ";;" when not at line-start is somewhat
ill-defined, but I generally agree with Drew -- the space is ugly, and
feels like an unwanted intrusion by the indenter.
-Miles
--
Quack, n. A murderer without a license.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: bad comment indentation in Emacs Lisp
2008-02-10 19:42 ` Stefan Monnier
2008-02-10 22:38 ` Drew Adams
@ 2008-02-11 13:34 ` Richard Stallman
1 sibling, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2008-02-11 13:34 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-pretest-bug
> (let ( ;; foobar
> ;; toto
> (titi...)))
> However, if you just use TAB on each line, you don't get that.
Right, because indent-region does both TAB and M-; on each line (more
or less).
You're right. Sorry.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-02-11 13:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05 23:10 bad comment indentation in Emacs Lisp Drew Adams
2008-02-10 18:42 ` Richard Stallman
2008-02-10 19:42 ` Stefan Monnier
2008-02-10 22:38 ` Drew Adams
2008-02-10 23:09 ` Stefan Monnier
2008-02-11 1:29 ` Drew Adams
2008-02-11 2:22 ` Stefan Monnier
2008-02-11 2:29 ` Drew Adams
2008-02-11 2:41 ` Miles Bader
2008-02-11 13:34 ` Richard Stallman
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).