WEBVTT
Kind: captions:
Language: en-GB

00:00:00.000 --> 00:00:02.000
Hi! My name is Eduardo Ochs.

00:00:02.000 --> 00:00:03.000
I'm this person here,

00:00:03.000 --> 00:00:06.000
and the title of this talk is:

00:00:06.000 --> 00:00:09.000
"On why most of the best features

00:00:09.000 --> 00:00:11.000
in eev look like 5-minute hacks".

00:00:11.000 --> 00:00:13.000
And this is a presentation at the

00:00:13.000 --> 00:00:15.000
EmacsConf 20202,

00:00:15.000 --> 00:00:18.000
happening in november 28 and 29.

00:00:18.000 --> 00:00:23.000
2020.

00:00:23.000 --> 00:00:25.000
So this is part one of the presentation,

00:00:25.000 --> 00:00:27.000
and here I'm going to explain some

00:00:27.000 --> 00:00:29.000
ideas that are prerequisites for

00:00:29.000 --> 00:00:31.000
understanding the rest of the

00:00:31.000 --> 00:00:32.000
presentation.

00:00:32.000 --> 00:00:35.000
The three main keys of eev are `M-e',

00:00:35.000 --> 00:00:37.000
`M-k' and `M-j', and I'm going to start by

00:00:37.000 --> 00:00:42.000
explaining `M-e' and `M-k'.

00:00:42.000 --> 00:00:44.000
`M-e' is used to follow a hyperlink, and

00:00:44.000 --> 00:00:46.000
technically it is

00:00:46.000 --> 00:00:49.000
essentially just a `C-e' to move to the

00:00:49.000 --> 00:00:51.000
end of the line and then a `C-x C-e'

00:00:51.000 --> 00:00:53.000
to execute the sexp before point

00:00:53.000 --> 00:00:58.000
at the end of the line...

00:00:58.000 --> 00:01:00.000
and the thing is that Emacs comes with

00:01:00.000 --> 00:01:03.000
many functions that can be used as sexp

00:01:03.000 --> 00:01:05.000
hyperlinks.

00:01:05.000 --> 00:01:06.000
We can consider that they "point" to

00:01:06.000 --> 00:01:09.000
somewhere. I'm going to refer to that as

00:01:09.000 --> 00:01:11.000
the "target" of the hyperlink, and if we

00:01:11.000 --> 00:01:12.000
execute these sexp hyperlinks we

00:01:12.000 --> 00:01:15.000
"go to" that target.

00:01:15.000 --> 00:01:17.000
For example, this one

00:01:17.000 --> 00:01:20.000
is a hyperlink that points to a buffer

00:01:20.000 --> 00:01:22.000
with the man page for cat,

00:01:22.000 --> 00:01:25.000
and usually, but not always, after

00:01:25.000 --> 00:01:26.000
following the hyperlink

00:01:26.000 --> 00:01:28.000
we can go back by just killing the

00:01:28.000 --> 00:01:29.000
current buffer...

00:01:29.000 --> 00:01:32.000
that the hyperlink created -

00:01:32.000 --> 00:01:34.000
the "target" of the hyperlink.

00:01:34.000 --> 00:01:36.000
But this example here is badly

00:01:36.000 --> 00:01:38.000
behaved.

00:01:38.000 --> 00:01:41.000
If we execute it it creates a new frame,

00:01:41.000 --> 00:01:43.000
and to go back to the previous situation

00:01:43.000 --> 00:01:44.000
we have to either

00:01:44.000 --> 00:01:54.000
click here or type `C-x 5 0'.

00:01:54.000 --> 00:01:57.000
So, here are some examples of sexp

00:01:57.000 --> 00:02:00.000
hyperlinks using standard Emacs functions.

00:02:00.000 --> 00:02:03.000
This third one is badly behaved in a

00:02:03.000 --> 00:02:04.000
different way.

00:02:04.000 --> 00:02:08.000
If we executed it the target is created

00:02:08.000 --> 00:02:09.000
in the same window

00:02:09.000 --> 00:02:13.000
as we are now, but it also shows a lot of

00:02:13.000 --> 00:02:16.000
garbage here in the echo area, so

00:02:16.000 --> 00:02:20.000
the current frame becomes a bit

00:02:20.000 --> 00:02:23.000
messy...

00:02:23.000 --> 00:02:26.000
and, well, one of the first things that I

00:02:26.000 --> 00:02:28.000
did when I was creating eev

00:02:28.000 --> 00:02:30.000
many many years ago was that I created

00:02:30.000 --> 00:02:31.000
variants

00:02:31.000 --> 00:02:34.000
of all these functions that were better

00:02:34.000 --> 00:02:36.000
behaved...

00:02:36.000 --> 00:02:38.000
and they were better behaved in two

00:02:38.000 --> 00:02:40.000
senses: the obvious one

00:02:40.000 --> 00:02:43.000
was that they all created the target

00:02:43.000 --> 00:02:45.000
in the same window as before, so I could

00:02:45.000 --> 00:02:48.000
go back by just typing `M-k',

00:02:48.000 --> 00:02:51.000
which essentially just killed this

00:02:51.000 --> 00:02:52.000
buffer...

00:02:52.000 --> 00:02:55.000
But I also implemented

00:02:55.000 --> 00:02:56.000
something extra, that are the

00:02:56.000 --> 00:02:58.000
"pos-spec-lists"... for example,

00:02:58.000 --> 00:03:00.000
these extra arguments here

00:03:00.000 --> 00:03:03.000
are a pos-spec-list,

00:03:03.000 --> 00:03:06.000
and these extra arguments specify

00:03:06.000 --> 00:03:09.000
a position in the target buffer.

00:03:09.000 --> 00:03:13.000
And in this example this pos-spec-list

00:03:13.000 --> 00:03:16.000
means: starting from the

00:03:16.000 --> 00:03:18.000
beginning of the buffer,

00:03:18.000 --> 00:03:20.000
search for the first occurrence of this

00:03:20.000 --> 00:03:22.000
string, "C-x C-e", after that -

00:03:22.000 --> 00:03:24.000
after the beginning of the buffer -

00:03:24.000 --> 00:03:26.000
and then search for the first occurrence

00:03:26.000 --> 00:03:29.000
of this string, "eval-last-sexp",

00:03:29.000 --> 00:03:33.000
after that.

00:03:33.000 --> 00:03:36.000
Eev also defines some hyperlinks that do

00:03:36.000 --> 00:03:38.000
not create new buffers.

00:03:38.000 --> 00:03:41.000
Here is the first example: if I execute

00:03:41.000 --> 00:03:45.000
this one... this one is a hyperlink to the

00:03:45.000 --> 00:03:47.000
result of running this shell command,

00:03:47.000 --> 00:03:50.000
"date"...

00:03:50.000 --> 00:03:52.000
but instead of showing the result in a

00:03:52.000 --> 00:03:54.000
new buffer the result is shown here...

00:03:54.000 --> 00:03:58.000
so if execute this hyperlink the result

00:03:58.000 --> 00:04:01.000
of "date"... the output of "date" is

00:04:01.000 --> 00:04:04.000
shown in the echo area, and if I execute

00:04:04.000 --> 00:04:07.000
it again

00:04:07.000 --> 00:04:09.000
it shows the result again, and the result

00:04:09.000 --> 00:04:11.000
changes every second.

00:04:11.000 --> 00:04:18.000
So this is a variant of `find-sh'...

00:04:18.000 --> 00:04:21.000
`find-sh0' is the variant that

00:04:21.000 --> 00:04:24.000
just shows the output in the echo area,

00:04:24.000 --> 00:04:28.000
and `find-sh' shows the output in

00:04:28.000 --> 00:04:31.000
a new buffer.

00:04:31.000 --> 00:04:35.000
And here is an example of a hyperlink

00:04:35.000 --> 00:04:37.000
that calls an external program.

00:04:37.000 --> 00:04:41.000
If I execute this it

00:04:41.000 --> 00:04:43.000
calls Google Chrome to open a

00:04:43.000 --> 00:04:46.000
certain URL.

00:04:46.000 --> 00:04:51.000
Here it is. Let's go back to Emacs...

00:04:51.000 --> 00:04:55.000
if execute this hyperlink here

00:04:55.000 --> 00:04:58.000
it invokes my favorite PDF viewer, which

00:04:58.000 --> 00:05:02.000
is xpdf... it makes xpdf

00:05:02.000 --> 00:05:07.000
open this PDF in this page...

00:05:07.000 --> 00:05:10.000
and these other arguments are ignored.

00:05:10.000 --> 00:05:15.000
Let me show how it works.

00:05:15.000 --> 00:05:19.000
Here it is. This is an excerpt from a

00:05:19.000 --> 00:05:22.000
book... so page 3 in the PDF corresponds

00:05:22.000 --> 00:05:26.000
to page 113 in the book... and

