Commit f001e98e authored by Stefan Monnier's avatar Stefan Monnier

* lisp/progmodes/bat-mode.el (bat--syntax-propertize): New var.

(bat-mode): Use it.
(bat-mode-syntax-table): Mark \n as end-of-comment.
(bat-font-lock-keywords): Remove comment rule.
parent 7679edb1
2013-08-07 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/bat-mode.el (bat--syntax-propertize): New var.
(bat-mode): Use it.
(bat-mode-syntax-table): Mark \n as end-of-comment.
(bat-font-lock-keywords): Remove comment rule.
* progmodes/bat-mode.el: Rename from dos.el. Use "bat-" prefix.
(dos-mode-help): Remove. Use describe-mode (C-h m) instead.
......
......@@ -80,8 +80,6 @@
'("bash" "cat" "cp" "fgrep" "grep" "ls" "sed" "sh" "mv" "rm")))
`(("\\<_\\(call\\|goto\\)\\_>[ \t]+%?\\([A-Za-z0-9-_\\:.]+\\)%?"
(2 font-lock-constant-face t))
("^[ \t]*\\(@?rem\\_>\\|::\\).*"
(0 font-lock-comment-face t))
("^:[^:].*"
. 'bat-label-face)
("\\<_\\(defined\\|set\\)\\_>[ \t]*\\(\\w+\\)"
......@@ -121,6 +119,7 @@
(defvar bat-mode-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\n ">" table)
;; Beware: `w' should not be used for non-alphabetic chars.
(modify-syntax-entry ?~ "_" table)
(modify-syntax-entry ?% "." table)
......@@ -132,6 +131,10 @@
(modify-syntax-entry ?\\ "." table)
table))
(defconst bat--syntax-propertize
(syntax-propertize-rules
("^[ \t]*\\(?:\\(@?r\\)em\\_>\\|\\(?1::\\):\\).*" (1 "<"))))
;; 4 User functions
(defun bat-cmd-help (cmd)
......@@ -171,6 +174,7 @@ with `bat-cmd-help'. Navigate between sections using `imenu'.
Run script using `bat-run' and `bat-run-args'.\n
\\{bat-mode-map}"
(setq-local comment-start "rem ")
(setq-local syntax-propertize-function bat--syntax-propertize)
(setq-local font-lock-defaults
'(bat-font-lock-keywords nil t)) ; case-insensitive keywords
(setq-local imenu-generic-expression '((nil "^:[^:].*" 0)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment