Skip to content

Commit f130938

Browse files
committed
Fix typo.
1 parent 465760e commit f130938

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

README.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ And in my Emacs configuration file, I will add a hook to enable [[https://polymo
7777
#+END_SRC
7878
So Github can render such source file as org mode correctly.
7979
** how to insert code block quickly
80-
Please have a look of the section [[https://github.com/jingtaozf/literate-elisp/blob/master/literate-elisp.org#how-to-insert-code-block-in-org-file][How to insert code block in org file]] in library [[https://github.com/jingtaozf/literate-elisp][literate-lisp]].
80+
Please have a look of the section [[https://github.com/jingtaozf/literate-elisp/blob/master/literate-elisp.org#how-to-insert-code-block-in-org-file][How to insert code block in org file]] in library [[https://github.com/jingtaozf/literate-elisp][literate-elisp]].
8181
** Add dependence in project.clj
8282
To use this library, please add dependence in your [[./demo/project.clj][project.clj]]:
8383
#+BEGIN_SRC clojure

src/literate_clojure/core.org

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
- [[#how-to-do-it][how to do it?]]
1313
- [[#implementation][Implementation]]
1414
- [[#preparation][Preparation]]
15+
- [[#namespace][namespace]]
16+
- [[#debug-function][debug function]]
1517
- [[#stream-read-operations][stream read operations]]
1618
- [[#reader-macros][reader macros]]
1719
- [[#handle-org-syntax][handle org syntax]]
@@ -29,7 +31,7 @@ It extends the clojure read syntax so clojure can load org file as source file d
2931

3032
[[https://github.com/limist/literate-programming-examples][literate programming examples]] show the reason why use org mode,
3133

32-
By using clojure package [[https://github.com/jingtaozf/literate-clojure][literate-clojure]] , emacs [[https://orgmode.org/][org mode]] and elisp library [[https://polymode.github.io/][polymode]],
34+
By using clojure package [[https://github.com/jingtaozf/literate-clojure][literate-clojure]] , Emacs [[https://orgmode.org/][org mode]] and Elisp library [[https://polymode.github.io/][polymode]],
3335
literate programming can be easy in one org file containing both documentation and source codes,
3436
and this org file works well with [[https://github.com/clojure-emacs/cider][cider]].
3537

@@ -52,7 +54,7 @@ and the clojure codes exists between ~#+begin_src clojure~ and ~#+end_src~
5254
,#+END_SRC
5355
#+END_EXAMPLE
5456

55-
So to let clojure can rean an org file directly, all lines out of surrounding
57+
So to let clojure can read an org file directly, all lines out of surrounding
5658
by ~#+begin_src~ and ~#+end_src~ should mean nothing,
5759
and even codes surrounding by them should mean nothing
5860
if the [[https://orgmode.org/manual/Code-block-specific-header-arguments.html#Code-block-specific-header-arguments][header arguments]] in a code block request such behavior.
@@ -63,8 +65,8 @@ then ignore all lines after that until it meet ~#+begin_src~.
6365
When ~#+begign_src lisp~ occurs, org [[https://orgmode.org/manual/Code-block-specific-header-arguments.html#Code-block-specific-header-arguments][header arguments]] for this code block give us
6466
a chance to switch back to normal clojure reader or not.
6567

66-
And if it switch back to normal clojure reader, the end line ~#+END_SRC~ should mean the end of current
67-
code block,so a new clojure [[https://clojure.org/reference/reader#_dispatch][dispatch]] syntax for "#+"(sharp plus)will have an additional meaning
68+
And if it switches back to normal clojure reader, the end line ~#+END_SRC~ should mean the end of current
69+
code block, so a new clojure [[https://clojure.org/reference/reader#_dispatch][dispatch]] syntax for "#+"(sharp plus)will have an additional meaning
6870
to determine if it is ~#+END_SRC~,
6971
if it is, then clojure reader will switch back to org mode syntax,
7072
if it is not, clojure reader will continue to read subsequent stream as like the original clojure reader.
@@ -75,7 +77,7 @@ for example I often put them in the first line of an org file:
7577
#+BEGIN_SRC org
7678
# -*- encoding:utf-8 Mode: POLY-ORG; -*- ---
7779
#+END_SRC
78-
Which make emacs open file with utf-8 encoding and [[https://github.com/polymode/poly-org][poly-org-mode]].
80+
Which make Emacs open file with utf-8 encoding and [[https://github.com/polymode/poly-org][poly-org-mode]].
7981

8082
* Implementation
8183
** Preparation
@@ -97,7 +99,7 @@ A boolean variable to toggle debug on/off
9799
(defonce ^:dynamic debug-p nil)
98100
#+END_SRC
99101

100-
a debug function to print out some log messages.
102+
A debug function to print out some log messages.
101103
#+BEGIN_SRC clojure
102104
(defn debug [& args]
103105
(when debug-p
@@ -165,13 +167,13 @@ Based on clojure's [[https://github.com/clojure/clojure/blob/master/src/jvm/cloj
165167
(debug (cl-format nil "install dispatch reader macro for character '~a'" ch))
166168
(aset dm (int ch) fun))))
167169
#+END_SRC
168-
But it only works in clojure instead of clojurescript, because clojurescript use [[https://github.com/clojure/tools.reader][tools.reader]].
170+
But it only works in clojure instead of ClojureScript, because ClojureScript uses [[https://github.com/clojure/tools.reader][tools.reader]].
169171

170172
** handle org syntax
171173

172174
There are a lot of different lisp codes occur in one org file, some for function implementation,
173175
some for demo, so a new [[https://orgmode.org/manual/Structure-of-code-blocks.html][org code block]] [[https://orgmode.org/manual/Code-block-specific-header-arguments.html#Code-block-specific-header-arguments][header argument]] ~load~ to decide to
174-
read them or not should define,and it has three meanings:
176+
read them or not should define, and it has three meanings:
175177
- yes \\
176178
It means that current code block should load normally,
177179
it is the default mode when the header argument ~load~ is not provided.
@@ -238,7 +240,7 @@ The ~reader~ is returned so [[https://github.com/clojure/clojure/blob/master/src
238240
#+END_SRC
239241

240242
** handle end of source code block
241-
Let's define a new dispatch function for "#+" (sharp plus) to return back org syntax, until it meet ~#+begin_src clojure~.
243+
Let's define a new dispatch function for "#+" (sharp plus) to switch back to org syntax, until it meet ~#+begin_src clojure~.
242244
#+BEGIN_SRC clojure
243245
(defn- dispatch-sharp-plus [reader quote opts pending-forms]
244246
(let [line (literate-read-line reader)]
@@ -253,8 +255,8 @@ Let's define a new dispatch function for "#+" (sharp plus) to return back org sy
253255
(dispatch-sharp-plus reader quote opts pending-forms)))
254256
#+END_SRC
255257
** install new dispatcher functions
256-
We make ~install-org-dispatcher~ accept as possible as many args so it can be a dummy handler for other module, for example
257-
warning handler of clojurescript.
258+
We make ~install-org-dispatcher~ accept arguments, so it can be a dummy handler for other modules, for example
259+
warning handler of ClojureScript.
258260
#+BEGIN_SRC clojure
259261
(defn install-org-dispatcher [& args]
260262
(when-not args
@@ -265,7 +267,7 @@ warning handler of clojurescript.
265267
#+END_SRC
266268
** install new dispatcher functions to tools.reader
267269
Sadly [[https://github.com/clojure/tools.reader][tools.reader]] use a private function to return dispatch functions(see function [[https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj][dispatch-macros]]).
268-
So we have to advice this function to add new dispatch reader macro.
270+
So we have to alter this function to add new dispatch reader macro.
269271
#+BEGIN_SRC clojure
270272
(defn tools.reader.additional-dispatch-macros [orig-fn]
271273
#(or (orig-fn %)
@@ -328,9 +330,9 @@ If we want to release to [[./core.clj]], the following codes should execute:
328330
#+END_SRC
329331

330332
* References
331-
- [[http://www.literateprogramming.com/knuthweb.pdf][Literate. Programming.]] by [[https://www-cs-faculty.stanford.edu/~knuth/lp.html][Donald E. Knuth]]
332-
- [[http://www.literateprogramming.com/][Literate Programming]] a site of literate programming
333-
- [[https://www.youtube.com/watch?v=Av0PQDVTP4A][Literate Programming in the Large]] a talk video from Timothy Daly,one of the original authors of [[https://en.wikipedia.org/wiki/Axiom_(computer_algebra_system)][Axiom]].
333+
- [[http://www.literateprogramming.com/knuthweb.pdf][Literate. Programming]], by [[https://www-cs-faculty.stanford.edu/~knuth/lp.html][Donald E. Knuth]]
334+
- [[http://www.literateprogramming.com/][Literate Programming]] a site of literate programming
335+
- [[https://www.youtube.com/watch?v=Av0PQDVTP4A][Literate Programming in the Large]] a talk video from Timothy Daly, one of the original authors of [[https://en.wikipedia.org/wiki/Axiom_(computer_algebra_system)][Axiom]].
334336
- [[https://github.com/limist/literate-programming-examples][A collection of literate programming examples using Emacs Org mode]]
335337
- [[https://orgmode.org/worg/org-contrib/babel/intro.html#literate-programming][literate programming in org babel]]
336338
- a reader macro library for clojure: https://github.com/klutometis/reader-macros

src/literate_clojure/core.pdf

-44.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)