00:05:26.000 --> 00:05:29.000
this variant here of the hyperlink above...

00:05:29.000 --> 00:05:31.000
it opens the PDF in a different way.

00:05:31.000 --> 00:05:34.000
It runs a program called pdftotext on

00:05:34.000 --> 00:05:36.000
this PDF here,

00:05:36.000 --> 00:05:39.000
and Emacs takes the output of running

00:05:39.000 --> 00:05:42.000
pdftotext on this PDF here,

00:05:42.000 --> 00:05:46.000
and displays it in a buffer... and now this

00:05:46.000 --> 00:05:49.000
pos-spec-list is interpreted in a different

00:05:49.000 --> 00:05:51.000
way: this thing is interpreted as a

00:05:51.000 --> 00:05:53.000
number of a page... Emacs goes to page 3

00:05:53.000 --> 00:05:56.000
by counting formfeeds in the

00:05:56.000 --> 00:06:00.000
converted version of the PDF,

00:06:00.000 --> 00:06:02.000
and then it searches for this string

00:06:02.000 --> 00:06:04.000
and this string.

00:06:04.000 --> 00:06:06.000
So let's execute this to see what

00:06:06.000 --> 00:06:08.000
happens... here it is. It opened

00:06:08.000 --> 00:06:14.000
the same page as before...

00:06:14.000 --> 00:06:18.000
it starts with "Lecture I", so

00:06:18.000 --> 00:06:20.000
the other hyperlink searched for this

00:06:20.000 --> 00:06:25.000
string and for this string here.

00:06:25.000 --> 00:06:28.000
And this thing here is a hyperlink to

00:06:28.000 --> 00:06:29.000
a video.

00:06:29.000 --> 00:06:32.000
When I executed it it is going to open

00:06:32.000 --> 00:06:36.000
this video here, at this timestamp.

00:06:36.000 --> 00:06:39.000
Let's see... one, two, three...

00:06:39.000 --> 00:06:49.000
ONE, TWO, THREE! THAT'S THE WAY TO DO IT!

00:06:49.000 --> 00:06:52.000
And also some hyperlinks that I

00:06:52.000 --> 00:06:53.000
defined... hm,

00:06:53.000 --> 00:06:56.000
they don't work like usual hyperlinks,

00:06:56.000 --> 00:07:01.000
they work more like browser buttons,

00:07:01.000 --> 00:07:06.000
these buttons that appear in web pages...

00:07:06.000 --> 00:07:09.000
In the sense that these buttons usually

00:07:09.000 --> 00:07:11.000
don't open a new page, they usually

00:07:11.000 --> 00:07:13.000
just do something to change the current

00:07:13.000 --> 00:07:16.000
page. If I execute this,

00:07:16.000 --> 00:07:22.000
the action of this function, `eek' is to...

00:07:22.000 --> 00:07:24.000
it interprets this string as a series of

00:07:24.000 --> 00:07:26.000
keys, and it acts as if the user had typed

00:07:26.000 --> 00:07:30.000
all these keys, so...

00:07:30.000 --> 00:07:33.000
if I executed it I get a "HELLO!"

00:07:33.000 --> 00:07:34.000
in the next line, and if I execute it

00:07:34.000 --> 00:07:36.000
again I get another "HELLO!"

00:07:36.000 --> 00:07:39.000
another "HELLO!", another "HELLO!", etc...

00:07:39.000 --> 00:07:44.000
Let me undo this mess.

00:07:44.000 --> 00:07:47.000
And here is another kind of button,

00:07:47.000 --> 00:07:51.000
that defines a new function. If I execute

00:07:51.000 --> 00:07:54.000
this sexp here, `(o)'...

00:07:54.000 --> 00:07:55.000
at this moment the `o' is not defined,

00:07:55.000 --> 00:07:57.000
and if i execute this Emacs is going to

00:07:57.000 --> 00:08:00.000
show me a message saying

00:08:00.000 --> 00:08:03.000
"Symbol's function cell is not defined",

00:08:03.000 --> 00:08:05.000
something like this...

00:08:05.000 --> 00:08:09.000
but if I execute the `defun',

00:08:09.000 --> 00:08:12.000
the action of this function `o' here

00:08:12.000 --> 00:08:16.000
is to run this, which opens a certain

00:08:16.000 --> 00:08:18.000
directory...

00:08:18.000 --> 00:08:21.000
let me go back. And here is another

00:08:21.000 --> 00:08:23.000
button that defines

00:08:23.000 --> 00:08:25.000
several functions at the same time.

00:08:25.000 --> 00:08:32.000
If I execute this...

00:08:32.000 --> 00:08:35.000
note that the result of executing

00:08:35.000 --> 00:08:36.000
this expression, (code-c-d ...),

00:08:36.000 --> 00:08:38.000
is the name of one of the functions that

00:08:38.000 --> 00:08:40.000
it defined,

00:08:40.000 --> 00:08:43.000
that is this one here, and let me explain

00:08:43.000 --> 00:08:46.000
these examples. One of the functions

00:08:46.000 --> 00:08:48.000
that this thing here defined

00:08:48.000 --> 00:08:51.000
is called `find-orggitfile', where

00:08:51.000 --> 00:08:54.000
this "orggit" in the middle of its name

00:08:54.000 --> 00:08:56.000
is exactly this first argument

00:08:56.000 --> 00:08:59.000
to `code-c-d'...

00:08:59.000 --> 00:09:02.000
and the action of running

00:09:02.000 --> 00:09:04.000
`find-orggitfile' on a string like this

00:09:04.000 --> 00:09:06.000
is that `find-orggitfile' takes this string

00:09:06.000 --> 00:09:13.000
and prepends this string to it...

00:09:13.000 --> 00:09:15.000
this one here, which is the second

00:09:15.000 --> 00:09:17.000
argument to `code-c-d'...

00:09:17.000 --> 00:09:21.000
and then it executes `find-fline'

00:09:21.000 --> 00:09:25.000
on the result, which is this one...

00:09:25.000 --> 00:09:28.000
and `find-fline' is my variant of

00:09:28.000 --> 00:09:32.000
`find-file' that supports pos-spec-lists.

00:09:32.000 --> 00:09:36.000
And this function here, that I'm

00:09:36.000 --> 00:09:39.000
referring to as a "button", it also

00:09:39.000 --> 00:09:41.000
defines a function called

00:09:41.000 --> 00:09:44.000
`find-orggitnode' here, where the "orggit"

00:09:44.000 --> 00:09:46.000
is the same string as here,

00:09:46.000 --> 00:09:50.000
and this function opens a node

00:09:50.000 --> 00:09:54.000
of an info manual. This sexp here

00:09:54.000 --> 00:10:00.000
opens this node in the Org manual...

00:10:00.000 --> 00:10:03.000
it is equivalent to this sexp here...

00:10:03.000 --> 00:10:06.000
so in the passage from this line to this

00:10:06.000 --> 00:10:08.000
line we prepended to the node name

00:10:08.000 --> 00:10:12.000
the name of the manual - here...

00:10:12.000 --> 00:10:15.000
and `find-node' is my variant of this

00:10:15.000 --> 00:10:17.000
standard Emacs function here, `info',

00:10:17.000 --> 00:10:20.000
but `find-node' also supports

00:10:20.000 --> 00:10:23.000
pos-spec-lists.

00:10:23.000 --> 00:10:26.000
Eev also defines some functions that

00:10:26.000 --> 00:10:28.000
define shorter hyperlinks to PDFs and

00:10:28.000 --> 00:10:30.000
videos.

00:10:30.000 --> 00:10:32.000
Remember that this thing here is a

00:10:32.000 --> 00:10:34.000
shorter hyperlink to a

00:10:34.000 --> 00:10:37.000
to a file, and this thing here is a

00:10:37.000 --> 00:10:39.000
shorter hyperlink to a node in an

00:10:39.000 --> 00:10:43.000
Emacs manual... in an info manual.

00:10:43.000 --> 00:10:46.000
If we run this thing here - this

00:10:46.000 --> 00:10:47.000
`code-pdf-page'

00:10:47.000 --> 00:10:50.000
this acts like a button that defines a

00:10:50.000 --> 00:10:52.000
certain function,

00:10:52.000 --> 00:10:56.000
and this other sexp here

00:10:56.000 --> 00:10:58.000
defines another function. The first

00:10:58.000 --> 00:11:00.000
one defines the function

00:11:00.000 --> 00:11:03.000
`find-fongspivakpage', and

00:11:03.000 --> 00:11:05.000
the second one defines the function

00:11:05.000 --> 00:11:09.000
`find-fongspivaktext'. When we run

