|
| 1 | +;;; prelude-literate-programming.el --- Emacs Prelude: Literate Programming Support |
| 2 | +;; |
| 3 | +;; Author: Koustubh Sinkar |
| 4 | +;; Version: 1.0.0 |
| 5 | +;; Keywords: literate programming |
| 6 | + |
| 7 | +;; This file is not part of GNU Emacs. |
| 8 | + |
| 9 | +;;; Commentary: |
| 10 | + |
| 11 | +;; Prelude configuration for literate programming |
| 12 | + |
| 13 | +;;; License: |
| 14 | + |
| 15 | +;; This program is free software; you can redistribute it and/or |
| 16 | +;; modify it under the terms of the GNU General Public License |
| 17 | +;; as published by the Free Software Foundation; either version 3 |
| 18 | +;; of the License, or (at your option) any later version. |
| 19 | +;; |
| 20 | +;; This program is distributed in the hope that it will be useful, |
| 21 | +;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | +;; GNU General Public License for more details. |
| 24 | +;; |
| 25 | +;; You should have received a copy of the GNU General Public License |
| 26 | +;; along with GNU Emacs; see the file COPYING. If not, write to the |
| 27 | +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 28 | +;; Boston, MA 02110-1301, USA. |
| 29 | + |
| 30 | +;;; Code: |
| 31 | + |
| 32 | +(defvar prelude-ipynb-packages |
| 33 | + '(code-cells ; file mode for code-cells |
| 34 | + ein ; Emacs Ipython Notebook (Jupyter Client) |
| 35 | + elpy ; emacs python development environment |
| 36 | + )) |
| 37 | + |
| 38 | +(defvar prelude-ob-packages |
| 39 | + '(ob-async ; asynchronous execution of code-blocks |
| 40 | + ob-ipython ; for python and ipython |
| 41 | + ob-tmux ; for shell |
| 42 | + ob-deno ; for javascript |
| 43 | + ob-typescript |
| 44 | + )) |
| 45 | + |
| 46 | + |
| 47 | +(prelude-require-packages |
| 48 | + (append prelude-ipynb-packages prelude-ob-packages)) |
| 49 | + |
| 50 | +(setq prelude-ob-loader-list |
| 51 | + '((python . t) |
| 52 | + (ipython . t) |
| 53 | + (shell . t) |
| 54 | + (js . t) |
| 55 | + (typescript . t) |
| 56 | + ;; Include other languages here... |
| 57 | + )) |
| 58 | + |
| 59 | +;; Run/highlight code using babel in org-mode |
| 60 | +(org-babel-do-load-languages |
| 61 | + 'org-babel-load-languages prelude-ob-loader-list) |
| 62 | + |
| 63 | +;; Syntax highlight in #+BEGIN_SRC blocks |
| 64 | +(setq org-src-fontify-natively t) |
| 65 | + |
| 66 | +;; Don't prompt before running code in org |
| 67 | +(setq org-confirm-babel-evaluate nil) |
| 68 | + |
| 69 | +;; Fix an incompatibility between the ob-async and ob-ipython packages |
| 70 | +(setq ob-async-no-async-languages-alist '("ipython")) |
| 71 | + |
| 72 | +(defvar org-babel-language-list |
| 73 | + '(ob-cfengine3 |
| 74 | + ob-clojurescript |
| 75 | + ob-coffee |
| 76 | + ob-dao |
| 77 | + ob-diagrams |
| 78 | + ob-elixir |
| 79 | + ob-elm |
| 80 | + ob-go |
| 81 | + ob-graphql |
| 82 | + ob-http |
| 83 | + ob-ipython |
| 84 | + ob-julia-vterm |
| 85 | + ob-kotlin |
| 86 | + ob-mongo |
| 87 | + ob-prolog |
| 88 | + ob-restclient |
| 89 | + ob-rust |
| 90 | + ob-sml |
| 91 | + ob-sql-mode |
| 92 | + ob-translate |
| 93 | + ob-typescript |
| 94 | + ob-uart |
| 95 | + )) |
| 96 | +;;; TODO Write a function to enable org-babel for each function |
| 97 | + |
| 98 | +(provide 'prelude-literate-programming) |
| 99 | +;;; prelude-literate-programming.el ends here |
0 commit comments