[Top][All Lists]

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

bug#6806: Set comment-multi-line in js-mode

From: Chong Yidong
Subject: bug#6806: Set comment-multi-line in js-mode
Date: Tue, 28 Sep 2010 14:11:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> 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

  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

      (string-match (regexp-quote (comment-string-strip
                                   comment-start t t))
      (if normalp comment-end
        ;; The comment starter is not the normal comment-start
        ;; so we can't just use comment-end.
          (goto-char compos)
          (if (not (comment-forward)) comment-end
              (save-excursion (comment-enter-backward) (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?

reply via email to

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