aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Tromey2017-01-17 21:50:14 -0700
committerTom Tromey2017-02-04 13:00:59 -0700
commit394fc3fd030b8fa2f9b97c2ef3fa3b16e6f29474 (patch)
treecdf13a4354bfe73828dfacbd5828d8f5cc411674
parentcaf31fb5f53aef47bea1cd2e741f5d9c254c1a81 (diff)
downloademacs-394fc3fd030b8fa2f9b97c2ef3fa3b16e6f29474.tar.gz
emacs-394fc3fd030b8fa2f9b97c2ef3fa3b16e6f29474.zip
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.
-rw-r--r--lisp/progmodes/js.el1
-rw-r--r--test/lisp/progmodes/js-tests.el14
2 files changed, 15 insertions, 0 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 74dd4add9e2..e42e01481b6 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3849,6 +3849,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
3849 comment-start-skip "\\(//+\\|/\\*+\\)\\s *") 3849 comment-start-skip "\\(//+\\|/\\*+\\)\\s *")
3850 (setq-local comment-line-break-function #'c-indent-new-comment-line) 3850 (setq-local comment-line-break-function #'c-indent-new-comment-line)
3851 (setq-local c-block-comment-start-regexp "/\\*") 3851 (setq-local c-block-comment-start-regexp "/\\*")
3852 (setq-local comment-multi-line t)
3852 3853
3853 (setq-local electric-indent-chars 3854 (setq-local electric-indent-chars
3854 (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". 3855 (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 84749efa45b..7cb737c30e2 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -85,6 +85,20 @@ if (!/[ (:,='\"]/.test(value)) {
85 (should (= (current-column) x)) 85 (should (= (current-column) x))
86 (forward-line)))) 86 (forward-line))))
87 87
88(ert-deftest js-mode-auto-fill ()
89 (with-temp-buffer
90 (js-mode)
91 (setq fill-column 70)
92 (insert "/* ")
93 (dotimes (_ 16)
94 (insert "test "))
95 (do-auto-fill)
96 ;; The bug is that, after auto-fill, the second line starts with
97 ;; "/*", whereas it should start with " * ".
98 (goto-char (point-min))
99 (forward-line)
100 (should (looking-at " \\* test"))))
101
88(provide 'js-tests) 102(provide 'js-tests)
89 103
90;;; js-tests.el ends here 104;;; js-tests.el ends here