(fill-paragraph-function #'c-fill-paragraph))
(c-fill-paragraph justify)))
+(defun js-do-auto-fill ()
+ (let ((js--filling-paragraph t))
+ (c-do-auto-fill)))
+
;;; Type database and Imenu
;; We maintain a cache of semantic information, i.e., the classes and
(setq-local comment-start "// ")
(setq-local comment-end "")
(setq-local fill-paragraph-function #'js-c-fill-paragraph)
+ (setq-local normal-auto-fill-function #'js-do-auto-fill)
;; Parse cache
(add-hook 'before-change-functions #'js--flush-caches t t)
* 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