emacs: Add plantuml wrapper so org-mode can work with plantuml-server
This commit is contained in:
parent
59cee7f975
commit
1524994bab
2 changed files with 54 additions and 20 deletions
|
@ -1778,26 +1778,28 @@ Configuration
|
|||
|
||||
#+name: org-config
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
|
||||
(add-to-list
|
||||
'org-src-lang-modes '("plantuml" . plantuml))
|
||||
(dolist (face '((org-level-1 . 1.2)
|
||||
(org-level-2 . 1.1)
|
||||
(org-level-3 . 1.05)
|
||||
(org-level-4 . 1.0)
|
||||
(org-level-5 . 1.0)
|
||||
(org-level-6 . 1.0)
|
||||
(org-level-7 . 1.0)
|
||||
(org-level-8 . 1.0)))
|
||||
(set-face-attribute (car face) nil :family my/variable-width-font :weight 'medium :height (cdr face)))
|
||||
(set-face-attribute 'org-document-title nil :family my/variable-width-font :weight 'bold :height 1.3)
|
||||
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
|
||||
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
|
||||
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
|
||||
(add-to-list
|
||||
'org-src-lang-modes '("plantuml" . plantuml))
|
||||
(dolist (face '((org-level-1 . 1.2)
|
||||
(org-level-2 . 1.1)
|
||||
(org-level-3 . 1.05)
|
||||
(org-level-4 . 1.0)
|
||||
(org-level-5 . 1.0)
|
||||
(org-level-6 . 1.0)
|
||||
(org-level-7 . 1.0)
|
||||
(org-level-8 . 1.0)))
|
||||
(set-face-attribute (car face) nil :family my/variable-width-font :weight 'medium :height (cdr face)))
|
||||
(set-face-attribute 'org-document-title nil :family my/variable-width-font :weight 'bold :height 1.3)
|
||||
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
|
||||
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
|
||||
(setq org-plantuml-exec-mode 'plantuml
|
||||
org-plantuml-executable-path "plantuml-client")
|
||||
#+end_src
|
||||
|
||||
=org-capture= allows creating and saving quick notes, links and TODOs
|
||||
|
|
|
@ -8,6 +8,37 @@ with lib;
|
|||
let
|
||||
cfg = config.eboskma.programs.emacs;
|
||||
|
||||
plantuml-client = pkgs.writeShellApplication {
|
||||
name = "plantuml-client";
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
xh
|
||||
];
|
||||
|
||||
text = ''
|
||||
type=
|
||||
while getopts ":t:" option; do
|
||||
case "''${option}" in
|
||||
t)
|
||||
type="''${OPTARG}";;
|
||||
\?)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
tempfile=$(mktemp --suffix plantuml)
|
||||
|
||||
while IFS= read -r line; do
|
||||
echo "''${line}" >> "''${tempfile}"
|
||||
done
|
||||
|
||||
encoded=$(xh --print=b post http://localhost:5080/plantuml/coder Content-Type:text/plain < "''${tempfile}")
|
||||
rm "''${tempfile}"
|
||||
|
||||
xh get "http://localhost:5080/plantuml/''${type}/''${encoded}"
|
||||
'';
|
||||
};
|
||||
|
||||
tangleEmacsConfig =
|
||||
initFile:
|
||||
pkgs.runCommand "tangled-emacs-${initFile}" { } ''
|
||||
|
@ -173,6 +204,7 @@ in
|
|||
}))
|
||||
nixfmt-rfc-style
|
||||
python3
|
||||
plantuml-client
|
||||
]
|
||||
++ (with aspellDicts; [
|
||||
en
|
||||
|
|
Loading…
Reference in a new issue