Hi! My name is Eduardo Ochs. I'm the author
of an Emacs package called eev, and the name
of this presentation is: "Bidirectional links
in eev".
Let me present things in a weird order,
starting by the new feature, and then I'm
going to explain the whole context.
One of the main features that we are
going to see here is this function here,
M-x kla, and kla is a mnemonic for "kill
Link to Anchor". Let me explain... let me
demonstrate how it works. This thing here
with the green angle brackets is an
anchor, this thing between the green
angle brackets is a tag of an
anchor, and if I type M-x kla here
it highlights this tag for a second and
it says "Copied to the kill ring: blah
blah blah..." and this thing here is a link.
I can insert the link here, I
can insert the link in my notes...
and if I execute this thing this link
here it goes to this anchor in this file.
If you have a recent version of eev
installed then trying this feature
should be very easy...
you just need to open the this file here,
in which everything is defined, and then
go to this section at the beginning of
the file, and then run the three blocks
of tests that are there.
This block corresponds roughly to what
we have just done...
this other block
is slightly different because it shows
some variants of kla... one is with `f`
instead of an `a` here, let me
show how it works... if we type
`M-x eeklf` or just `M-x klf`
we get a link to this file that does not
point to an anchor, and if we type
`M-x klt` we get another kind of link that
is a link to an anchor in the same
file...
and the third block
is more interesting because it lets
people create links to files that
are elsewhere, and that do not have
anchors in them...
let me execute this... this will
run this sexp here and display the
target at the window at the right...
this is one of the source files of Emacs.
Let's imagine that I want to create a
link to this string here... then I can
type `M-x klfs`, and this will create a
link to a file and to a string in that
file. So if I type ENTER here
it says: "Copied to the kill ring: ...\
and this is a link to this file here,
and to the first occurrence of this
string in this file.
So: how does this work (inside)?...
when I was trying to write the documentation
of this I tried to write a summary of
how the algorithm works, and I failed and
I tried again, and I failed again,
several times... and then I gave up and I
decided to write an intro - a tutorial,
this one -
that explains everything with lots of
details, and with lots of sections
with "Try it!"s, that
have examples that you you can run to
understand things, to examine how some
functions work, how the data
structures work, and so on...
the problem is that sometimes we have
several hyperlinks that point to the to
the same file. Let me give an example.
In the configuration in which I am now,
in this file here... the old way of
generating hyperlinks to this file
with `find-here-links`
will generate a temporary buffer
like this, and then I would have to
choose which one of these hyperlinks I
find best, which one I prefer, and then
copy it to my notes... so instead
of choosing a hyperlink this thing here
shows all the options.
And in the new way, in `M-x kla`
and friends, there's an algorithm that
chooses the best short hyperlink by
itself, and this algorithm is a bit hard
to explain... let me demonstrate it here.
Again, we have all these options here, of
hyperlinks to this file...
and if I type `M-x klf`
it chooses one of them.
And of course I can copy it to my notes,
it's going to work, it's going to point
to here... and so on.
Well, the title of this presentation was
"Bidirectional links with eev"... let me
show what I mean by bi-directional
hyperlinks, and how we can use this thing
to create bidirectional hyperlinks
very quickly.
I will have to use a smaller font... let
me open these two files here. This one at
the left is a program in Haskell, and
this one is a file with my notes on
Haskell.
How do I create a link from...
to this file in Haskell
to put it in this file here? I can put
the cursor here, in any position
after this anchor here, and type
`M-x kla`...
it copies this link here to the kill
ring and then I can can go here and
either insert it with C-y (yank), or
insert it with `M-k kli`, that adds a
comment prefix here.
So this is a way to create a link from
here to there in which every
comment has to be given explicitly...
but I also implemented a way to
create the two links at the same time.
I don't use it much, it's mostly for
demos, because it's impressive, I wanted
to show that in this presentation...
Anyway, let me show it here. Note that
that in this file here the point is
here, in this file the point is here...
My trick is going to create a link to
this anchor and put it in this file, and
it's going to create a link to this
anchor and put it in this file...
So, here it goes: `M-x kla2`... ta-da!
it highlighted the true anchors for a
second, and it created these things here
and inserted them with the
right prefixes, I mean, the right
comment prefixes.
And that's it!
So... that's it. If you found this thing
interesting just
install a recent version of eev and run
the tutorial, either with this thing here,
`M-x find-kla-intro`, or by running
this sexp, or open this file here in the
eev directory, and follow the
tutorials...
most things that there are well
documented, but the thing that I don't
use much and that is mostly for demos,
which is the the thing that creates
bi-directional hyperlinks, is not yet
well documented, but the rest is.
So: that's it! Bye! Have fun! =)