]> git.eshelyaron.com Git - emacs.git/commitdiff
Set comment-multi-line in js-mode
authorTom Tromey <tom@tromey.com>
Wed, 18 Jan 2017 04:50:14 +0000 (21:50 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 4 Feb 2017 20:00:59 +0000 (13:00 -0700)
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.

lisp/progmodes/js.el
test/lisp/progmodes/js-tests.el

index 74dd4add9e2732477115c09606e0edf959bc4ddc..e42e01481b634da4fccd2ec130065f468bae8391 100644 (file)
@@ -3849,6 +3849,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
         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 "[]*".
index 84749efa45bb848dfae156b91f00cc3df57f9bf8..7cb737c30e20c6fbb4f68028160ec970dd35cafa 100644 (file)
@@ -85,6 +85,20 @@ if (!/[ (:,='\"]/.test(value)) {
       (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