[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 394fc3f 1/2: Set comment-multi-line in js-mode
From: |
Tom Tromey |
Subject: |
[Emacs-diffs] master 394fc3f 1/2: Set comment-multi-line in js-mode |
Date: |
Sat, 4 Feb 2017 20:25:09 +0000 (UTC) |
branch: master
commit 394fc3fd030b8fa2f9b97c2ef3fa3b16e6f29474
Author: Tom Tromey <address@hidden>
Commit: Tom Tromey <address@hidden>
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.
---
lisp/progmodes/js.el | 1 +
test/lisp/progmodes/js-tests.el | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 74dd4ad..e42e014 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."
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 @@ 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