00:11:09.000 --> 00:11:13.000
`find-fongspivaktext' it opens

00:11:13.000 --> 00:11:17.000
this pdf here... the name is

00:11:17.000 --> 00:11:20.000
quite long...

00:11:20.000 --> 00:11:23.000
this example opens this pdf at page 8

00:11:23.000 --> 00:11:26.000
and searches for the string "Contents".

00:11:26.000 --> 00:11:28.000
Oops, sorry, in this case

00:11:28.000 --> 00:11:31.000
it just ignores this string

00:11:31.000 --> 00:11:33.000
here, it only considers

00:11:33.000 --> 00:11:37.000
the number of the page. Let's try.

00:11:37.000 --> 00:11:42.000
Aaaah!

00:11:42.000 --> 00:11:45.000
Here it is. The contents of a book

00:11:45.000 --> 00:11:48.000
that is freely available...

00:11:48.000 --> 00:11:51.000
here is another page of the book...

00:11:51.000 --> 00:11:55.000
and if we execute this hyperlink here,

00:11:55.000 --> 00:11:58.000
`find-fongspivaktext', it converts the

00:11:58.000 --> 00:12:00.000
PDF to text and it searches

00:12:00.000 --> 00:12:03.000
for the page 8 in it, and then

00:12:03.000 --> 00:12:05.000
for the string... this

00:12:05.000 --> 00:12:08.000
string here in page 8.

00:12:08.000 --> 00:12:12.000
It takes a few seconds...

00:12:12.000 --> 00:12:16.000
here it is. So this is the

00:12:16.000 --> 00:12:20.000
ascii version of this "Contents" page

00:12:20.000 --> 00:12:25.000
here. Note that this block here

00:12:25.000 --> 00:12:28.000
is a kind of an index to that book...

00:12:28.000 --> 00:12:31.000
I have the full index somewhere, but

00:12:31.000 --> 00:12:33.000
it's very long, so I just copied a few

00:12:33.000 --> 00:12:34.000
lines here...

00:12:34.000 --> 00:12:38.000
so this is a link to the

00:12:38.000 --> 00:12:41.000
Section 1, oops, Chapter 1...

00:12:41.000 --> 00:12:45.000
this is the section 1.1,

00:12:45.000 --> 00:12:48.000
section 1.1.1, and so on...

00:12:48.000 --> 00:12:54.000
and here is a link to the index,

00:12:54.000 --> 00:12:58.000
And here is a part of my index

00:12:58.000 --> 00:13:02.000
of positions in the video that we just

00:13:02.000 --> 00:13:05.000
saw that i think that are especially

00:13:05.000 --> 00:13:07.000
relevant.

00:13:07.000 --> 00:13:10.000
So this

00:13:10.000 --> 00:13:12.000
hyperlink is a kind of a button that

00:13:12.000 --> 00:13:14.000
defines this function here,

00:13:14.000 --> 00:13:27.000
`find-punchandjudyvideo'... let's try.

00:13:27.000 --> 00:13:31.000
And we can also use this for video

00:13:31.000 --> 00:13:33.000
tutorials. For example,

00:13:33.000 --> 00:13:37.000
this is a very good tutorial on magit.

00:13:37.000 --> 00:13:40.000
if we execute this

00:13:40.000 --> 00:13:42.000
then these functions are going to be

00:13:42.000 --> 00:13:44.000
defined, and these functions open

00:13:44.000 --> 00:13:48.000
this tutorial on magit, and

00:13:48.000 --> 00:13:50.000
these are some of the positions in the

00:13:50.000 --> 00:13:51.000
tutorial that I found especially

00:13:51.000 --> 00:13:53.000
relevant. This is a very dense

00:13:53.000 --> 00:13:55.000
tutorial, I had to take notes of

00:13:55.000 --> 00:13:56.000
everything,

00:13:56.000 --> 00:13:58.000
and I had to watch everything

00:13:58.000 --> 00:14:00.000
several times...

00:14:00.000 --> 00:14:03.000
and for example, this is a link to the

00:14:03.000 --> 00:14:06.000
position in the tutorial that explains

00:14:06.000 --> 00:14:12.000
how in Spacemacs magit

00:14:12.000 --> 00:14:17.000
interprets `SPC g s' as `magit-status'.

00:14:17.000 --> 00:14:25.000
let's see...

00:14:25.000 --> 00:14:28.000
and here are some examples that I

00:14:28.000 --> 00:14:32.000
took from somewhere else... the video

00:14:32.000 --> 00:14:34.000
tutorials from

00:14:34.000 --> 00:14:43.000
Ralph Koenig about Org mode.

00:14:43.000 --> 00:14:45.000
Now let me show how the functions that

00:14:45.000 --> 00:14:47.000
define these shorter hyperlinks are

00:14:47.000 --> 00:14:48.000
implemented.

00:14:48.000 --> 00:14:51.000
The standard way in Emacs to define

00:14:51.000 --> 00:14:52.000
functions that define

00:14:52.000 --> 00:14:55.000
other functions would be with macros.

00:14:55.000 --> 00:14:58.000
Let's see an example. This is a standard

00:14:58.000 --> 00:14:59.000
function that

00:14:59.000 --> 00:15:02.000
defines new functions...

00:15:02.000 --> 00:15:06.000
and if we execute it

00:15:06.000 --> 00:15:09.000
its result is the last function that it

00:15:09.000 --> 00:15:10.000
defined, which is `ee-glyph',

00:15:10.000 --> 00:15:13.000
which is here...

00:15:13.000 --> 00:15:16.000
it's implemented as a macro, we can

00:15:16.000 --> 00:15:19.000
look at the result of `macro-expand',

00:15:19.000 --> 00:15:21.000
which is going to show us the result

00:15:21.000 --> 00:15:25.000
of the expansion of this...

00:15:25.000 --> 00:15:28.000
instead of expanding and executing it

00:15:28.000 --> 00:15:33.000
expands and shows us the result.

00:15:33.000 --> 00:15:36.000
Here - the result is a bit messy,

00:15:36.000 --> 00:15:37.000
it is too big for

00:15:37.000 --> 00:15:40.000
humans to understand, but we can run

00:15:40.000 --> 00:15:44.000
this other sexp here, that takes that

00:15:44.000 --> 00:15:47.000
result and pretty-prints it.

00:15:47.000 --> 00:15:50.000
So this is the pretty-printed version of

00:15:50.000 --> 00:15:54.000
this macro here.

00:15:54.000 --> 00:15:57.000
We can see that it defines

00:15:57.000 --> 00:16:01.000
several functions here...

00:16:01.000 --> 00:16:06.000
For example, this one...

00:16:06.000 --> 00:16:09.000
and this, just as a curiosity, is a link

00:16:09.000 --> 00:16:13.000
to the definition of `cl-defstruct'...

00:16:13.000 --> 00:16:16.000
and note that the code is huge...

00:16:16.000 --> 00:16:19.000
well, it's very well commented,

00:16:19.000 --> 00:16:23.000
but it has lots of special cases,

00:16:23.000 --> 00:16:26.000
it supports lots of constructions...

00:16:26.000 --> 00:16:27.000
and so it's huge and it's very difficult

00:16:27.000 --> 00:16:30.000
to understand. I mean,

00:16:30.000 --> 00:16:33.000
I found it very difficult to understand.

00:16:33.000 --> 00:16:35.000
And here's a link to the documentation

00:16:35.000 --> 00:16:37.000
of `cl-defstruct'...

00:16:37.000 --> 00:16:42.000
here in the manual for `cl',

00:16:42.000 --> 00:16:46.000
which is a kind of support for some

00:16:46.000 --> 00:16:50.000
features of Common Lisp in Emacs.

00:16:50.000 --> 00:16:53.000
So let's compare this standard way of

00:16:53.000 --> 00:16:54.000
defining

00:16:54.000 --> 00:16:56.000
functions that define new functions,

00:16:56.000 --> 00:16:58.000
which is with macros...

00:16:58.000 --> 00:17:01.000
with this. I'm going to use a slogan

00:17:01.000 --> 00:17:04.000
repeatedly - the slogan is

00:17:04.000 --> 00:17:06.000
"I am a very bad programmer".

00:17:06.000 --> 00:17:08.000
I'm a very bad programmer, so when i was

00:17:08.000 --> 00:17:10.000
trying to create functions that would

00:17:10.000 --> 00:17:12.000
define new functions

00:17:12.000 --> 00:17:14.000
I found it easier to generate

00:17:14.000 --> 00:17:16.000
Lisp code as text

00:17:16.000 --> 00:17:20.000
and then run `read' and `eval' in it.

00:17:20.000 --> 00:17:23.000
The `code-c-d' that we saw in the

00:17:23.000 --> 00:17:24.000
previous section

00:17:24.000 --> 00:17:28.000
we can see the the code that it produces

00:17:28.000 --> 00:17:31.000
by making a copy of this line and

00:17:31.000 --> 00:17:33.000
prepending this string here, "find-",

00:17:33.000 --> 00:17:34.000
to the name of the function...

00:17:34.000 --> 00:17:36.000
so instead of running `code-c-d' we run

