1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
|
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! =)
|