new commands: include, case and fail; new emacs wt-mode for webtester files

This commit is contained in:
Marc Wäckerlin
2016-06-08 09:07:48 +00:00
parent 02aaf6e3ec
commit 52087c3906
8 changed files with 344 additions and 20 deletions

9
scripts/90wt-mode.wt Normal file
View File

@@ -0,0 +1,9 @@
;; -*-emacs-lisp-*-
;;
;; Emacs startup file for the Debian GNU/Linux wt-mode package
;;
;; Set up to autoload
(autoload 'wt-mode "wt-mode" "Major mode for editing Webtester test scripts" t)
(setq auto-mode-alist
(cons '("\\.wt\\'" . wt-mode) auto-mode-alist))

View File

@@ -8,5 +8,11 @@
dist_bin_SCRIPTS = doxygen-webtester.sed
emacsdir = ${datadir}/emacs/site-lisp
dist_emacs_SCRIPTS = wt-mode.el
emacsconfdir = ${sysconfdir}/emacs/site-start.d
dist_emacsconf = 90wt-mode.el
MAINTAINERCLEANFILES = makefile.in

48
scripts/wt-mode.el Normal file
View File

@@ -0,0 +1,48 @@
;; Define an Emacs Mode for Webtester
;;
;; Features:
;; - indentation support
;; - syntax highlighting
;;
;; Documentations:
;; - mode tutorial:
;; https://www.emacswiki.org/emacs/ModeTutorial
;; - faces for font lock:
;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html
(defvar wt-mode-hook nil)
(defvar wt-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-j" 'newline-and-indent)
map)
"Newline and indent")
(add-to-list 'auto-mode-alist '("\\.wt\\'" . wt-mode))
;; get all keywords:
;; echo $(webrunner -h | sed -n 's, COMMAND: ,,p') | sed 's, ,\\\\|,g'
(defconst wt-font-lock-keywords
(list
'("^ *\\(ca-certificate\\|call\\|case\\|check\\|clear-cookies\\|click\\|clicktype\\|client-certificate\\|do\\|download\\|echo\\|execute\\|exists\\|exit\\|expect\\|fail\\|for\\|function\\|if\\|ignoreto\\|include\\|label\\|load\\|not\\|offline-storage-path\\|open\\|screenshot\\|set\\|setvalue\\|sleep\\|testcase\\|testsuite\\|timeout\\|unset\\|upload\\)" . font-lock-builtin-face)
'("^ *#.*$" . font-lock-comment-face))
"Highlighting expressions for Webtester")
(defvar wt-mode-syntax-table
(let ((st (make-syntax-table)))
st)
"Syntax table for wt-mode")
(defun wt-mode ()
"Major mode for editing Webtester test scripts"
(interactive)
(kill-all-local-variables)
(set-syntax-table wt-mode-syntax-table)
(use-local-map wt-mode-map)
(set (make-local-variable 'font-lock-defaults) '(wt-font-lock-keywords))
(setq major-mode 'wt-mode)
(setq mode-name "Webtester")
(run-hooks 'wpdl-mode-hook))
(provide 'wt-mode)