00:17:36.000 --> 00:17:38.000
`find-code-c-d',

00:17:38.000 --> 00:17:41.000
and it creates a new temporary buffer

00:17:41.000 --> 00:17:44.000
with the code that

00:17:44.000 --> 00:17:47.000
`code-c-d' would execute.

00:17:47.000 --> 00:17:50.000
So it's a series of `defun's and a few

00:17:50.000 --> 00:17:55.000
`setq's... and this thing is implemented

00:17:55.000 --> 00:17:59.000
mostly as a template. The low-level...

00:17:59.000 --> 00:18:04.000
there's an inner function called

00:18:04.000 --> 00:18:06.000
`ee-code-c-d-base' that receives just

00:18:06.000 --> 00:18:09.000
these two arguments, and it essentially

00:18:09.000 --> 00:18:10.000
just runs the function `ee-template0'

00:18:10.000 --> 00:18:14.000
on this string here, and

00:18:14.000 --> 00:18:16.000
the things between curly braces are

00:18:16.000 --> 00:18:18.000
substituted by the values

00:18:18.000 --> 00:18:23.000
of these arguments - here.

00:18:23.000 --> 00:18:25.000
There's one part of the tutorial - here -

00:18:25.000 --> 00:18:28.000
that explains all these things,

00:18:28.000 --> 00:18:31.000
except for the rationale for some

00:18:31.000 --> 00:18:32.000
design decisions...

00:18:32.000 --> 00:18:35.000
and those design decisions are one of

00:18:35.000 --> 00:18:37.000
the many motivations for this talk,

00:18:37.000 --> 00:18:39.000
but I'm only going to explain these

00:18:39.000 --> 00:18:42.000
things in detail at the end -

00:18:42.000 --> 00:18:48.000
which is kind of soon. =)

00:18:48.000 --> 00:18:50.000
In the beginning I said that the three

00:18:50.000 --> 00:18:51.000
main keys of eev

00:18:51.000 --> 00:18:56.000
are `M-e', `M-k' and `M-j'...

00:18:56.000 --> 00:19:00.000
let's see now what `M-j' does.

00:19:00.000 --> 00:19:01.000
But I need to start with some

00:19:01.000 --> 00:19:03.000
motivation.

00:19:03.000 --> 00:19:05.000
The motivation is that we can define

00:19:05.000 --> 00:19:07.000
commands with very short names, and

00:19:07.000 --> 00:19:09.000
actually I became kind of addicted to

00:19:09.000 --> 00:19:10.000
that...

00:19:10.000 --> 00:19:13.000
this is an example of `defun' that

00:19:13.000 --> 00:19:15.000
defines a command with a very short name.

00:19:15.000 --> 00:19:18.000
Its name is just one letter, `e',

00:19:18.000 --> 00:19:21.000
and I can invoke it with `M-x e'.

00:19:21.000 --> 00:19:24.000
If I type `M-x e' now

00:19:24.000 --> 00:19:27.000
it opens a LaTeX file that I'm

00:19:27.000 --> 00:19:32.000
working on,

00:19:32.000 --> 00:19:35.000
and I create most of my LaTeX files

00:19:35.000 --> 00:19:39.000
using template-based functions, like

00:19:39.000 --> 00:19:43.000
the implementation of `code-c-d' above...

00:19:43.000 --> 00:19:46.000
and these template-based functions create

00:19:46.000 --> 00:19:49.000
files with the extension .tex

00:19:49.000 --> 00:19:51.000
that start with a series of `defun's

00:19:51.000 --> 00:19:53.000
in comments. For example...

00:19:53.000 --> 00:19:56.000
Let's look at this example here. If I

00:19:56.000 --> 00:19:58.000
execute `find-latex-links' with this

00:19:58.000 --> 00:20:02.000
argument, it's going to do several

00:20:02.000 --> 00:20:03.000
things for creating a file called

00:20:03.000 --> 00:20:08.000
"/tmp/foo.tex"...

00:20:08.000 --> 00:20:11.000
and the header of that file is going to

00:20:11.000 --> 00:20:16.000
be this, which starts with three `defun's

00:20:16.000 --> 00:20:19.000
with functions with very short

00:20:19.000 --> 00:20:21.000
names in comments.

00:20:21.000 --> 00:20:27.000
Let's compare with the situation here...

00:20:27.000 --> 00:20:32.000
in my file "2020favorite-conventions.tex"

00:20:32.000 --> 00:20:34.000
I have this header here, in which I

00:20:34.000 --> 00:20:37.000
define six functions with very short

00:20:37.000 --> 00:20:39.000
names...

00:20:39.000 --> 00:20:41.000
and in this case here, that is even

00:20:41.000 --> 00:20:43.000
explained in the tutorial...

00:20:43.000 --> 00:20:48.000
we have mnemonics for these short names here:

00:20:48.000 --> 00:20:51.000
`c' is "compile", `d' is "display",

00:20:51.000 --> 00:20:54.000
I mean, display the PDF...

00:20:54.000 --> 00:20:57.000
and `e' is "edit", in the sense of:

00:20:57.000 --> 00:21:02.000
make Emacs visit that file.

00:21:02.000 --> 00:21:05.000
Okay, now I can explain what is `M-j'

00:21:05.000 --> 00:21:07.000
itself. We just saw command with

00:21:07.000 --> 00:21:09.000
very short _names_, and the idea

00:21:09.000 --> 00:21:12.000
behind `M-j' is that we

00:21:12.000 --> 00:21:14.000
can define commands with very short

00:21:14.000 --> 00:21:16.000
_numbers_.

00:21:16.000 --> 00:21:19.000
Let me explain this.

00:21:19.000 --> 00:21:22.000
The short explanation for what `M-j' does

00:21:22.000 --> 00:21:25.000
is that it jumps to certain

00:21:25.000 --> 00:21:26.000
predefined places...

00:21:26.000 --> 00:21:29.000
in particular a `M-j' without a numeric

00:21:29.000 --> 00:21:31.000
argument takes us to a buffer with

00:21:31.000 --> 00:21:34.000
the basic help and the list of

00:21:34.000 --> 00:21:37.000
the current eejump targets...

00:21:37.000 --> 00:21:39.000
and this is something that is a bit

00:21:39.000 --> 00:21:41.000
simpler to understand:

00:21:41.000 --> 00:21:44.000
if we type `M-5 M-j' then `M-j' runs

00:21:44.000 --> 00:21:47.000
this sexp here, (find-eev-quick-intro),

00:21:47.000 --> 00:21:51.000
that is associated to

00:21:51.000 --> 00:21:55.000
the argument 5... I say that the target

00:21:55.000 --> 00:21:59.000
for the argument 5 is this one.

00:21:59.000 --> 00:22:01.000
And if the argument is 2 then the

00:22:01.000 --> 00:22:03.000
target associated to the 2 is this

00:22:03.000 --> 00:22:07.000
sexp here, that opens...

00:22:07.000 --> 00:22:09.000
well, this one opens the main tutorial of

00:22:09.000 --> 00:22:13.000
eev, and this one opens another tutorial.

00:22:13.000 --> 00:22:15.000
This is a link to one of the tutorials

00:22:15.000 --> 00:22:20.000
of eev, to the part that explains `M-j'...

00:22:20.000 --> 00:22:22.000
I've copied the the main part of the

00:22:22.000 --> 00:22:24.000
text here.

00:22:24.000 --> 00:22:28.000
The header - the header that `M-j' shows;

00:22:28.000 --> 00:22:31.000
let me show it very quickly...

00:22:31.000 --> 00:22:36.000
here is the header and here is the rest -

00:22:36.000 --> 00:22:39.000
the header is very beginner friendly, and

00:22:39.000 --> 00:22:40.000
if you're a beginner who only knows how to

00:22:40.000 --> 00:22:48.000
`M-e' to execute and `M-k' to go back,

00:22:48.000 --> 00:22:52.000
then you can, and should, use that header...

00:22:52.000 --> 00:22:56.000
I mean this header here -

00:22:56.000 --> 00:22:59.000
as your main starting point, and every

00:22:59.000 --> 00:23:00.000
time that you feel lost

00:23:00.000 --> 00:23:03.000
you can type `M-j' and to go back to

00:23:03.000 --> 00:23:04.000
that header...

00:23:04.000 --> 00:23:07.000
and you can use its links to navigate to

00:23:07.000 --> 00:23:09.000
the documentation for Emacs and eev.

00:23:09.000 --> 00:23:11.000
Let me explain that.

00:23:11.000 --> 00:23:14.000
This header here has several elisp

00:23:14.000 --> 00:23:15.000
hyperlinks...

00:23:15.000 --> 00:23:19.000
one here, one here,

00:23:19.000 --> 00:23:22.000
one here, one here, and so on...

00:23:22.000 --> 00:23:25.000
these ones are links to the "intro"s,

00:23:25.000 --> 00:23:29.000
which are the tutorials...

00:23:29.000 --> 00:23:30.000
(find-eev-quick-intro) is the main

00:23:30.000 --> 00:23:32.000
tutorial, and (find-eev-keys-intro)

00:23:32.000 --> 00:23:35.000
is a kind of tutorial that is

00:23:35.000 --> 00:23:40.000
an index of the main keys...

00:23:40.000 --> 00:23:42.000
and after that we have an explanation of

00:23:42.000 --> 00:23:45.000
what some numeric prefixes do...

00:23:45.000 --> 00:23:48.000
so if we type `M-1 M-j' the effect of that

