Editor test suite ships in tst/ (from dev 4e8c3db2882d)
This commit is contained in:
30
tst/editor/editor_driver.el
Normal file
30
tst/editor/editor_driver.el
Normal file
@@ -0,0 +1,30 @@
|
||||
;;; editor_driver.el --- drive the Emacs editor units over fixtures -*- lexical-binding: t; -*-
|
||||
|
||||
;; Usage:
|
||||
;; emacs --batch -L EMACSDIR -l klammertext-mode -l klammertext-indent
|
||||
;; -l klammertext-align -l editor_driver.el MODE INFILE OUTFILE ...
|
||||
;;
|
||||
;; MODE is "indent" or "align"; each triple applies that tool to INFILE and
|
||||
;; writes the result to OUTFILE. Called by editor_test.sh.
|
||||
|
||||
(let ((args command-line-args-left))
|
||||
(setq command-line-args-left nil) ; keep batch Emacs from visiting them
|
||||
(while args
|
||||
(let ((mode (pop args))
|
||||
(in (pop args))
|
||||
(out (pop args)))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents in)
|
||||
(klammertext-mode)
|
||||
(cond
|
||||
((string= mode "indent")
|
||||
(indent-region (point-min) (point-max)))
|
||||
((string= mode "align")
|
||||
(goto-char (point-min))
|
||||
(when (search-forward "|" nil t)
|
||||
(goto-char (1- (point))))
|
||||
(klammertext-align-table))
|
||||
(t (error "editor_driver.el: unknown mode %s" mode)))
|
||||
(write-region (point-min) (point-max) out nil 'silent)))))
|
||||
|
||||
;;; editor_driver.el ends here
|
||||
Reference in New Issue
Block a user