htmlize {Edrx's mails on eev.el} {
[H2 More explanations on eev.el, adapted from mails I've sent:]
[P [IT (This was part of a mail I sent to the writer of the \"Brave
GNU World\" column in 2000jan23).]]
[P Hi Georg,]
[P I have a project that I think you'll find worth a look, as the
author of \"Brave GNU world\" or as a GNU user: it (eev.el) lets users
embed chunks of code and hyperlinks in plain text files (if they use
Emacs!), in such a way that one can, for example, write notes about
how to unpack gawk, recompile it with debug information, start gdb on
it, place a breakpoint at a certain place, and make it run until the
breakpoint is reached, all that with comments interspersed that are in
fact hyperlinks to the places where you got the information that led
you up to that point... and instead of writing these notes in an
artificial \"press this, do that\" style you just record what you sent
to the shell and to gdb and to \"replay\" what you recorded you just
have to mark blocks in Emacs and issue some simple commands... in this
specific example, many comments in the chunk below are to be executed
with C-x C-e ([TT eval-last-sexp] in Emacs) and other parts with M-x
[TT eev] or M-x [TT eegdb-bounded]\; [TT eev], [TT eegdb-bounded] and
[TT code-c-d] are defined in my package, eev.el, and [TT
find-gawkfile], [TT find-gawknode] and [TT find-gawktag] become
defined when one runs the code-c-d line.]
[PRE1 [txt2html
®{# (code-c-d "gawk" "/usr/src/gawk-3.0.3/" "gawk")
rm -Rv /usr/src/gawk-3.0.3/
cd /usr/src/
dpkg-source -sn -x \
/big/slinks2/dists/slink/main/source/interpreters/gawk_3.0.3-1.dsc
cd /usr/src/gawk-3.0.3/
debian/rules binary |& tee odrb
etags *.[chy]
# (find-gawkfile "odrb" "strip")
# (find-gawkfile "debian/rules" "strip")
# In the top gawk dir there's a non-stripped binary; we use it.
# (find-gawknode "Numeric Functions")
# (find-gawkfile "awktab.c" "\"cos\"")
# (find-gawktag "do_cos")
cat > /tmp/awkprog <<'---'
BEGIN { print cos(0); }
---
%
br do_cos
set args -f /tmp/awkprog
run
p *tree
%
p *(tree->sub.nodep.l.lptr)
%
p *(tree->sub.nodep.l.ll)
%
# (gdb "gdb /usr/src/gawk-3.0.3/gawk")
# (find-gawktag "lnode")
# (find-angg "eev.el" "eev")
# (find-angg "eev.el" "code-c-d")
# (find-angg "eev.el" "code-c-d-explan1")
# (find-angg "eev.el" "code-c-d-explan2")
# (find-angg "eev.el" "gdb")
# (find-angg "eev.el" "bounded")}¯]]
[P (...)]
[HLIST2 {Links:}
[J [L e/escripts.e.html#debugging_gawk
http://angg.twu.net/e/escripts.e.html#debugging_gawk] - The block above]
[J [L eev-manifesto.html
http://angg.twu.net/eev-manifesto.html] - why eev is so important]
[J [L emacs.html
http://angg.twu.net/emacs.html] - docs on it, and links]
]
[RULE]
[P [IT (This was part of a mail I sent to Jon \"Caspian\" Blank of
twu.net when I was almost www-homeless (1999dec04, I think). He liked
it, and after a few more mails he was hosting me at [L
http://angg.twu.net/]! See [L http://www.twu.net/] for his other
stuff.)]]
[P [IT See also: [L emacs.html], [AL EEV/tocaspian1.txt], [AL
EEV/torms1.txt]).]]
[P A small emacs-lisp package that I wrote (eev.el - URL below) defines
some lisp functions that can be used as hyperlinks and some commands
to execute blocks of text\; for example, in the chunk of text below,]
[PRE1 {®
# (find-node "(gawk)Top")
# (find-node "(gawk)If Statement")
# (find-node "(gawk)String Functions" "substr(")
cd $ES/
for i in *.e; do
echo -n "$i: "
awk '{if ($0=="#") {if (n==1) exit; else n+=1}
else if (n==1) print substr($0, 3)
}' $i
done | tee ~/o¯
}]
[P if you place the cursor at the end of the last \"find-node\" line and
type C-x C-e then Emacs evaluates the Lisp expression]
[PRE1 {®
(find-node "(gawk)String Functions" "substr(")¯
}]
[P which corresponds to `find the info page named \"[TT String
Functions]\" in the gawk info pages, and place the cursor after the
first occurrence of \"[TT substr(]\". There are variations like]
[PRE1 {®
(find-fline "/usr/include/linux/kd.h" 11)
(find-k2file "drivers/char/vt.c" "PIO_FONTX")
(find-k2tag "vt_ioctl")
¯}]
[P which mean, respectively, `open the file [TT
/usr/include/linux/kd.h] and go to the line 11', `open the file [TT
/usr/src/linux-2.0/drivers/char/vt.c] and search for \"[TT
PIO_FONTX]\"', and `find the tag \"[TT vt_ioctl]\" in the kernel
2.0.37 sources, i.e., using the tags table [TT
/usr/src/linux-2.0/TAGS]'. As any of these \"hyperlinks\" can be
written preceded by a \"[TT #]\", we become able to, for example,
place hyperlinks in our shell scripts...]
[P As for executing blocks of text, if you mark a portion of your
text, say from `[TT # (find-node \"(gawk)Top\")]' to `[TT done | tee
~/o]', and then type M-x [TT eev] (the name of this function doesn't
make much sense, but I use it so much that I had to choose something
short), then you can go to another window or virtual console and run
`[TT ee]', and the shell will execute the marked block almost as if
you were typing it line by line, i.e, displaying each line (including
blanks and comments) before executing it, and, if needed, accumulating
many lines before running them together, as in the case of the \"for\"
loop. There are some variations on eev that are meant to execute
blocks of text using Tcl, Forth, gdb or perl and to run a block
through LaTeX, putting some predefined lines before and after it.]
[P Well, the moral of all this is that one can keep files of notes
with lots of comments and hyperlinks, instead of having to keep
hundreds of possibly incomplete scripts, and the \"code\" in these
notes can be executed in little pieces\; so we can just store the
commands that accomplished something on one day, and as we use them
more we can clean our preferred ones and make them more general...
it's more organic than having to choose between \"turn into a named
script and document it\", \"describe everything in terms of `type
this, run that'\", and \"Oh, I think I will remember it when I need
to\".]
[P I think that people should have better ways to exchange tricks than
only by scripts, source, books and verbal descriptions, and this is my
contribution to it. This way obviously sprang out from my own needs,
my laziness and the necessity to cope with my very weak memory... I've
spent four years thinking that everybody was doing like me, until I
found -- shocked and horrified -- that it was not the case... Well,
too much history. Back to the main points:]
[P I have about 1M just on notes of this kind, which I call
\"e-scripts\". They're temporarily at angelfire\; my page there is [L
http://www.angelfire.com/or2/edrx/]. It is grossly incomplete\; the
server I used at my university went down some weeks ago (it was a
vulnerable RedHat box) and I was trying to use angelfire, but at a.f.
some filenames, like .emacs, are not allowed and I can't generate all
the stuff from a 300k .tar.gz and a makefile, not to count that all
the htmls get banners...]
}