GNU bug report logs - #25541
[PATCH] Some small bat-mode fixes

Previous Next

Package: emacs;

Reported by: Vladimir Panteleev <git <at> thecybershadow.net>

Date: Thu, 26 Jan 2017 05:00:02 UTC

Severity: minor

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Vladimir Panteleev <git <at> thecybershadow.net>
To: 25541 <at> debbugs.gnu.org
Cc: Vladimir Panteleev <git <at> thecybershadow.net>
Subject: bug#25541: [PATCH 2/3] Fix fill-paragraph for comments in bat-mode
Date: Thu, 26 Jan 2017 04:36:23 +0000
* lisp/progmodes/bat-mode.el: Set comment-start-skip.
* test/lisp/progmodes/bat-mode-tests.el: Add test.
---
 lisp/progmodes/bat-mode.el            |  1 +
 test/lisp/progmodes/bat-mode-tests.el | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el
index 77b97ac6ff..a945d37f1d 100644
--- a/lisp/progmodes/bat-mode.el
+++ b/lisp/progmodes/bat-mode.el
@@ -176,6 +176,7 @@ bat-mode
 Run script using `bat-run' and `bat-run-args'.\n
 \\{bat-mode-map}"
   (setq-local comment-start "rem ")
+  (setq-local comment-start-skip "rem[ \t]+")
   (setq-local syntax-propertize-function bat--syntax-propertize)
   (setq-local font-lock-defaults
        '(bat-font-lock-keywords nil t)) ; case-insensitive keywords
diff --git a/test/lisp/progmodes/bat-mode-tests.el b/test/lisp/progmodes/bat-mode-tests.el
index c78827db80..335fc16ffb 100644
--- a/test/lisp/progmodes/bat-mode-tests.el
+++ b/test/lisp/progmodes/bat-mode-tests.el
@@ -59,5 +59,19 @@ bat-test-fontify
     (bat-test-fontify "echo !a_b-c{d}e!")
     "<span class=\"builtin\">echo</span> !<span class=\"variable-name\">a_b-c{d}e</span>!")))
 
+(defun bat-test-fill-paragraph (str)
+  "Return the result of invoking `fill-paragraph' on STR in a `bat-mode' buffer."
+  (with-temp-buffer
+    (bat-mode)
+    (insert str)
+    (goto-char 1)
+    (font-lock-ensure)
+    (fill-paragraph)
+    (buffer-string)))
+
+(ert-deftest bat-test-fill-paragraph-comment ()
+  "Test `fill-paragraph' in a comment block."
+  (should (equal (bat-test-fill-paragraph "rem foo\nrem bar\n") "rem foo bar\n")))
+
 (provide 'bat-tests)
 ;;; bat-mode-tests.el ends here
-- 
2.11.0





This bug report was last modified 8 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.