]> git.eshelyaron.com Git - emacs.git/commitdiff
Support variable-unquoting syntax in bat-mode
authorEli Zaretskii <eliz@gnu.org>
Thu, 15 Mar 2018 13:23:01 +0000 (15:23 +0200)
committerAndrew G Cohen <cohen@andy.bu.edu>
Tue, 11 Dec 2018 06:17:30 +0000 (14:17 +0800)
* lisp/progmodes/bat-mode.el (bat-font-lock-keywords): Fontify
argument numbers in %~n.  Suggested by Jostein Kjønigsen
<jostein@secure.kjonigsen.net> in emacs-devel.

* test/lisp/progmodes/bat-mode-tests.el
(bat-test-fontification-iter-var-1): Update the test to check also
the %~n construct.

lisp/progmodes/bat-mode.el
test/lisp/progmodes/bat-mode-tests.el

index 2910a7a1043ce462cdfeb851538e39c12aa6e77c..51acc6a949f43d8dd091e946ede5c6e7a2dfc2a5 100644 (file)
@@ -84,6 +84,8 @@
          . 'bat-label-face)
         ("\\_<\\(defined\\|set\\)\\_>[ \t]*\\(\\(\\sw\\|\\s_\\)+\\)"
          (2 font-lock-variable-name-face))
+        ("%~\\([0-9]\\)"
+         (1 font-lock-variable-name-face))
         ("%\\([^%~ \n]+\\)%?"
          (1 font-lock-variable-name-face))
         ("!\\([^!%~ \n]+\\)!?"  ; delayed-expansion !variable!
index 4fa8de10c6b99188faf5ab833957d49aea897c88..5b824841d41a7996a554c7dcf59a7b5075544722 100644 (file)
   "Test fontification of iteration variables."
   (should
    (equal
-    (bat-test-fontify "echo %%a\necho %%~dp1\necho %%~$PATH:I")
+    (bat-test-fontify "echo %%a\necho %%~dp1\necho %%~$PATH:I\necho %%~1")
     "<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">a</span>
 <span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</span>
-<span class=\"builtin\">echo</span> %%~$<span class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</span>")))
+<span class=\"builtin\">echo</span> %%~$<span class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</span>
+<span class=\"builtin\">echo</span> %%~<span class=\"variable-name\">1</span>")))
 
 (defun bat-test-fill-paragraph (str)
   "Return the result of invoking `fill-paragraph' on STR in a `bat-mode' buffer."