From 184ca4acee4c939465a5de8b11b97d9956e8ad74 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Sat, 10 Aug 2024 23:33:41 -0700 Subject: [PATCH] Naming and evaluating src blocks As well as a nifty function for viewing the Info version. --- README.org | 16 ++++++ lp-in-org.org | 149 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 153 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index b5f08cc..784e705 100644 --- a/README.org +++ b/README.org @@ -25,3 +25,19 @@ To render and read [[file:lp-in-org.org][the book]] in Info, execute the followi (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 diff --git a/lp-in-org.org b/lp-in-org.org index 53ae79c..3d2accd 100644 --- a/lp-in-org.org +++ b/lp-in-org.org @@ -3,14 +3,6 @@ #+EMAIL: howard.abrams@gmail.com #+DATE: 2016 Oct 06 #+DESCRIPTION: This file is used as the basis for the Info documentation -#+OPTIONS: ':t toc:t author:t email:t -#+LANGUAGE: en -#+MACRO: version 1.0 -#+MACRO: updated last updated 1 August 2024 - -#+TEXINFO_FILENAME: lp-in-org.info -#+TEXINFO_HEADER: @syncodeindex pg cp -#+TEXINFO_HEADER: @syncodeindex vr cp # NOTE: To create/view info, execute the following with `C-x C-e': # (progn (find-file (org-texinfo-export-to-info)) (Info-mode) (Info-top-node)) @@ -142,7 +134,7 @@ While a classic, not a very good example. Let’s try again with the following c #+begin_example ,#+begin_src emacs-lisp - (truncate (* (sin .438) 100)) + (truncate (* (sin 0.438) 100)) ,#+end_src #+end_example @@ -168,10 +160,10 @@ Note: If you are reading this in an Emacs buffer, you can also place your cursor At this point, you can begin a line with =