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.
'("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+\\)"
(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)
(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)
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)))