00:23:48.000 --> 00:23:52.000
is exactly the same as executing this,

00:23:52.000 --> 00:24:00.000
and we can execute this with `M-e' also.

00:24:00.000 --> 00:24:03.000
`M-2 M-j' runs this sexp,

00:24:03.000 --> 00:24:06.000
I can also execute it with `M-e'...

00:24:06.000 --> 00:24:14.000
here it is, it's this intro, this

00:24:14.000 --> 00:24:18.000
sandboxed tutorial... and

00:24:18.000 --> 00:24:24.000
here is another sandboxed tutorial.

00:24:24.000 --> 00:24:27.000
Let me go back... and then the

00:24:27.000 --> 00:24:30.000
documentation says that that header -

00:24:30.000 --> 00:24:31.000
the header that is beginner-friendly -

00:24:31.000 --> 00:24:33.000
is followed by a section that is very

00:24:33.000 --> 00:24:35.000
beginner UN-friendly,

00:24:35.000 --> 00:24:37.000
that contains a series of `defun's like

00:24:37.000 --> 00:24:40.000
these ones, here...

00:24:40.000 --> 00:24:43.000
the last line of the header is this

00:24:43.000 --> 00:24:45.000
comment here, and then we have

00:24:45.000 --> 00:24:48.000
several `defun's like this.

00:24:48.000 --> 00:24:51.000
Let me explain how these things work.

00:24:51.000 --> 00:24:53.000
Technically, what happens when we type

00:24:53.000 --> 00:24:57.000
`M-j' without any arguments is that it

00:24:57.000 --> 00:25:00.000
runs `eejump' with the argument nil,

00:25:00.000 --> 00:25:04.000
and then this runs `find-eejumps'.

00:25:04.000 --> 00:25:06.000
When I run `M-j' with a numeric

00:25:06.000 --> 00:25:08.000
argument, for example

00:25:08.000 --> 00:25:11.000
with argument 5, it runs (eejump 5),

00:25:11.000 --> 00:25:17.000
and (eejump 5) concatenates this 5

00:25:17.000 --> 00:25:20.000
to make a name of a function - this

00:25:20.000 --> 00:25:21.000
function here...

00:25:21.000 --> 00:25:24.000
and it executes this function,

00:25:24.000 --> 00:25:31.000
`eejump-5'... and (eejump-5)

00:25:31.000 --> 00:25:35.000
executes (find-eev-quick-intro).

00:25:35.000 --> 00:25:39.000
If I execute just `M-j'

00:25:39.000 --> 00:25:41.000
this section that shows the current

00:25:41.000 --> 00:25:43.000
eejump targets

00:25:43.000 --> 00:25:47.000
has a line for eejump-5, this is

00:25:47.000 --> 00:25:52.000
exactly the thing that I was explaining

00:25:52.000 --> 00:25:54.000
before. So we can use `M-j' to navigate

00:25:54.000 --> 00:25:59.000
the tutorials, and we can copy

00:25:59.000 --> 00:26:07.000
links to the tutorials to our notes...

00:26:07.000 --> 00:26:11.000
oh, sorry this has some typos...

00:26:11.000 --> 00:26:14.000
for example, if I execute this

00:26:14.000 --> 00:26:18.000
I go to a section of this tutorial here

00:26:18.000 --> 00:26:20.000
that explains the main keys of eev,

00:26:20.000 --> 00:26:24.000
and these things are hyperlinks... I can

00:26:24.000 --> 00:26:26.000
mark a hyperlink like this, it is just

00:26:26.000 --> 00:26:27.000
plain text, and I can copy it to my notes...

00:26:27.000 --> 00:26:31.000
and the idea is that every time

00:26:31.000 --> 00:26:33.000
that I find something that is

00:26:33.000 --> 00:26:35.000
interesting I can create a hyperlink to

00:26:35.000 --> 00:26:38.000
it, and i can put these links in my notes,

00:26:38.000 --> 00:26:40.000
so I can navigate back

00:26:40.000 --> 00:26:42.000
to all the interesting positions

00:26:42.000 --> 00:26:48.000
very quickly.

00:26:48.000 --> 00:26:51.000
Ok, next feature; if we type

00:26:51.000 --> 00:26:58.000
`M-J' (meta-uppercase-j), then...

00:26:58.000 --> 00:27:00.000
this is a function that transforms the

00:27:00.000 --> 00:27:03.000
current line in a certain way.

00:27:03.000 --> 00:27:06.000
Let me give an example. Let me isolate

00:27:06.000 --> 00:27:07.000
this, and let me duplicate

00:27:07.000 --> 00:27:11.000
this line to make clear what happens.

00:27:11.000 --> 00:27:14.000
If I type `M-J' here

00:27:14.000 --> 00:27:16.000
this line here becomes a `defun' for

00:27:16.000 --> 00:27:20.000
`ee-jump6', and the target of this

00:27:20.000 --> 00:27:24.000
eejump is exactly this sexp here.

00:27:24.000 --> 00:27:28.000
Let me undo this mess.

00:27:28.000 --> 00:27:31.000
And if the first word in the line is not

00:27:31.000 --> 00:27:32.000
a number - for example, here...

00:27:32.000 --> 00:27:36.000
let me do the same thing,

00:27:36.000 --> 00:27:41.000
duplicate the line and type `M-J'...

00:27:41.000 --> 00:27:44.000
then `M-J' converts that to a defun

00:27:44.000 --> 00:27:46.000
that defines a function with a very

00:27:46.000 --> 00:27:49.000
short name,

00:27:49.000 --> 00:27:52.000
and this function with a very short name

00:27:52.000 --> 00:27:56.000
opens this file here, in the directory

00:27:56.000 --> 00:27:59.000
with the copy of the the git repository

00:27:59.000 --> 00:28:01.000
for Org mode.

00:28:01.000 --> 00:28:14.000
Let me undo the mess again.

00:28:14.000 --> 00:28:17.000
`M-J' is a particular case

00:28:17.000 --> 00:28:21.000
of something that I use a lot in eev.

00:28:21.000 --> 00:28:28.000
Eev has lots of key sequences

00:28:28.000 --> 00:28:33.000
that are like meta-uppercaseletter, and

00:28:33.000 --> 00:28:35.000
almost all of them operate on the

00:28:35.000 --> 00:28:37.000
current line, and transform the current

00:28:37.000 --> 00:28:38.000
line in a certain way.

00:28:38.000 --> 00:28:42.000
For example, this is a file name,

00:28:42.000 --> 00:28:45.000
and if I type `M-F' here

00:28:45.000 --> 00:28:48.000
it becomes a link to that file...

00:28:48.000 --> 00:28:50.000
this is the name of a manpage,

00:28:50.000 --> 00:28:53.000
and if I type `M-M' here

00:28:53.000 --> 00:28:55.000
it converts that to a link to a manpage,

00:28:55.000 --> 00:28:58.000
and this is a shell command,

00:28:58.000 --> 00:29:01.000
and if i type `M-S' here

00:29:01.000 --> 00:29:04.000
it converts that to a link to a

00:29:04.000 --> 00:29:08.000
to `find-sh'...

00:29:08.000 --> 00:29:11.000
and until a few years ago these

00:29:11.000 --> 00:29:12.000
functions with meta-uppercaseletter

00:29:12.000 --> 00:29:16.000
were half of my main ways

00:29:16.000 --> 00:29:18.000
of creating sexps

00:29:18.000 --> 00:29:21.000
with few key strokes. In the beginning, of

00:29:21.000 --> 00:29:22.000
course, I had to create my

00:29:22.000 --> 00:29:25.000
sexp hyperlinks by typing each character,

00:29:25.000 --> 00:29:28.000
but after some time I decided that

00:29:28.000 --> 00:29:31.000
i needed something more efficient.

00:29:31.000 --> 00:29:34.000
So this is the end of Part 1 of the

00:29:34.000 --> 00:29:38.000
presentation.

00:29:38.000 --> 00:29:40.000
So, this is Part 2 of the presentation,

00:29:40.000 --> 00:29:41.000
and the main theme here

00:29:41.000 --> 00:29:44.000
is the standard `describe-key'

00:29:44.000 --> 00:29:46.000
function that comes with Emacs,

00:29:46.000 --> 00:29:49.000
and my variant of it. The thing is that

