[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6806: another reason for the patch
From: |
Tom Tromey |
Subject: |
bug#6806: another reason for the patch |
Date: |
Tue, 17 Jan 2017 21:56:18 -0700 |
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
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#6806: another reason for the patch,
Tom Tromey <=