Skip to content

Commit 4d7e18e

Browse files
committed
Add CLWEB commands.
1 parent 280882d commit 4d7e18e

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

clweb-commands.clw

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
% -*- mode: CLWEB -*-
2+
\noinx
3+
\def\CLWEB{{\tt CLWEB}}
4+
5+
@*\CLWEB\ commands.
6+
7+
@l
8+
@e
9+
(require "REPL")
10+
@e
11+
(in-package "REPL")
12+
13+
@ We sneakily import the external symbols of the \CLWEB\ package so that we
14+
don't get warnings when the {\tt REPL} package is redefined; some compilers
15+
complain when the |use-list| of a package changes, which it would if we just
16+
just said |(use-package "CLWEB")|.
17+
18+
@l
19+
@e
20+
(eval-when (:compile-toplevel :load-toplevel :execute)
21+
(require "CLWEB")
22+
(do-external-symbols (symbol (find-package "CLWEB"))
23+
(import symbol)))
24+
25+
@ The commands are just trivial wrappers around the top-level \CLWEB\
26+
functions.
27+
28+
@l
29+
(define-simple-file-command lw
30+
(:documentation "Load a web."
31+
:prompt "Load web: "
32+
:function load-web))
33+
34+
(define-simple-file-command tf
35+
(:documentation "Tangle a web."
36+
:prompt "Tangle web: "
37+
:function tangle-file))
38+
39+
(define-simple-file-command we
40+
(:documentation "Weave a web."
41+
:prompt "Weave web: "
42+
:function weave))
43+
44+
(defcmd wt ((pathname (read-pathname-argument 'we "Weave & TeX web: ")))
45+
"Weave and then TeX a web."
46+
(let ((tex-file (clweb:weave pathname)))
47+
(when tex-file
48+
(run "tex" tex-file))))

0 commit comments

Comments
 (0)