00:29:49.000 --> 00:29:50.000
the standard `describe-key' in Emacs

00:29:50.000 --> 00:29:53.000
is user friendly but it is

00:29:53.000 --> 00:29:55.000
hacker-unfriendly... well, I felt so,

00:29:55.000 --> 00:29:58.000
and when I tried to complement it by

00:29:58.000 --> 00:30:00.000
writing a hacker-friendly version of it

00:30:00.000 --> 00:30:03.000
that produced the sexp hyperlinks that I

00:30:03.000 --> 00:30:05.000
needed I got something that I found really

00:30:05.000 --> 00:30:07.000
lovely, and

00:30:07.000 --> 00:30:09.000
several of the main designs decisions

00:30:09.000 --> 00:30:12.000
of eev can be seen there...

00:30:12.000 --> 00:30:14.000
but when I showed my variants to other

00:30:14.000 --> 00:30:15.000
people they hated it -

00:30:15.000 --> 00:30:17.000
they felt that it was totally against

00:30:17.000 --> 00:30:19.000
their notions of

00:30:19.000 --> 00:30:23.000
user-friendliness.

00:30:23.000 --> 00:30:25.000
Ok, so let's see the standard

00:30:25.000 --> 00:30:26.000
`describe-key'. If I run

00:30:26.000 --> 00:30:30.000
this hyperlink here I get

00:30:30.000 --> 00:30:32.000
the result of running `describe-key'

00:30:32.000 --> 00:30:34.000
on the key &lt;down&gt;...

00:30:34.000 --> 00:30:36.000
and this is a big buffer with some

00:30:36.000 --> 00:30:38.000
things in italics,

00:30:38.000 --> 00:30:41.000
and some hyperlinks - here. These

00:30:41.000 --> 00:30:43.000
hyperlinks are standard, in the sense that

00:30:43.000 --> 00:30:46.000
their targets are not visible and they are

00:30:46.000 --> 00:30:47.000
implemented using buttons in Emacs Lisp.

00:30:47.000 --> 00:30:51.000
This section of the Emacs manual describes

00:30:51.000 --> 00:30:56.000
how buttons work,

00:30:56.000 --> 00:31:00.000
and the the source code is

00:31:00.000 --> 00:31:03.000
quite difficult... I mean, when I was

00:31:03.000 --> 00:31:06.000
starting to try to decipher this,

00:31:06.000 --> 00:31:07.000
when I was a beginner using Emacs 19.34

00:31:07.000 --> 00:31:12.000
I felt that this `describe-key' was

00:31:12.000 --> 00:31:15.000
very difficult to understand,

00:31:15.000 --> 00:31:20.000
and I felt that the the people who wrote it

00:31:20.000 --> 00:31:23.000
were sacrificing too much of the

00:31:23.000 --> 00:31:26.000
hacker-friendliness that I was expecting

00:31:26.000 --> 00:31:31.000
from it to make it beginner-friendly.

00:31:31.000 --> 00:31:33.000
Let me explain what are the the problems

00:31:33.000 --> 00:31:35.000
with the standard `describe-key'.

00:31:35.000 --> 00:31:37.000
If we think that hyperlinks

00:31:37.000 --> 00:31:38.000
are things like this,

00:31:38.000 --> 00:31:41.000
with the TARGET and the TEXT, then in the

00:31:41.000 --> 00:31:43.000
button-hyperlinks of `describe-key'

00:31:43.000 --> 00:31:47.000
these three bad things happen. First;

00:31:47.000 --> 00:31:49.000
it is hard to extract the target from

00:31:49.000 --> 00:31:51.000
the hyperlink. Second: it is hard to

00:31:51.000 --> 00:31:55.000
recreate Lisp code that would go to that

00:31:55.000 --> 00:31:57.000
target, and third: it is hard to copy the

00:31:57.000 --> 00:31:59.000
full hyperlink, including the target,

00:31:59.000 --> 00:32:01.000
to other buffers -

00:32:01.000 --> 00:32:04.000
I already knew how to copy the text.

00:32:04.000 --> 00:32:07.000
When I was trying to decipher what

00:32:07.000 --> 00:32:09.000
`describe-key' was doing

00:32:09.000 --> 00:32:11.000
I created lots of hyperlinks like this

00:32:11.000 --> 00:32:14.000
to inspect the text properties and

00:32:14.000 --> 00:32:16.000
things like that...

00:32:16.000 --> 00:32:18.000
for example, in the description of the

00:32:18.000 --> 00:32:20.000
key &lt;down&gt;, here...

00:32:20.000 --> 00:32:23.000
we have a button that points to

00:32:23.000 --> 00:32:26.000
simple.el...

00:32:26.000 --> 00:32:29.000
the text of that button is "simple.el",

00:32:29.000 --> 00:32:33.000
this hyperlink goes to the middle of this

00:32:33.000 --> 00:32:35.000
button-hyperlink here,

00:32:35.000 --> 00:32:39.000
this hyperlink here goes to the middle

00:32:39.000 --> 00:32:43.000
of this button-hyperlink and then inspects

00:32:43.000 --> 00:32:47.000
its text properties, and then goes to

00:32:47.000 --> 00:32:51.000
this section here of the description...

00:32:51.000 --> 00:32:53.000
so this is a high-level description of

00:32:53.000 --> 00:32:56.000
the text properties... I mean,

00:32:56.000 --> 00:32:58.000
the text properties that make it

00:32:58.000 --> 00:32:59.000
a button... and this is a

00:32:59.000 --> 00:33:02.000
lower-level description of these text

00:33:02.000 --> 00:33:04.000
properties.

00:33:04.000 --> 00:33:12.000
And the button whose text

00:33:12.000 --> 00:33:14.000
is "forward line", this one,

00:33:14.000 --> 00:33:16.000
is slightly different...

00:33:16.000 --> 00:33:19.000
this hyperlink here goes to the middle

00:33:19.000 --> 00:33:21.000
of that button,

00:33:21.000 --> 00:33:24.000
and this hyperlink goes to the middle

00:33:24.000 --> 00:33:25.000
of that button, inspects its

00:33:25.000 --> 00:33:28.000
text properties, and goes to

00:33:28.000 --> 00:33:32.000
the section of this help,

00:33:32.000 --> 00:33:35.000
uh, buffer, here that describe the the

00:33:35.000 --> 00:33:37.000
button and the lower-level view

00:33:37.000 --> 00:33:41.000
of the text properties.

00:33:41.000 --> 00:33:45.000
So, I started with things like these to

00:33:45.000 --> 00:33:48.000
understand what these buttons were doing,

00:33:48.000 --> 00:33:50.000
and I was able to figure out how these

00:33:50.000 --> 00:33:52.000
things are implemented, and `describe-key',

00:33:52.000 --> 00:33:55.000
and similar help functions in Emacs...

00:33:55.000 --> 00:33:57.000
and I discovered that one of the main

00:33:57.000 --> 00:34:00.000
lower-level functions that Emacs used

00:34:00.000 --> 00:34:02.000
for this is a function called

00:34:02.000 --> 00:34:05.000
`find-function-noselect'...

00:34:05.000 --> 00:34:08.000
if I run `find-function-noselect' on

00:34:08.000 --> 00:34:14.000
'next-line, it returns a pair...

00:34:14.000 --> 00:34:18.000
a cons made of a buffer and a position.

00:34:18.000 --> 00:34:21.000
So I created functions that would

00:34:21.000 --> 00:34:25.000
follow this, that would open that buffer

00:34:25.000 --> 00:34:28.000
in that position, and then this is a

00:34:28.000 --> 00:34:29.000
pos-spec-list...

00:34:29.000 --> 00:34:31.000
so we could go to these positions and

00:34:31.000 --> 00:34:33.000
then search for this string, and another

00:34:33.000 --> 00:34:36.000
string, and another string, and so on...

00:34:36.000 --> 00:34:40.000
so this goes to the definition of

00:34:40.000 --> 00:34:44.000
`function-efunction' and then to a

00:34:44.000 --> 00:34:47.000
string after it, and I use these things to

00:34:47.000 --> 00:34:49.000
implement my own functions

00:34:49.000 --> 00:34:52.000
 that pointed to the same targets as the

00:34:52.000 --> 00:34:59.000
button hyperlinks of `describe-key'...

00:34:59.000 --> 00:35:02.000
Again, let me show the comparison...

00:35:02.000 --> 00:35:07.000
this is the standard `describe-key' here,

00:35:07.000 --> 00:35:10.000
and this is my variant...

00:35:10.000 --> 00:35:14.000
it creates a buffer with elisp hyperlinks

00:35:14.000 --> 00:35:17.000
about this key.

00:35:17.000 --> 00:35:20.000
We get this, so each one of these

00:35:20.000 --> 00:35:22.000
functions is either a blank line

00:35:22.000 --> 00:35:28.000
or an elisp hyperlink...

00:35:28.000 --> 00:35:32.000
here is a slight variant of the function

00:35:32.000 --> 00:35:35.000
`find-ekey-links' above. In this variant

