update log info option, syntax highlighting

- add new Update ChangeLog function
- do not highlight keywords inside comments
- use fundamental-mode as basis
- dump the dot state by default
This commit is contained in:
Christian Barthel 2020-07-18 21:54:02 +02:00
parent a8ebeb008c
commit deba3792c9

View File

@ -420,6 +420,10 @@
"Run SANY2 " "Run SANY2 "
"(syntax checker for TLA+ specifications) ")) "(syntax checker for TLA+ specifications) "))
(bindings--define-key map [menu-bar tla+ tla+-update-note]
'(menu-item "Add Update Comment" tla+-add-update-note
:help "Add Update Note"))
(bindings--define-key map [menu-bar tla+ tla+-create-module] (bindings--define-key map [menu-bar tla+ tla+-create-module]
'(menu-item "Create new Module" tla+-create-module '(menu-item "Create new Module" tla+-create-module
:help "Create a new TLA+ Module")) :help "Create a new TLA+ Module"))
@ -430,19 +434,20 @@
(defconst tla+-font-lock-keywords (defconst tla+-font-lock-keywords
(list (list
'("\\\\\\*.*$" . font-lock-comment-face)
'("(\\*.*\\*)" . font-lock-comment-face)
'("\\<\\(MODULE\\|CONSTANTS?\\|UNCHANGED\\|VARIABLES?\\|THEOREM\\|LOCAL\\|ASSUME\\|LET\\|EXTENDS?\\)\\>" '("\\<\\(MODULE\\|CONSTANTS?\\|UNCHANGED\\|VARIABLES?\\|THEOREM\\|LOCAL\\|ASSUME\\|LET\\|EXTENDS?\\)\\>"
. font-lock-builtin-face) . font-lock-builtin-face)
'("\\<\\(TRUE\\|FALSE\\|OTHER\\|BOOLEAN\\|DOMAIN\\)\\>" . font-lock-type-face) '("\\<\\(TRUE\\|FALSE\\|OTHER\\|BOOLEAN\\|DOMAIN\\)\\>" . font-lock-type-face)
'("\\<\\(CONSTANT\\|SUBSET\\|ENABLED\\|UNCHANGED\\|INSTANCE\\|WITH\\|EXCEPT\\|UNION\\|IN\\|DOMAIN\\|EXCEPT\\|IF\\|THEN\\|ELSE\\|CHOOSE\\)\\>" . font-lock-keyword-face) '("\\<\\(CONSTANT\\|SUBSET\\|ENABLED\\|UNCHANGED\\|INSTANCE\\|WITH\\|EXCEPT\\|UNION\\|IN\\|DOMAIN\\|EXCEPT\\|IF\\|THEN\\|ELSE\\|CHOOSE\\)\\>" . font-lock-keyword-face)
'("\\\\\\*.*$" . font-lock-comment-face)
'("(\\*.*\\*)" . font-lock-comment-face)
'("\\('\\w*'\\)" . font-lock-variable-name-face) '("\\('\\w*'\\)" . font-lock-variable-name-face)
"Highlighting for TLA+ Operators, Keywords etc.")) "Highlighting for TLA+ Operators, Keywords etc."))
;;;###autoload (add-to-list 'auto-mode-alist '("\\.tla\\'" . tla+-mode)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.tla\\'" . tla+-mode))
;;;###autoload ;;;###autoload
(define-derived-mode tla+-mode nil "TLA+" (define-derived-mode tla+-mode fundamental-mode "TLA+"
"Major mode for editing TLA+ specifications. "Major mode for editing TLA+ specifications.
In this mode, syntax highlighting is activated for TLA+ specification In this mode, syntax highlighting is activated for TLA+ specification
files. Various operators can be inserted by `tla+-operator-NAME'. files. Various operators can be inserted by `tla+-operator-NAME'.
@ -475,6 +480,17 @@ specification file."
"\\* Created " "\\* Created "
(current-time-string) " by " user-full-name "\n")))) (current-time-string) " by " user-full-name "\n"))))
(defun tla+-add-update-note ()
"Add an Update note"
(interactive)
(let ((text "...describe changes here..."))
(goto-char (point-max))
(insert (concat "\\* Updated " (current-time-string) " by "
user-full-name "\n"))
(insert (concat "\\* " text))
(goto-char (- (point-max) (length text)))))
(defun tla+-run-sany () (defun tla+-run-sany ()
"This function runs tla2sany.SANY (TLA syntax checker) "This function runs tla2sany.SANY (TLA syntax checker)
@ -538,6 +554,7 @@ Note: The TLA+ specification file is a relative path.
(cmd (concat (cmd (concat
tla+-java-path " -cp " tla+-tlatools-path tla+-java-path " -cp " tla+-tlatools-path
" tlc2.TLC " " tlc2.TLC "
" -dump dot states.dot "
tla+-tlc-deadlock " " tla+-tlc-deadlock " "
tla+-tlc-simulate " " tla+-tlc-simulate " "
tla+-tlc-depth " " tla+-tlc-depth " "