lit-prog-book/README.org
Howard Abrams 184ca4acee Naming and evaluating src blocks
As well as a nifty function for viewing the Info version.
2024-08-10 23:33:41 -07:00

44 lines
1.5 KiB
Org Mode

#+title: Literate Programming in Org
#+date: 2024-08-03 August
#+tags: book literate-programming lp emacs org org-mode
# (progn (find-file (org-texinfo-export-to-info)) (Info-mode) (Info-top-node))
This is a book on /Literate Programming in Emacs/ using Org Mode.
The goal is to write the book as an org document, and then /export/ it as:
- Info, readable in Emacs
- PDF and Epub, readable on devices
- HTML to be viewable as a web page in EWW
- Org, downloadable and useful when this project is cloned
A question on /interactive-ness/. Since the goal is to teach LP through Emacs (and not just a general guide on LP), we want the text viewable in Emacs, so that code can be easily copy/pasted into their own notes, as well as allowing the user to enter ~C-x C-e~ on any s-expression.
To render and read [[file:lp-in-org.org][the book]] in Info, execute the following:
#+begin_src emacs-lisp :results silent
(progn
(ignore-errors
(kill-buffer "lp-in-org.info"))
(find-file "lp-in-org.org")
(find-file (org-texinfo-export-to-info))
(Info-mode)
(Info-top-node))
#+end_src
Better yet:
#+begin_src emacs-lisp :results silent
(defun org-view-as-info (file)
"View FILE, an org file, as exported to Info page."
(ignore-errors
(kill-buffer (format "%s.info" (file-name-base file))))
(find-file file)
(find-file (org-texinfo-export-to-info))
(Info-mode)
(Info-top-node))
(defun view-literate-programming-book ()
(interactive)
(org-view-as-info "~/Documents/literate-programming/lp-in-org.org"))
#+end_src