1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix auto-fill bug in js-mode

* lisp/progmodes/js.el (js-do-auto-fill): New function.
(js-mode): Set normal-auto-fill-function.
* test/lisp/progmodes/js-tests.el (js-mode-fill-comment-bug): New
test.
This commit is contained in:
Tom Tromey 2017-08-27 12:54:01 -06:00
parent 5440b238b1
commit 9e79a31c09
2 changed files with 24 additions and 0 deletions

View file

@ -60,6 +60,25 @@
* Load the inspector's shared head.js for use by tests that need to
* open the something or other"))))
(ert-deftest js-mode-fill-comment-bug ()
(with-temp-buffer
(insert "/**
* javadoc stuff here
*
* what
*/
function f( ) {
// comment-auto-fill-only-comments is a variable defined in newcomment.el. comment comment")
(js-mode)
(setq-local comment-auto-fill-only-comments t)
(setq-local fill-column 75)
(auto-fill-mode 1)
(funcall auto-fill-function)
(beginning-of-line)
;; Filling should have inserted the correct comment start.
(should (equal (buffer-substring (point) (+ 7 (point)))
" // "))))
(ert-deftest js-mode-regexp-syntax ()
(with-temp-buffer
;; Normally indentation tests are done in manual/indent, but in