00:35:35.000 --> 00:35:38.000
the argument is a string that has to be

00:35:38.000 --> 00:35:40.000
processed by `read-kbd-macro' to convert it

00:35:40.000 --> 00:35:45.000
to the lower-level format...

00:35:45.000 --> 00:35:48.000
and note that these functions here that

00:35:48.000 --> 00:35:49.000
I wrote...

00:35:49.000 --> 00:35:51.000
they display temporary buffers with no

00:35:51.000 --> 00:35:53.000
help at all.

00:35:53.000 --> 00:35:57.000
To be honest there's a link to a

00:35:57.000 --> 00:35:58.000
tutorial here, but

00:35:58.000 --> 00:36:01.000
this is a recent addition, so let's ignore

00:36:01.000 --> 00:36:03.000
this...

00:36:03.000 --> 00:36:06.000
they display temporary buffers

00:36:06.000 --> 00:36:08.000
with no help at all, just lots of

00:36:08.000 --> 00:36:09.000
hyperlinks,

00:36:09.000 --> 00:36:11.000
and these hyperlinks can be... they are

00:36:11.000 --> 00:36:13.000
very hacker friendly, in the sense that

00:36:13.000 --> 00:36:15.000
they can be followed with

00:36:15.000 --> 00:36:17.000
`M-e', they can be copied to other

00:36:17.000 --> 00:36:19.000
buffers, because they are plain text,

00:36:19.000 --> 00:36:23.000
because they are just sexps...

00:36:23.000 --> 00:36:26.000
and they can be inspected, in the sense

00:36:26.000 --> 00:36:32.000
that... for example, here

00:36:32.000 --> 00:36:35.000
we have a hyperlink to a function that

00:36:35.000 --> 00:36:37.000
it may be difficult to figure out what

00:36:37.000 --> 00:36:39.000
this function does...

00:36:39.000 --> 00:36:42.000
but we can go to that position and then

00:36:42.000 --> 00:36:45.000
type `C-h f' to see the

00:36:45.000 --> 00:36:48.000
description of this function...

00:36:48.000 --> 00:36:56.000
and here is a hyperlink that does that

00:36:56.000 --> 00:37:00.000
in my syntax, say.

00:37:00.000 --> 00:37:02.000
And these lists of hyperlinks were

00:37:02.000 --> 00:37:04.000
generated by this code here,

00:37:04.000 --> 00:37:11.000
that just uses backquote to generate

00:37:11.000 --> 00:37:14.000
lists of sexps.

00:37:14.000 --> 00:37:18.000
And I felt that this function here,

00:37:18.000 --> 00:37:20.000
that just generated this list

00:37:20.000 --> 00:37:22.000
was very easy to understand and to

00:37:22.000 --> 00:37:24.000
modify, so this was hacker-friendly

00:37:24.000 --> 00:37:28.000
in the way that I wanted.

00:37:28.000 --> 00:37:31.000
And so I started using this...

00:37:31.000 --> 00:37:34.000
and this idea of using buffers with

00:37:34.000 --> 00:37:36.000
sexp hyperlinks and no help violated

00:37:36.000 --> 00:37:38.000
all the notions of user-friendliness

00:37:38.000 --> 00:37:40.000
that I knew, so I was

00:37:40.000 --> 00:37:42.000
exploring something new at that time.

00:37:42.000 --> 00:37:46.000
And this is the end of Part 2.

00:37:46.000 --> 00:37:49.000
Part 3 of this presentation is

00:37:49.000 --> 00:37:52.000
about the killer features of eev, or:

00:37:52.000 --> 00:37:54.000
Why everybody should use eev, or at least

00:37:54.000 --> 00:37:57.000
have eev installed, even if they think

00:37:57.000 --> 00:37:59.000
that eev is too weird.

00:37:59.000 --> 00:38:01.000
So: this is a very quick listing.

00:38:01.000 --> 00:38:03.000
3.1. Eev has elisp hyperlinks, which are

00:38:03.000 --> 00:38:04.000
super nice;

00:38:04.000 --> 00:38:06.000
3.2. It comes with lots of tutorials.

00:38:06.000 --> 00:38:07.000
The main one, here, explains all the

00:38:07.000 --> 00:38:10.000
main features...

00:38:10.000 --> 00:38:14.000
there's also a tutorial that is

00:38:14.000 --> 00:38:15.000
an index of

00:38:15.000 --> 00:38:18.000
all the other tutorials, here...

00:38:18.000 --> 00:38:20.000
many, many, many tutorials.

00:38:20.000 --> 00:38:22.000
If we forget everything we can

00:38:22.000 --> 00:38:24.000
just type `M-j', and remember that

00:38:24.000 --> 00:38:27.000
this this part here is

00:38:27.000 --> 00:38:29.000
beginner-friendly and the rest is

00:38:29.000 --> 00:38:32.000
beginner-unfriendly;

00:38:32.000 --> 00:38:38.000
there's a tutorial on Emacs Lisp, here...

00:38:38.000 --> 00:38:41.000
it mainly explains how to understand

00:38:41.000 --> 00:38:44.000
elisp code, which is much easier than...

00:38:44.000 --> 00:38:47.000
it's much easier to understand elisp code

00:38:47.000 --> 00:38:49.000
then to understand how to program elisp,

00:38:49.000 --> 00:38:51.000
and most people are only going to need

00:38:51.000 --> 00:38:53.000
this.

00:38:53.000 --> 00:38:55.000
3.3. Eev is very easy to install.

00:38:55.000 --> 00:38:58.000
It's in ELPA, so we just need to do

00:38:58.000 --> 00:39:00.000
this thing here, and it's very

00:39:00.000 --> 00:39:03.000
non-invasive...

00:39:03.000 --> 00:39:06.000
several years ago it was a very invasive

00:39:06.000 --> 00:39:08.000
package, but then I changed everything.

00:39:08.000 --> 00:39:13.000
Now if we toggle eev-mode on and off

00:39:13.000 --> 00:39:16.000
what's going to happen is just that the

00:39:16.000 --> 00:39:20.000
eev key map becomes activated or

00:39:20.000 --> 00:39:23.000
deactivated, and when we

