From: Eli Zaretskii Date: Thu, 15 Mar 2018 13:23:01 +0000 (+0200) Subject: Support variable-unquoting syntax in bat-mode X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dca8b75f7489b594c831aa86cda8c196c99c1073;p=emacs.git Support variable-unquoting syntax in bat-mode * lisp/progmodes/bat-mode.el (bat-font-lock-keywords): Fontify argument numbers in %~n. Suggested by Jostein Kjønigsen 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. --- diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el index 2910a7a1043..51acc6a949f 100644 --- a/lisp/progmodes/bat-mode.el +++ b/lisp/progmodes/bat-mode.el @@ -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! diff --git a/test/lisp/progmodes/bat-mode-tests.el b/test/lisp/progmodes/bat-mode-tests.el index 4fa8de10c6b..5b824841d41 100644 --- a/test/lisp/progmodes/bat-mode-tests.el +++ b/test/lisp/progmodes/bat-mode-tests.el @@ -63,10 +63,11 @@ "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") "echo %%a echo %%~dp1 -echo %%~$PATH:I"))) +echo %%~$PATH:I +echo %%~1"))) (defun bat-test-fill-paragraph (str) "Return the result of invoking `fill-paragraph' on STR in a `bat-mode' buffer."