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