From 0e265a3794a953533f4ea67543469d7754b9f496 Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Wed, 3 Jul 2024 12:38:11 -0600 Subject: [PATCH] pic support --- emacs/init.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 42d20b0..85d73ae 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -223,6 +223,17 @@ (add-hook 'org-mode-hook (lambda () (local-set-key (kbd "C-c e") 'insert-latex-equation))) + +(defun org-babel-execute:pic (body params) + (let* ((tmpfile (org-babel-temp-file "pic-" ".png")) + (quoted-text (replace-regexp-in-string "'" "'\\\\''" body)) + (body-with-v (replace-regexp-in-string "\\\\v" "VERTICAL" quoted-text)) + (cmd (concat "echo '" body-with-v "' | preconv | sed \'s/VERTICAL/\\\\v/g\' | pic2graph -density 200 > " tmpfile))) + (shell-command cmd) + tmpfile)) + +(require 'ob) +(add-to-list 'org-babel-tangle-lang-exts '("pic" . "pic")) ;; --- ;; --- Keybinds ---