Hello! The name of this talk is "How to
record executable notes with eev and
how to play them back", and I'm Eduardo
Ochs, this person here, the author of eev,
and this is Selana Ochs, my main
contributor at the moment. Let me start
by explaining the prehistory of eev. Eev
appeared by accident. I was fascinated
by programming, and from what I knew
UNIX seemed to be the right thing... and
in 1995 I bought a computer that could run
GNU Linux and a Linux CD. I was studying
mathematics at the University - not
Computer Science - and I was able to learn
at the University a tiny bit of UNIX and
Lisp, but my social skills were very bad.
I couldn't socialized properly with
the people there who really knew Unix,
and they kept saying to me that
"everybody uses vi", but my memory was
very bad - as bad as my social skills -
and I typed slowly, and with lots of
mistakes... so at one point I decided to
give up learning vi, and I tried Emacs...
and I found it MIND-BLOWING.
I was taking notes about everything
that I was learning, and my notes
started to have lots of elisp hyperlinks
like these... When we execute this it
opens a certain directory with lots of
interesting files in it, and when we
execute this it opens a specific
file in that directory. I was
using hundreds of hyperlinks like these
to take notes of everything that I
found interesting... it was easy to follow
these expressions as hyperlinks: in the
beginning I used the standard
function `find-file', and then I created
a variant of it called `find-fline, that
accepted extra arguments... in the
beginning it only supported a line
number, like this, that would open this
file and go to the line 423, and then
I made it accept also strings to
search for... so this variant here would
open this file and search for the first
occurrence of this string here...
and I also invented shorter hyperlinks,
like these three here, in which
I do not need to specify the directory -
like this - because this directory is
somehow embedded in this code here... so
"e" means the directory with the elisp
files in Emacs. And I also wrote a very
primitive way to send the current
region to a shell: when I typed `M-x eev' -
which meant: "emacs-execute-verbosely" -
this command wrote the region into a
certain temporary file, and if I went to
a shell and I typed `ee'
it would run the commands in this
temporary file, and it would executed them.
These are some technical details that I
do not want to discuss now... and in a few
months using that I had created several
other kinds of elisp hyperlinks, all
of them also supporting these extra
arguments that indicated usually strings
to search for, but sometimes
I could use that to point a certain line
number. I called these extra arguments
"pos-spec-lists", and here are
some examples. These hyperlinks here
would open the manpage of GNU Awk
and go to specific sections in it...
and these hyperlinks open the info
manual of Make and go to certain nodes
in this manual... and in some cases it also
looks for these strings in these nodes.
And these hyperlinks here
they run certain commands in the shell
and then display its output. And the
elisp hyperlinks that I was using
could be always be put in comments in
scripting languages... they were
always the sexp at the end of the line.
Let me show you an example here.
This thing here is a small Tcl script...
this line is a comment,
and this S-expression here is
treated by Tcl as a comment, but in Emacs
we can put the cursor here, say, and then
we type `C-e' to go to the end of the
line and then `C-x C-e' to execute this...
and if we execute this we
visit the file that is mentioned in the
line below. I was doing that so much -
going to the end of the line and then
executing the expression before point -
that I defined a key that would do that.
So I defined that `M-e' would work
like `C-e' to go to the end of the line,
and then `C-x C-e'... and my name for it
it was `eval-sexp-eol' - "end of line"
here. So `C-x C-e', that is a standard
key sequence, means `eval-last-sexp',
and I named `M-e' `eval-sexp-eol'.
And at the time all the languages and
interpreters that I was using supported
elisp hyperlinks in comments, like this...
and I also created variants of `M-x eev'
that could send the region to other
interpreters, and in a few years using
that I had several megabytes of notes
and scripts... not only had scripts with
elisp hyperlinks and comments, but
also I had tons of "executable notes" -
I called them "e-scripts" - that were
totally free-form... some parts of them
were blocks of elisp hyperlinks, some
other parts were were blocks of code to
be sent to shells and to other
interpreters, and some other parts were
just comments, in English, or Portuguese,
or whatever... and in 1997 I started
to have dial-up internet at home,
and in 1999 I created a home page, and I
uploaded all these scripts and notes to it,
to my home page, because it was
good karma and it was a way to to become
a person who deserves
hints and help instead of
just being the idiot that I was
considered in my university because
I couldn't learn vi.
And at that point I was absolutely sure
that everybody was using Emacs like
that - that Emacs was made to be used with
elisp hyperlinks... and at one
point I sent an e-mail to one of the Emacs
mailing lists, and in the e-mail I used some
of the things that I used at home...
some elisp hyperlinks, and some other
tricks, and I explained how to use
everything there, and I apologized for
the ugly names... I said: I don't know what
are the standard functions that do that, so
I wrote my own ones... and I apologized for
choosing bad names for them. And Richard
Stallman himself answered, and his answer
was sort of: this looks interesting,
and as far as I know no one else is
using Emacs like this. Someone should
clean up the code and document it so
that we can include it in Emacs. Can you
do that? And, well this was amazing, it
was unbelievable, I was a no one in
the university, I was just an idiot, and
suddenly God spoke to me, and gave me a
mission. So I started to work to
make eev into an official package...
I submitted some code, and Stallman
answered very briefly... he had some
objections that I didn't
understand very well, they didn't make
much sense to me... and in the year 2000
I discovered that he was going to give a
talk in a city close to where I live. I
live in Rio de Janeiro, Brazil and he
was going to give a talk in Campinas,
that is just 500 kilometers away from
Rio de Janeiro... I went there, I
attended the talk, and I chatted with
Stallman after the talk. I mentioned
things about eev, and he remembered that
the discussion and the code, and he said
that "users should not be forced to see
Lisp". And then I was INCREDIBLY OFFENDED.
That was totally absurd. And Stallman
was so scared, so startled by my reaction,
that he walked away... and the thing is that
for me the ability to write one-liners in
Emacs Lisp was THE thing that
completely dissolved the barrier between
users and programmers... it was a kind of a
Philosopher's Stone that could turn
users into programmers almost
magically, it was a catalyst, and it was
the distilled essence of Free Software.
So it was absurd to say this, it was sick
to say that "users should not be forced
to see Lisp". Ok, so let me fast-forward
many years... in the year 2000 I had
"users should not be forced to see Lisp",
and also `M-x eev', that was one of
my ways of saving executable notes...
it was difficult to set up because users
that wanted to use it had to change
their rcfiles a bit... so very few people
were trying eev, and installing it and
using it... so let me fast-forward many
years to 2019. `M-x eev' is now obsolete,
now I used something called
`eepitch' instead... the setup is now
totally trivial, eev comes with lots of
sandboxed tutorials with names like
`find-something-intro', and I've been using
eev to teach Emacs and Free Software
principles to people who don't know
anything about programming or *NIX, that
are just kind of fascinated by the
idea of programming, but they know very
little... and now people can learn eev by
memorizing just three keys, or just two
because this third one is secondary...
`M-e' is for "execute", and `M-j' is for
"jump"... `M-k' runs a kind of "kill
this buffer", and sometimes can be used to go
back from a hyperlink...
And in April 10 eev finally became an ELPA
package - It finally became official
in some way...
and this new eev has lots of tutorials
with names like this:
`find-something-intro'
and when you install it with the
"beginner setup" and you start Emacs
in a certain way this starts Emacs
turning eev-mode on and it opens the
main tutorial, and if we type just `M-j'
without a numeric prefix you get
a page whose header is this... so it opens
a page with this header, and some
mysterious things below it...
this part of the header explains how to
run `M-j' with some of the main numeric
prefixes... so `M-5 M-j' goes to the
main tutorial, `M-2 M-j' goes to a kind of
a tutorial that is mainly an index of the
main keys of both eev and Emacs...
and we also have these three hyperlinks
here... this first one goes to the section
of the main tutorial that explains `M-j',
and this one goes to the section about
the eev keys in the tutorial about keys,
and this one goes the the first section
about Emacs keys in this tutorial that
works like an index of keys. And if
people follow this they can follow
hyperlinks that go to the pages
in the Emacs manuals... and they
usually learn very quickly how to
navigate these manuals, and how to go
back to the tutorials, and how to switch
between tutorials, other files, the
manuals, and so on...
Ok, let me show a demo.
I mentioned that `M-x eev' is now
obsolete, it has been replaced by
something that we run by just typing
f8, that always operates on the current
line and moves down.
Let me show an example of executable
notes and how to play them back.
I will only be able to explain how to
record these executable notes in
the other video - in the longer video.
Anyway, when I was recording this video I
realized that xpdf was behaving in a
very annoying way... it was
changing the page in moments that I
didn't want it to, and the problem was
that when my finger was at the right
side of the touchpad and I
moved it up or down this would be
interpreted as a "mousewheel scroll",
that would be interpreted
as PgUp or PgDn... and I wanted to
disable that. I wanted to disable the
support for mousewheel scroll in xpdf.
So I took a look at the man page for xpdf,
here... I didn't find a simple way to
change that by changing a configuration
file, but I found a section that described
all the default mouse bindings, here...
I found the line that seemed to be relevant,
this one... I created a hyperlink that
pointed directly to that line -
this one - and I also found an
explanation for what this function does.
And the explanation says that this function
either scrolls up by some pixels or it
moves to the previous page, which means
PgUp. So the quickest way to change xpdf -
because I was in a hurry - was by
downloading and recompiling the Debian
source with some changes.
I used this hyperlink here, that uses a
template to generate several links and
several shell commands for downloading
and recompiling a debian source package...
I copied these lines to my notes with
some small changes... and this part here
uses the alternative to `M-x eev'.
Remember that I said that my old way of
sending lines to the shell was by using
`M-x eev', that was very clumsy...
it needed several keystrokes, and
it was difficult to install because
we would need to change an rcfile. So
the new alternative to it uses just f8,
that behaves in one way in lines that
start with a red star, like these ones...
and in another way in lines that do not
start with a red star. Let me change
the font to a smaller one to show how it
works. If I type f8 in these three
lines here
this will set up a target buffer here
running a shell, and if I type f8 in
these lines here this will send these
commands to a shell. This command in
particular it downloads... sorry, it makes
sure that I have all the Debian packages
that I need to be able to compile the
source for xpdf, and this command here
downloads the source package
for xpdf, and unpacks it. It takes
a few seconds... here. I do not want
to execute this thing now... this thing
would recompile the source. So... this
hyperlink here opens this temporary
directory, and it turns out that the
source the source package was
unpacked in this subdirectory here...
so this hyperlink points to that
subdirectory, and this S-expression here
defines several shorter hyperlinks with
`find-xpdf' in their names, that operate
in this subdirectory here. So this
hyperlink here opens the directory,
this one here runs this shell
command in the directory to list all
the files... remember that I haven't
compiled anything yet, so all these files
belong to the source package...
and this one is much more interesting:
it runs a grep in that directory.
Remember that I
discovered that the name of the mouse
event that was bound to PgUp or...
to the _bad_ PgUp or to the bad PgDn was
mousePress4 - and mousePress5...
so this grep here searches for all the
occurrences of mousePress4 in the
source, and it shows that there are only
two occurrences: one of them in the
source for the manpage, and the other
one in the rendered version of
that source, which is not good...
let me change to a bigger font again. So I
decided to search for the function that
was associated to that mouse event - this
function here - and I found several
occurrences of that string, and it turned
out that this is the relevant occurrence...
so I created a direct link to that
source file, and I discovered that if I
commented out these lines by hand and
recompiled everything, and installed the
new debian binary package... then I would
get an xpdf that does not have the
annoying behavior. But... that's it. =)