diff --git a/core/core-popups.el b/core/core-popups.el index 9a6f1cdfe..4b8bd7d90 100644 --- a/core/core-popups.el +++ b/core/core-popups.el @@ -558,6 +558,18 @@ you came from." (advice-add #'xref-goto-xref :around #'doom*xref-follow-and-close)) +;; +;; Major modes +;; + +(after! plantuml-mode + (defun doom*plantuml-preview-in-popup-window (orig-fn &rest args) + (save-window-excursion + (apply orig-fn args)) + (pop-to-buffer plantuml-preview-buffer)) + (advice-add #'plantuml-preview-string + :around #'doom*plantuml-preview-in-popup-window)) + ;; Ensure these settings are attached to org-load-hook as late as possible, ;; giving other modules a chance to add their own hooks. (defun doom|init-org-popups () diff --git a/init.example.el b/init.example.el index 0b541be4c..1b706ab73 100644 --- a/init.example.el +++ b/init.example.el @@ -93,6 +93,7 @@ ocaml ; an objective camel perl ; write code no one else can comprehend php ; make php less awful to work with + plantuml ; diagrams for confusing people more purescript ; javascript, but functional python ; beautiful is better than ugly rest ; Emacs as a REST client diff --git a/modules/lang/plantuml/autoload.el b/modules/lang/plantuml/autoload.el new file mode 100644 index 000000000..1fbd15a96 --- /dev/null +++ b/modules/lang/plantuml/autoload.el @@ -0,0 +1,10 @@ +;;; lang/plantuml/autoload.el -*- lexical-binding: t; -*- + +;;;###autoload +(defun +plantuml/install () + "Install plantuml.jar." + (interactive) + (unless (file-exists-p plantuml-jar-path) + (user-error "plantuml.jar already installed")) + (url-copy-file "https://kent.dl.sourceforge.net/project/plantuml/plantuml.jar" + plantuml-jar-path)) diff --git a/modules/lang/plantuml/config.el b/modules/lang/plantuml/config.el new file mode 100644 index 000000000..13353d1ab --- /dev/null +++ b/modules/lang/plantuml/config.el @@ -0,0 +1,18 @@ +;;; lang/plantuml/config.el -*- lexical-binding: t; -*- + +(def-package! plantuml-mode + :mode "\\.p\\(lant\\)?uml$" + :config + (setq plantuml-jar-path (concat doom-etc-dir "plantuml.jar")) + (set! :popup "*PLANTUML Preview*" :size 25 :noselect t :autokill t) + + (unless (executable-find "java") + (warn "plantuml-mode: can't find java, preview disabled.")) + (unless (file-exists-p plantuml-jar-path) + (warn "plantuml-mode: can't find plantuml.jar; run M-x +plantuml/install."))) + + +(def-package! flycheck-plantuml + :when (featurep! :feature syntax-checker) + :after plantuml-mode + :config (flycheck-plantuml-setup)) diff --git a/modules/lang/plantuml/packages.el b/modules/lang/plantuml/packages.el new file mode 100644 index 000000000..f83696e6c --- /dev/null +++ b/modules/lang/plantuml/packages.el @@ -0,0 +1,6 @@ +;; -*- no-byte-compile: t; -*- +;;; lang/plantuml/packages.el + +(package! plantuml-mode) +(when (featurep! :feature syntax-checker) + (package! flycheck-plantuml))