emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0a64666: Test comment-multi-line = nil auto fill ca


From: Noam Postavsky
Subject: [Emacs-diffs] master 0a64666: Test comment-multi-line = nil auto fill case too
Date: Tue, 14 Feb 2017 23:45:57 -0500 (EST)

branch: master
commit 0a64666288e3f32967db4ad683a4bc2f225fb952
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Test comment-multi-line = nil auto fill case too
    
    * test/lisp/progmodes/js-tests.el (js-mode-auto-fill): Test with
    `comment-multi-line' both nil and non-nil.
    * lisp/newcomment.el (comment-multi-line): Mark safe if it's a
    boolean.
    * etc/NEWS: Mention that `js-mode' now sets `comment-multi-line'.
---
 etc/NEWS                        |  3 +++
 lisp/newcomment.el              |  1 +
 test/lisp/progmodes/js-tests.el | 22 ++++++++++++----------
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 31b05dd..421e5da 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -624,6 +624,9 @@ initialization files.
 ---
 ** 'auto-revert-use-notify' is set back to t in 'global-auto-revert-mode'.
 
+---
+** JS mode now sets 'comment-multi-line' to t.
+
 ** CSS mode
 
 ---
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 1af8929..4b261c3 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -309,6 +309,7 @@ customize this variable.
 It also affects \\[indent-new-comment-line].  However, if you want this
 behavior for explicit filling, you might as well use \\[newline-and-indent]."
   :type 'boolean
+  :safe #'booleanp
   :group 'comment)
 
 (defcustom comment-empty-lines nil
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index d61f084..99f5898 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -89,16 +89,18 @@ if (!/[ (:,='\"]/.test(value)) {
 (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"))))
+    (let ((fill-column 10)
+          (comment-multi-line t))
+      (insert "/* test test")
+      (do-auto-fill)
+      ;; Filling should continue the multi line comment.
+      (should (equal (buffer-string) "/* test\n * test"))
+      (erase-buffer)
+      (insert "/* test test")
+      (setq comment-multi-line nil)
+      (do-auto-fill)
+      ;; Filling should start a new comment on the next line.
+      (should (equal (buffer-string) "/* test */\n/* test")))))
 
 (ert-deftest js-mode-regexp-syntax-bug-25529 ()
   (dolist (regexp-contents '("[^[]"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]