Use 'jar initialization for test purposes

This commit is contained in:
Carlo Sciolla 2019-05-31 09:27:31 +02:00
parent 0313b09e5e
commit 5cb10712d3
No known key found for this signature in database
GPG Key ID: BA5D71E6F3C580C1
2 changed files with 64 additions and 63 deletions

View File

@ -245,10 +245,10 @@
(funcall get-fn buf)
(error "Unsupported execution mode %s" mode))))
(defun plantuml-init ()
"Initialize the keywords or builtins from the cmdline language output."
(defun plantuml-init (mode)
"Initialize the keywords or builtins from the cmdline language output. Use exec mode MODE to load the language details."
(with-temp-buffer
(plantuml-get-language plantuml-exec-mode (current-buffer))
(plantuml-get-language mode (current-buffer))
(let ((found (search-forward ";" nil t))
(word "")
(count 0)
@ -463,10 +463,11 @@ Uses prefix (as PREFIX) to choose where to display it:
(plantuml-preview-region prefix (region-beginning) (region-end))
(plantuml-preview-buffer prefix)))
(defun plantuml-init-once ()
"Ensure initialization only happens once."
(defun plantuml-init-once (&optional mode)
"Ensure initialization only happens once. Use exec mode MODE to load the language details, which defaults to `plantuml-exec-mode'."
(let ((mode (or mode plantuml-exec-mode)))
(unless plantuml-kwdList
(plantuml-init)
(plantuml-init mode)
(defvar plantuml-types-regexp (concat "^\\s *\\(" (regexp-opt plantuml-types 'words) "\\|\\<\\(note\\s +over\\|note\\s +\\(left\\|right\\|bottom\\|top\\)\\s +\\(of\\)?\\)\\>\\|\\<\\(\\(left\\|center\\|right\\)\\s +\\(header\\|footer\\)\\)\\>\\)"))
(defvar plantuml-keywords-regexp (concat "^\\s *" (regexp-opt plantuml-keywords 'words) "\\|\\(<\\|<|\\|\\*\\|o\\)\\(\\.+\\|-+\\)\\|\\(\\.+\\|-+\\)\\(>\\||>\\|\\*\\|o\\)\\|\\.\\{2,\\}\\|-\\{2,\\}"))
(defvar plantuml-builtins-regexp (regexp-opt plantuml-builtins 'words))
@ -529,7 +530,7 @@ or it is followed by line end.")
(setq plantuml-types-regexp nil)
(setq plantuml-keywords-regexp nil)
(setq plantuml-builtins-regexp nil)
(setq plantuml-preprocessors-regexp nil)))
(setq plantuml-preprocessors-regexp nil))))
(defun plantuml-complete-symbol ()
"Perform keyword completion on word before cursor."

View File

@ -54,7 +54,7 @@ Finally, the indented text in the buffer will be compared with AFTER."
;; fix the JAR location prior to mode initialization
;; for some reason, plantuml-mode disregards the setq-local
(setq plantuml-jar-path plantuml-test-jar-path)
(plantuml-init-once)
(plantuml-init-once 'jar)
(insert before)
(goto-char (point-min))