all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tom Tromey <tom@tromey.com>
To: 6806@debbugs.gnu.org
Subject: bug#6806: another reason for the patch
Date: Tue, 17 Jan 2017 21:56:18 -0700	[thread overview]
Message-ID: <874m0xhsp9.fsf@tromey.com> (raw)
In-Reply-To: <AANLkTikqhGd0Chywz+X=giddjPJkVVK0Ca81xuoakX67@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

Hi.  I'd like to resurrect this bug.

While working in JS I found a bug, which I tracked down to the same
change indicated here.  Basically, auto-fill in JS mode will sometimes
insert a "/*" on a filled line, where it should not.

You can see a precise recipe in the new test case, in the attached
patch.

One funny thing is that if you do this interactively (in my real-world
case I had auto-fill-mode enabled), you have to be sure that there isn't
a newline after point.  If there is a newline, the filling works
properly.

Anyway, let me know what you think.  I'd like to check this in, but,
given the comments in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6806#23
I suppose I would not close the bug.

Tom


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: the patch --]
[-- Type: text/x-patch, Size: 1538 bytes --]

commit 5a615aeae34a257a1879134a883c61bc42f41691
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Jan 17 21:50:14 2017 -0700

    Set comment-multi-line in js-mode
    
    Bug#6806:
    * lisp/progmodes/js.el (js-mode): Set comment-multi-line to t.
    * test/lisp/progmodes/js-tests.el (js-mode-auto-fill): New test.

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 2e5c6ae..cfd58d2 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3852,6 +3852,7 @@ js-mode
         comment-start-skip "\\(//+\\|/\\*+\\)\\s *")
   (setq-local comment-line-break-function #'c-indent-new-comment-line)
   (setq-local c-block-comment-start-regexp "/\\*")
+  (setq-local comment-multi-line t)
 
   (setq-local electric-indent-chars
 	      (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*".
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index 84749ef..7cb737c 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -85,6 +85,20 @@
       (should (= (current-column) x))
       (forward-line))))
 
+(ert-deftest js-mode-auto-fill ()
+  (with-temp-buffer
+    (js-mode)
+    (setq fill-column 70)
+    (insert "/* ")
+    (dotimes (_ 16)
+      (insert "test "))
+    (do-auto-fill)
+    ;; The bug is that, after auto-fill, the second line starts with
+    ;; "/*", whereas it should start with " * ".
+    (goto-char (point-min))
+    (forward-line)
+    (should (looking-at " \\* test"))))
+
 (provide 'js-tests)
 
 ;;; js-tests.el ends here

  parent reply	other threads:[~2017-01-18  4:56 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
2017-01-18  4:56 ` Tom Tromey [this message]
2017-02-04 21:21   ` bug#6806: another reason for the patch 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=874m0xhsp9.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=6806@debbugs.gnu.org \
    /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.