00:39:23.000 --> 00:39:28.000
(require 'eev-load) the only things that

00:39:28.000 --> 00:39:32.000
happen globally are these things here:

00:39:32.000 --> 00:39:34.000
several functions and variables become

00:39:34.000 --> 00:39:36.000
defined - all of them have

00:39:36.000 --> 00:39:39.000
standard prefixes, except for one;

00:39:39.000 --> 00:39:43.000
three characters are changed in the

00:39:43.000 --> 00:39:45.000
standard display table to make them

00:39:45.000 --> 00:39:47.000
appear as colored glyphs:

00:39:47.000 --> 00:39:49.000
the red star and

00:39:49.000 --> 00:39:53.000
tha open double angle brackets and

00:39:53.000 --> 00:39:58.000
the closed double angle brackets;

00:39:58.000 --> 00:40:01.000
and two environment variables are set.

00:40:01.000 --> 00:40:04.000
and this is a trivial technicality...

00:40:04.000 --> 00:40:07.000
we just run a `defadvice'

00:40:07.000 --> 00:40:10.000
around one function that is used by man.

00:40:10.000 --> 00:40:12.000
Just this.

00:40:12.000 --> 00:40:15.000
3.4. Also, eev has a

00:40:15.000 --> 00:40:18.000
very high discoverability factor, and

00:40:18.000 --> 00:40:21.000
3.5. there's a very easy

00:40:21.000 --> 00:40:25.000
way to create a hyperlink to "here".

00:40:25.000 --> 00:40:27.000
I do not have time to show this now,

00:40:27.000 --> 00:40:29.000
but for example, if I'm

00:40:29.000 --> 00:40:34.000
here in a tutorial and I think that this

00:40:34.000 --> 00:40:36.000
section is something interesting, and i

00:40:36.000 --> 00:40:39.000
want to create a hyperlink to it

00:40:39.000 --> 00:40:41.000
i just have to type a certain key

00:40:41.000 --> 00:40:43.000
sequence - `M-h M-h' - here...

00:40:43.000 --> 00:40:46.000
and here I got a hyperlink that I can

00:40:46.000 --> 00:40:50.000
copy to my notes, and this hyperlink goes

00:40:50.000 --> 00:40:58.000
to that section.

00:40:58.000 --> 00:41:00.000
3.6. We have hyperlinks that point to

00:41:00.000 --> 00:41:02.000
specific positions in

00:41:02.000 --> 00:41:05.000
PDF documents and in video files... here,

00:41:05.000 --> 00:41:09.000
this one opens a PDF and displays it,

00:41:09.000 --> 00:41:10.000
this one opens a PDF

00:41:10.000 --> 00:41:13.000
and converts it to text,

00:41:13.000 --> 00:41:16.000
and this one opens a video in a

00:41:16.000 --> 00:41:18.000
certain position.

00:41:18.000 --> 00:41:20.000
3.7. And we also have a way to control

00:41:20.000 --> 00:41:22.000
shell-like programs.

00:41:22.000 --> 00:41:25.000
In my presentation of the last year I

00:41:25.000 --> 00:41:27.000
spent one third of the presentation

00:41:27.000 --> 00:41:28.000
explaining this, and

00:41:28.000 --> 00:41:30.000
i think that I gave a very good

00:41:30.000 --> 00:41:31.000
demonstration there...

00:41:31.000 --> 00:41:35.000
the demonstration is here:

00:41:35.000 --> 00:41:38.000
we can go to the web page, and go to

00:41:38.000 --> 00:41:41.000
this section of the web page,

00:41:41.000 --> 00:41:47.000
and start by this point...

00:41:47.000 --> 00:41:51.000
and here we have an explanation,

00:41:51.000 --> 00:41:55.000
and so on, whatever...

00:41:55.000 --> 00:41:58.000
3.8. and i've already mentioned this

00:41:58.000 --> 00:41:59.000
before... eev comes with a very nice

00:41:59.000 --> 00:42:02.000
elisp tutorial.

00:42:02.000 --> 00:42:05.000
So that's it, this is the end of part 3.

00:42:05.000 --> 00:42:07.000
So this is the last part of my

00:42:07.000 --> 00:42:09.000
presentation, and it's about the title

00:42:09.000 --> 00:42:11.000
of the presentation...

00:42:11.000 --> 00:42:13.000
I called the presentation "Why

00:42:13.000 --> 00:42:16.000
most of the best features in eev look

00:42:16.000 --> 00:42:20.000
like 5-minute hacks". I've already

00:42:20.000 --> 00:42:23.000
run out of time, so I have to skip this

00:42:23.000 --> 00:42:28.000
first part here, in which i describe how I

00:42:28.000 --> 00:42:31.000
was exposed to several different notions

00:42:31.000 --> 00:42:33.000
of user friendliness...

00:42:33.000 --> 00:42:35.000
and how the one that really blew my mind

00:42:35.000 --> 00:42:37.000
was the one in

00:42:37.000 --> 00:42:41.000
a certain Forth environment...

00:42:41.000 --> 00:42:44.000
and let me make the long story

00:42:44.000 --> 00:42:46.000
very, very short.

00:42:46.000 --> 00:42:49.000
In all this process I switched from

00:42:49.000 --> 00:42:51.000
the belief that the "User" was always

00:42:51.000 --> 00:42:53.000
someone else, someone external, and that

00:42:53.000 --> 00:42:57.000
I always had to write my programs for

00:42:57.000 --> 00:43:00.000
this external "User"... I switched

00:43:00.000 --> 00:43:02.000
from that to the belief that _I_ am

00:43:02.000 --> 00:43:03.000
the "User",

00:43:03.000 --> 00:43:05.000
and I can play with the interfaces that

00:43:05.000 --> 00:43:10.000
I want, I can write programs that

00:43:10.000 --> 00:43:12.000
only I am going to understand, I can

00:43:12.000 --> 00:43:14.000
experiment with hundreds of interfaces

00:43:14.000 --> 00:43:16.000
and then select the best ones,

00:43:16.000 --> 00:43:18.000
and document them, and then share them

00:43:18.000 --> 00:43:20.000
with other people

00:43:20.000 --> 00:43:23.000
who are also experimenting with

00:43:23.000 --> 00:43:26.000
interfaces in their own ways...

00:43:26.000 --> 00:43:30.000
and so eev has lots of things that are

00:43:30.000 --> 00:43:32.000
user-friendly in these unusual ways that

00:43:32.000 --> 00:43:34.000
I've explained before...

00:43:34.000 --> 00:43:37.000
and if we disconsider that this

00:43:37.000 --> 00:43:40.000
notion of user-friendliness is valid,

00:43:40.000 --> 00:43:44.000
then these things that eev

00:43:44.000 --> 00:43:46.000
implement they are user-friendly and

00:43:46.000 --> 00:43:48.000
hacker-friendly at the same time.

00:43:48.000 --> 00:43:51.000
And let me show one example. This is one

00:43:51.000 --> 00:43:54.000
that really took me one only five

00:43:54.000 --> 00:43:56.000
minutes to implement.

00:43:56.000 --> 00:43:59.000
At one point, a few months ago,

00:43:59.000 --> 00:44:00.000
I discovered

00:44:00.000 --> 00:44:04.000
that Sacha Chua's weekly posts about

00:44:04.000 --> 00:44:07.000
Emacs News were also

00:44:07.000 --> 00:44:09.000
being posted to a mailing list that is

00:44:09.000 --> 00:44:11.000
stored at

00:44:11.000 --> 00:44:14.000
lists.gnu.org, and it's called

00:44:14.000 --> 00:44:16.000
emacs-tangents...

00:44:16.000 --> 00:44:19.000
and I found a way to create

00:44:19.000 --> 00:44:25.000
the links to to the posts in both places,

00:44:25.000 --> 00:44:28.000
but I had to use a template for that...

00:44:28.000 --> 00:44:30.000
so what we are seeing here now

00:44:30.000 --> 00:44:32.000
is a template with the default

00:44:32.000 --> 00:44:36.000
values - so this means that we have not

00:44:36.000 --> 00:44:39.000
set the year correctly, we have not set

00:44:39.000 --> 00:44:40.000
the month correctly,

00:44:40.000 --> 00:44:44.000
or the day correctly, but if we run this

00:44:44.000 --> 00:44:46.000
sexp here...

00:44:46.000 --> 00:44:50.000
let me do something else before...

00:44:50.000 --> 00:44:55.000
if we run this sexp here

00:44:55.000 --> 00:45:00.000
we change some of these entries

00:45:00.000 --> 00:45:04.000
in the template, and we get these links

00:45:04.000 --> 00:45:06.000
here... they all work.

00:45:06.000 --> 00:45:09.000
For example, this one opens

00:45:09.000 --> 00:45:12.000
the blog post in Sacha Chua's site,

00:45:12.000 --> 00:45:16.000
and this one

00:45:16.000 --> 00:45:21.000
opens it in the mailing list...

00:45:21.000 --> 00:45:23.000
and sometimes I want the Org source of

00:45:23.000 --> 00:45:25.000
that, and the easiest way to get the

00:45:25.000 --> 00:45:27.000
Org source is to

00:45:27.000 --> 00:45:30.000
look at this link here, that has an

00:45:30.000 --> 00:45:31.000
attachment...

00:45:31.000 --> 00:45:35.000
and if I take this

00:45:35.000 --> 00:45:38.000
link here, and I take this

00:45:38.000 --> 00:45:42.000
stem that points to the attachment,

00:45:42.000 --> 00:45:44.000
and I put it here, and I generate this

00:45:44.000 --> 00:45:45.000
page again

00:45:45.000 --> 00:45:49.000
with all this data, then I get

00:45:49.000 --> 00:45:50.000
a script - here -

00:45:50.000 --> 00:45:53.000
that downloads... let me switch to a

00:45:53.000 --> 00:45:54.000
smaller font -

00:45:54.000 --> 00:45:58.000
it downloads this attachment,

00:45:58.000 --> 00:46:00.000
and it renames that attachment to

00:46:00.000 --> 00:46:13.000
something-emacs-news.org.

00:46:13.000 --> 00:46:16.000
Here - the file is already here,

00:46:16.000 --> 00:46:19.000
already with the right name, so I can

00:46:19.000 --> 00:46:20.000
open it with just this hyperlink...

00:46:20.000 --> 00:46:25.000
let me go to the big font again -

00:46:25.000 --> 00:46:28.000
and now i have the Org source for that

00:46:28.000 --> 00:46:29.000
hyperlink...

00:46:29.000 --> 00:46:33.000
sorry, for that blog post,

00:46:33.000 --> 00:46:37.000
and so this one-line thing here

00:46:37.000 --> 00:46:42.000
is, in a sense, a hyperlink to

00:46:42.000 --> 00:46:45.000
this blog post in all its formats...

00:46:45.000 --> 00:46:48.000
if I execute this I get links to

00:46:48.000 --> 00:46:52.000
to all the places where it is posted,

00:46:52.000 --> 00:46:54.000
and I get a script to

00:46:54.000 --> 00:46:56.000
download a local copy of the

00:46:56.000 --> 00:47:00.000
Org source of it... and that's it.

00:47:00.000 --> 00:47:03.000
Well, I'm already out of time, so let me

00:47:03.000 --> 00:47:04.000
finish here.

00:47:04.000 --> 00:47:08.000
Thanks! Bye! =)

