From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#6806: Set comment-multi-line in js-mode Date: Tue, 28 Sep 2010 14:11:02 -0400 Message-ID: <8762xpyc09.fsf@stupidchicken.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1285699291 25179 80.91.229.12 (28 Sep 2010 18:41:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Sep 2010 18:41:31 +0000 (UTC) Cc: Nathan Weizenbaum , 6806@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 28 20:41:29 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P0f7I-00084o-VC for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Sep 2010 20:41:29 +0200 Original-Received: from localhost ([127.0.0.1]:33309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0f7I-00049K-GP for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Sep 2010 14:41:28 -0400 Original-Received: from [140.186.70.92] (port=58755 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0f7C-00047z-JV for bug-gnu-emacs@gnu.org; Tue, 28 Sep 2010 14:41:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0f7A-0006IA-Jj for bug-gnu-emacs@gnu.org; Tue, 28 Sep 2010 14:41:22 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35237) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0f7A-0006I4-Fn for bug-gnu-emacs@gnu.org; Tue, 28 Sep 2010 14:41:20 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P0ebu-0002Th-9t; Tue, 28 Sep 2010 14:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Sep 2010 18:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6806 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6806-submit@debbugs.gnu.org id=B6806.12856972959504 (code B ref 6806); Tue, 28 Sep 2010 18:09:02 +0000 Original-Received: (at 6806) by debbugs.gnu.org; 28 Sep 2010 18:08:15 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0eb8-0002TF-6k for submit@debbugs.gnu.org; Tue, 28 Sep 2010 14:08:14 -0400 Original-Received: from pantheon-po24.its.yale.edu ([130.132.50.118]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0eb5-0002T7-Sg for 6806@debbugs.gnu.org; Tue, 28 Sep 2010 14:08:13 -0400 Original-Received: from furry (dhcp128036014154.central.yale.edu [128.36.14.154]) (authenticated bits=0) by pantheon-po24.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o8SIB2VO019746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 28 Sep 2010 14:11:02 -0400 Original-Received: by furry (Postfix, from userid 1000) id 76E6FC018; Tue, 28 Sep 2010 14:11:02 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Sat, 11 Sep 2010 15:54:37 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 28 Sep 2010 14:09:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40518 Archived-At: Stefan Monnier 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?