all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vladimir Panteleev <git@thecybershadow.net>
To: 25541@debbugs.gnu.org
Cc: Vladimir Panteleev <git@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	[thread overview]
Message-ID: <20170126043624.14326-3-git@thecybershadow.net> (raw)
In-Reply-To: <20170126043624.14326-1-git@thecybershadow.net>

* 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






  parent reply	other threads:[~2017-01-26  4:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26  4:36 bug#25541: [PATCH] Some small bat-mode fixes Vladimir Panteleev
2017-01-26  4:36 ` bug#25541: [PATCH 1/3] Improve fontification of variables in bat-mode Vladimir Panteleev
2017-01-26  4:36 ` Vladimir Panteleev [this message]
2017-01-26  4:36 ` bug#25541: [PATCH 3/3] Improve iteration variable fontification " Vladimir Panteleev
2017-01-27  9:57 ` bug#25541: [PATCH] Some small bat-mode fixes Eli Zaretskii
2017-01-27 10:02   ` Vladimir Panteleev
2017-01-27 10:34     ` Eli Zaretskii
2017-02-10  9:30 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170126043624.14326-3-git@thecybershadow.net \
    --to=git@thecybershadow.net \
    --cc=25541@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.