From: Chong Yidong <cyd@stupidchicken.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Nathan Weizenbaum <nweiz@google.com>, 6806@debbugs.gnu.org
Subject: bug#6806: Set comment-multi-line in js-mode
Date: Tue, 28 Sep 2010 14:11:02 -0400 [thread overview]
Message-ID: <8762xpyc09.fsf@stupidchicken.com> (raw)
In-Reply-To: <jwvvd6c1j3u.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 11 Sep 2010 15:54:37 +0200")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> My fix doesn't actually fix the "/* */" issue, unfortunately. However, it
>> doesn't break "//" either; note that comment-multi-line is t for e.g.
>> c-mode, and comment-indent-new-line works for "//" there.
>
> Indeed, I misremembered. Feel free to install this patch.
The patch doesn't do the right thing. The reported problem is that if
you enter "/*" in a js-mode buffer and do M-x comment-indent-new-line,
Emacs inserts another "/*".
This problem is not limited to js-mode. It afflicts C++ also. Try
this:
C-x C-f foo.cc RET
/*
M-x comment-indent-new-line RET
Emacs inserts another /*. The reason is this stretch of code in
newcomment.el:1311:
(normalp
(string-match (regexp-quote (comment-string-strip
comment-start t t))
comstart))
(comment-end
(if normalp comment-end
;; The comment starter is not the normal comment-start
;; so we can't just use comment-end.
(save-excursion
(goto-char compos)
(if (not (comment-forward)) comment-end
(comment-string-strip
(buffer-substring
(save-excursion (comment-enter-backward) (point))
(point))
nil t)))))
When the default comment-start is "//" but the current comment begins in
"/*", this code tries to find the appropriate comment-end by doing
comment-forward. But if the comment-end "*/" is not already present in
the buffer, it fails.
Any suggestion?
next prev parent reply other threads:[~2010-09-28 18:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 18:36 bug#6806: Set comment-multi-line in js-mode Nathan Weizenbaum
2010-08-08 20:40 ` Chong Yidong
2010-08-09 0:14 ` Nathan Weizenbaum
2010-08-09 11:33 ` Stefan Monnier
2010-08-09 17:56 ` Nathan Weizenbaum
2010-09-11 13:54 ` Stefan Monnier
2010-09-28 18:11 ` Chong Yidong [this message]
2017-01-18 4:56 ` bug#6806: another reason for the patch Tom Tromey
2017-02-04 21:21 ` npostavs
2017-02-04 21:34 ` npostavs
2017-02-11 15:19 ` Tom Tromey
2017-02-12 4:21 ` npostavs
2017-02-12 6:16 ` Tom Tromey
2017-02-15 4:50 ` npostavs
2017-02-04 20:29 ` bug#6806: checked in " Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8762xpyc09.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=6806@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=nweiz@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.