more keywords, the tla+-open-dvi function

this commit adds a few more keywords that should be highligted and
adds a new function to open the dvi file.
This commit is contained in:
Christian Barthel 2019-12-22 22:36:00 +01:00
parent 2e6a2c6a09
commit 84d7eafeea

View File

@ -71,7 +71,7 @@
:help "Typeset TLaTex and create PS Document")) :help "Typeset TLaTex and create PS Document"))
(bindings--define-key export-map [export-open] (bindings--define-key export-map [export-open]
'(menu-item "Open DVI Viewer" tla+-run-tlatex-ps '(menu-item "Open DVI Viewer" tla+-open-dvi
:help "Open DVI Viewer")) :help "Open DVI Viewer"))
;; Main Menu ;; Main Menu
@ -93,7 +93,8 @@
(defconst tla+-font-lock-keywords (defconst tla+-font-lock-keywords
(list (list
'("\\<\\(MODULE\\|VARIABLE\\|EXTENDS\\)\\>" . font-lock-builtin-face) '("\\<\\(MODULE\\|CONSTANT\\|UNCHANGED\\|VARIABLE\\|THEOREM\\|EXCEPT\\|EXTENDS\\)\\>"
. font-lock-builtin-face)
'("\\\\\\*.*$" . font-lock-comment-face) '("\\\\\\*.*$" . font-lock-comment-face)
'("(\\*.*\\*)" . font-lock-comment-face) '("(\\*.*\\*)" . font-lock-comment-face)
'("\\('\\w*'\\)" . font-lock-variable-name-face) '("\\('\\w*'\\)" . font-lock-variable-name-face)
@ -143,8 +144,17 @@ Turning on Text mode runs the normal hook `text-mode-hook'."
(split-window-below) (split-window-below)
(other-window 1) (other-window 1)
(switch-to-buffer sanybuffer) (switch-to-buffer sanybuffer)
(erase-buffer)
(insert output)))) (insert output))))
(defun tla+-open-dvi (buffername)
(interactive "b")
(save-excursion
(switch-to-buffer buffername)
(let* ((filename (buffer-file-name))
(dviname (replace-regexp-in-string ".tla$" ".dvi" filename)))
(shell-command (concat "xdvi " dviname " &")))))
(defun tla+-run-tlatex (type) (defun tla+-run-tlatex (type)
"TODO: jump to line.." "TODO: jump to line.."
(interactive (interactive
@ -159,15 +169,15 @@ Turning on Text mode runs the normal hook `text-mode-hook'."
tla+-tlatools-path tla+-tlatools-path
" tla2tex.TLA " " tla2tex.TLA "
filename)))) filename))))
(message (concat type)))) type))
;; (save-excursion ;; (save-excursion
;; (split-window-below) ;; (split-window-below)
;; (other-window 1) ;; (other-window 1)
;; (switch-to-buffer sanybuffer) ;; (switch-to-buffer sanybuffer)
;; (insert output)))) ;; (insert output))))
(defun tla+-run-tlatex-pdf () (tla+-run-tlatex "pdf")) (defun tla+-run-tlatex-pdf () (tla+-run-tlatex 'pdf))
(defun tla+-run-tlatex-dvi () (tla+-run-tlatex "dvi")) (defun tla+-run-tlatex-dvi () (tla+-run-tlatex 'dvi))
(defun tla+-run-tlatex-ps () (tla+-run-tlatex "ps")) (defun tla+-run-tlatex-ps () (tla+-run-tlatex 'ps))
(provide 'tla+-mode) (provide 'tla+-mode)