diff --git a/CHANGELOG.md b/CHANGELOG.md index dc50e82..653ddb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### New features +* Add a module to enable Literate Programming * Add a Racket module. * Add a Lua module. * Auto-install `racket-mode` if needed. diff --git a/docs/modules/literate-programming.md b/docs/modules/literate-programming.md new file mode 100644 index 0000000..b802f5b --- /dev/null +++ b/docs/modules/literate-programming.md @@ -0,0 +1,17 @@ +# Prelude Literate Programming + +Prelude's `prelude-literate-programming` module enables some +additional functionality for `org-mode` - the parent mode the native +markdown language of Emacs. + +It also enables viewing and interaction of Python Notebooks within Emacs. + +Here are some features it provides: + +* syntax highlighting of code blocks in Emacs Orgmode +* executing code blocks and printing their output in the org file +* viewing python notebooks within Emacs +* Using Emacs to interact with python notebooks and other remote compute engines + +It makes an attempt to enable [literate programming](http://www.literateprogramming.com/knuthweb.pdf) +from within emacs diff --git a/modules/prelude-literate-programming.el b/modules/prelude-literate-programming.el new file mode 100644 index 0000000..b014aba --- /dev/null +++ b/modules/prelude-literate-programming.el @@ -0,0 +1,99 @@ +;;; prelude-literate-programming.el --- Emacs Prelude: Literate Programming Support +;; +;; Author: Koustubh Sinkar +;; Version: 1.0.0 +;; Keywords: literate programming + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Prelude configuration for literate programming + +;;; License: + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 3 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Code: + +(defvar prelude-ipynb-packages + '(code-cells ; file mode for code-cells + ein ; Emacs Ipython Notebook (Jupyter Client) + elpy ; emacs python development environment + )) + +(defvar prelude-ob-packages + '(ob-async ; asynchronous execution of code-blocks + ob-ipython ; for python and ipython + ob-tmux ; for shell + ob-deno ; for javascript + ob-typescript + )) + + +(prelude-require-packages + (append prelude-ipynb-packages prelude-ob-packages)) + +(setq prelude-ob-loader-list + '((python . t) + (ipython . t) + (shell . t) + (js . t) + (typescript . t) + ;; Include other languages here... + )) + +;; Run/highlight code using babel in org-mode +(org-babel-do-load-languages + 'org-babel-load-languages prelude-ob-loader-list) + +;; Syntax highlight in #+BEGIN_SRC blocks +(setq org-src-fontify-natively t) + +;; Don't prompt before running code in org +(setq org-confirm-babel-evaluate nil) + +;; Fix an incompatibility between the ob-async and ob-ipython packages +(setq ob-async-no-async-languages-alist '("ipython")) + +(defvar org-babel-language-list + '(ob-cfengine3 + ob-clojurescript + ob-coffee + ob-dao + ob-diagrams + ob-elixir + ob-elm + ob-go + ob-graphql + ob-http + ob-ipython + ob-julia-vterm + ob-kotlin + ob-mongo + ob-prolog + ob-restclient + ob-rust + ob-sml + ob-sql-mode + ob-translate + ob-typescript + ob-uart + )) +;;; TODO Write a function to enable org-babel for each function + +(provide 'prelude-literate-programming) +;;; prelude-literate-programming.el ends here diff --git a/sample/prelude-modules.el b/sample/prelude-modules.el index cc8f1f3..7fa964f 100644 --- a/sample/prelude-modules.el +++ b/sample/prelude-modules.el @@ -79,6 +79,7 @@ (require 'prelude-js) ;; (require 'prelude-latex) (require 'prelude-lisp) ;; Common setup for Lisp-like languages +;; (require 'prelude-literate-programming) ;; Setup for Literate Programming (require 'prelude-lsp) ;; Base setup for the Language Server Protocol ;; (require 'prelude-lua) ;; (require 'prelude-ocaml)