From 100701b2eea58939d5a337c8db6c1ab871a07125 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 22 Jan 2021 23:05:04 -0500 Subject: Add subtitles for talk21 --- ...-eev-look-like-5-minute-hacks--eduardo-ochs.vtt | 2848 ++++++++++++++++++++ 1 file changed, 2848 insertions(+) create mode 100644 2020/subtitles/emacsconf-2020--21-on-why-most-of-the-best-features-in-eev-look-like-5-minute-hacks--eduardo-ochs.vtt (limited to '2020/subtitles/emacsconf-2020--21-on-why-most-of-the-best-features-in-eev-look-like-5-minute-hacks--eduardo-ochs.vtt') diff --git a/2020/subtitles/emacsconf-2020--21-on-why-most-of-the-best-features-in-eev-look-like-5-minute-hacks--eduardo-ochs.vtt b/2020/subtitles/emacsconf-2020--21-on-why-most-of-the-best-features-in-eev-look-like-5-minute-hacks--eduardo-ochs.vtt new file mode 100644 index 00000000..530b95c8 --- /dev/null +++ b/2020/subtitles/emacsconf-2020--21-on-why-most-of-the-best-features-in-eev-look-like-5-minute-hacks--eduardo-ochs.vtt @@ -0,0 +1,2848 @@ +WEBVTT + +00:00:00.080 --> 00:00:01.708 +Hi, my name is Eduardo Ochs. + +00:00:01.708 --> 00:00:03.439 +I'm this person here, + +00:00:03.439 --> 00:00:06.240 +and the title of this talk is on "Why + +00:00:07.120 --> 00:00:09.519 +Most of the Best Features in eev Look + +00:00:09.519 --> 00:00:11.599 +Like Five Minute Hacks." + +00:00:11.599 --> 00:00:15.280 +This is a presentation at the +EmacsConf 2020 + +00:00:15.280 --> 00:00:23.199 +happening on November 28 and 29, 2020. + +00:00:23.199 --> 00:00:25.519 +So this is part one of the presentation. + +00:00:25.519 --> 00:00:27.680 +Here I'm going to explain + +00:00:27.680 --> 00:00:29.840 +some ideas that are prerequisites for + +00:00:29.840 --> 00:00:32.320 +understanding the rest of the +presentation. + +00:00:32.320 --> 00:00:35.440 +The three main keys of eev are + +00:00:35.440 --> 00:00:37.920 +M-e, M-k, and M-j. +I'm going to start by + +00:00:37.920 --> 00:00:42.079 +explaining M-e and M-k. + +00:00:42.079 --> 00:00:44.960 +M-e is used to follow hyperlinks. + +00:00:44.960 --> 00:00:47.592 +Technically, it is essentially + +00:00:47.592 --> 00:00:49.345 +just a C-e to move to + +00:00:49.345 --> 00:00:50.402 +the end of the line, + +00:00:50.402 --> 00:00:53.918 +and then a C-x C-e to +execute this, + +00:00:53.918 --> 00:00:58.960 +the sexp before point at +the end of the line. + +00:00:58.960 --> 00:01:00.879 +And the thing is that Emacs comes with + +00:01:00.879 --> 00:01:02.479 +many functions that can be + +00:01:02.479 --> 00:01:05.040 +used as sexp hyperlinks. + +00:01:05.040 --> 00:01:07.540 +We can consider that they point to +somewhere. + +00:01:07.540 --> 00:01:09.040 +I'm going to refer to that as + +00:01:09.040 --> 00:01:11.411 +the target of the hyperlink. + +00:01:11.411 --> 00:01:12.960 +If we execute this + +00:01:12.960 --> 00:01:15.759 +sexp hyperlinks, we coul go to that target. + +00:01:15.759 --> 00:01:17.119 +For example, this one + +00:01:17.119 --> 00:01:20.000 +is a hyperlink that points to a buffer + +00:01:20.000 --> 00:01:22.720 +with the manpage for cat. + +00:01:22.720 --> 00:01:25.040 +And usually, but not always, after + +00:01:25.040 --> 00:01:27.040 +following the hyperlink, we can go back + +00:01:27.040 --> 00:01:29.840 +by just killing the current buffer + +00:01:29.840 --> 00:01:31.537 +that the hyperlink created: + +00:01:31.537 --> 00:01:34.400 +the target of the hyperlink. + +00:01:34.400 --> 00:01:38.000 +But this example here is badly behaved. + +00:01:38.000 --> 00:01:41.360 +If we execute it, it creates a new frame, + +00:01:41.360 --> 00:01:43.360 +and to go back to the previous situation, + +00:01:43.360 --> 00:01:52.840 +we have to either click here +or type C-x 5 0. + +00:01:54.880 --> 00:01:57.120 +So here are some examples of + +00:01:57.120 --> 00:01:58.726 +sexp hyperlinks using + +00:01:58.726 --> 00:02:00.640 +standard Emacs functions. + +00:02:00.640 --> 00:02:03.188 +This third one is badly behaved + +00:02:03.188 --> 00:02:04.880 +in a different way. + +00:02:04.880 --> 00:02:08.554 +If executed, the target is created + +00:02:08.554 --> 00:02:11.006 +in the same window as we are now, + +00:02:11.006 --> 00:02:14.312 +but it also shows a lot of +garbage + +00:02:14.312 --> 00:02:15.797 +here in the echo area, + +00:02:15.797 --> 00:02:23.280 +so the current frame becomes +a bit messy. + +00:02:23.280 --> 00:02:25.728 +And well, one of the first things + +00:02:25.728 --> 00:02:28.319 +that I did when I was creating eev + +00:02:28.319 --> 00:02:30.720 +many many years ago was that I created + +00:02:30.720 --> 00:02:33.380 +variants of all these functions + +00:02:33.380 --> 00:02:36.640 +that were better behaved. + +00:02:36.640 --> 00:02:39.200 +They were better behaved in two +senses. + +00:02:39.200 --> 00:02:40.839 +The obvious one was that + +00:02:40.839 --> 00:02:43.680 +they all created the target + +00:02:43.680 --> 00:02:45.246 +in the same window as before, + +00:02:45.246 --> 00:02:48.720 +so I could go back by just typing M-k + +00:02:48.720 --> 00:02:52.879 +which has essentially just killed this +buffer. + +00:02:52.879 --> 00:02:56.480 +I also implemented something extra that + +00:02:56.480 --> 00:02:59.040 +are the postback lists. + +00:02:59.040 --> 00:03:03.599 +For example, these extra arguments here +are a postback list. + +00:03:03.599 --> 00:03:06.080 +These extra arguments specify + +00:03:06.080 --> 00:03:09.599 +position and the target buffer. + +00:03:09.599 --> 00:03:14.337 +In this example, +this postback list means: + +00:03:14.337 --> 00:03:18.239 +starting from the beginning of +the buffer, + +00:03:18.239 --> 00:03:22.757 +search for the first occurrence +of this string after that, + +00:03:22.757 --> 00:03:24.754 +after the beginning +of the buffer, + +00:03:24.754 --> 00:03:27.662 +and then search for +the first occurrence + +00:03:27.662 --> 00:03:33.760 +of this string after that. + +00:03:33.760 --> 00:03:36.070 +eev also defines some hyperlinks + +00:03:36.070 --> 00:03:38.799 +that do not create new buffers. + +00:03:38.799 --> 00:03:40.879 +Here is the first example. + +00:03:40.879 --> 00:03:42.971 +If I execute this one, + +00:03:42.971 --> 00:03:45.920 +this one is a hyperlink + +00:03:45.920 --> 00:03:46.959 +to the result + +00:03:46.959 --> 00:03:50.720 +of running this show comment date, + +00:03:50.720 --> 00:03:52.623 +but instead of showing the result + +00:03:52.623 --> 00:03:53.767 +in the new buffer, + +00:03:53.767 --> 00:03:55.475 +the result is shown +here. + +00:03:55.475 --> 00:03:58.959 +So, if I execute this hyperlink, + +00:03:58.959 --> 00:04:01.634 +the result of date, the output of date, + +00:04:01.634 --> 00:04:03.339 +is shown in the echo area. + +00:04:03.339 --> 00:04:07.120 +And if executed again, + +00:04:07.120 --> 00:04:08.673 +it shows the result again, + +00:04:08.673 --> 00:04:09.519 +and the result + +00:04:09.519 --> 00:04:11.519 +changes every second. + +00:04:11.519 --> 00:04:18.720 +So this is a variant of find-sh. + +00:04:18.720 --> 00:04:21.840 +find-sh0 is the variant that + +00:04:21.840 --> 00:04:24.960 +just shows the output in the echo area, + +00:04:24.960 --> 00:04:28.080 +and find-sh shows the output in + +00:04:28.080 --> 00:04:31.759 +a new buffer. + +00:04:31.759 --> 00:04:35.919 +Here is an example of a hyperlink + +00:04:35.919 --> 00:04:39.173 +that calls an external program. + +00:04:39.173 --> 00:04:41.280 +If I execute this, + +00:04:41.280 --> 00:04:43.604 +it calls Google Chrome to open + +00:04:43.604 --> 00:04:46.639 +a certain URL. + +00:04:46.639 --> 00:04:51.520 +Here it is. Let's go back to Emacs. + +00:04:51.520 --> 00:04:55.280 +If I execute this hyperlink here, + +00:04:55.280 --> 00:04:57.986 +it invokes my favorite PDF viewer + +00:04:57.986 --> 00:05:02.560 +which is xpdf. It makes xpdf + +00:05:02.560 --> 00:05:07.759 +open this PDF page. It is PDF + +00:05:07.759 --> 00:05:10.880 +in this page, and these other arguments + +00:05:10.880 --> 00:05:15.199 +are ignored. Let me show how it works. + +00:05:15.199 --> 00:05:20.160 +Here it is. This is an excerpt from a +book. + +00:05:20.160 --> 00:05:22.639 +So page 3 in the pdf corresponds to + +00:05:22.639 --> 00:05:26.400 +page 113 in the book. + +00:05:26.400 --> 00:05:29.360 +This variant here of the hyperlink above, + +00:05:29.360 --> 00:05:31.759 +it opens the PDF in a different way. + +00:05:31.759 --> 00:05:34.560 +It runs a program called pdftotext on + +00:05:34.560 --> 00:05:36.479 +this PDF here, + +00:05:36.479 --> 00:05:39.600 +and Emacs takes the output of + +00:05:39.600 --> 00:05:42.880 +running pdftotext on this pdf here + +00:05:42.880 --> 00:05:45.301 +and displays it in a buffer. + +00:05:45.301 --> 00:05:47.280 +Now this postback list + +00:05:47.280 --> 00:05:49.651 +is interpreted in a different way. + +00:05:49.651 --> 00:05:51.280 +This thing is interpreted + +00:05:51.280 --> 00:05:53.425 +as a number of a page, + +00:05:53.425 --> 00:05:55.548 +and Emacs goes to page three + +00:05:55.548 --> 00:05:57.520 +by counting form feeds in + +00:05:57.520 --> 00:06:00.370 +the converted version of the PDF + +00:06:00.370 --> 00:06:03.039 +and then it searches for this string. + +00:06:03.039 --> 00:06:06.319 +and in this three... So let's execute this + +00:06:06.319 --> 00:06:09.169 +to see what happens. +Here it is. + +00:06:09.169 --> 00:06:14.800 +I opened the same page +as before. + +00:06:14.800 --> 00:06:18.400 +It starts with lecture one. + +00:06:18.400 --> 00:06:20.720 +So the other hyperlink searched for this + +00:06:20.720 --> 00:06:25.520 +string and for this string here. + +00:06:25.520 --> 00:06:30.400 +This thing here is a hyperlink +to video, + +00:06:30.400 --> 00:06:31.644 +and when I execute it, + +00:06:31.644 --> 00:06:34.560 +it's going to open this video here + +00:06:34.560 --> 00:06:37.759 +at this timestamp. Let's see. + +00:06:37.759 --> 00:06:49.440 +1, 2, 3. 1, 2, 3. +That's the way to do it. + +00:06:49.440 --> 00:06:51.956 +And also some hyperlinks + +00:06:51.956 --> 00:06:53.680 +that I defined, + +00:06:53.680 --> 00:06:55.940 +they don't work like + +00:06:55.940 --> 00:06:58.160 +usual hyperlinks. They work more + +00:06:58.160 --> 00:07:01.440 +like browser buttons, + +00:07:01.440 --> 00:07:06.240 +these buttons that appear in web pages, + +00:07:06.240 --> 00:07:09.120 +in the sense that these buttons usually + +00:07:09.120 --> 00:07:11.360 +don't open a new page. They usually + +00:07:11.360 --> 00:07:14.960 +just do something to change +the current page. + +00:07:14.960 --> 00:07:17.312 +If I execute this, the action + +00:07:17.312 --> 00:07:22.240 +of this function eek is to... + +00:07:22.240 --> 00:07:25.423 +It interprets this string +as a series of keys + +00:07:25.423 --> 00:07:30.051 +and it acts as if the user had +typed all these keys. + +00:07:30.051 --> 00:07:32.706 +So if executed, I get a hello + +00:07:32.706 --> 00:07:34.400 +in the next line. + +00:07:34.400 --> 00:07:36.639 +If executed again, I get another hello. + +00:07:36.639 --> 00:07:39.440 +Another hello. hello. hello. etc. etc. + +00:07:39.440 --> 00:07:44.319 +Let me undo this mess. Oops. + +00:07:44.319 --> 00:07:47.840 +And here is another kind of button + +00:07:47.840 --> 00:07:51.440 +that defines a new function. If I execute + +00:07:51.440 --> 00:07:54.879 +this sexp here, at this moment, though it's + +00:07:54.879 --> 00:07:55.759 +not defined. + +00:07:55.759 --> 00:07:57.919 +And if I execute this, Emacs is going to + +00:07:57.919 --> 00:08:00.000 +show me a message saying + +00:08:00.000 --> 00:08:03.599 +symbol as function cell is not defined, + +00:08:03.599 --> 00:08:05.840 +something like this. + +00:08:05.840 --> 00:08:09.520 +But if I execute the defun, + +00:08:09.520 --> 00:08:12.960 +the action of this function o here + +00:08:12.960 --> 00:08:18.960 +is to run this, which opens a certain +directory. + +00:08:18.960 --> 00:08:21.840 +Let me go back. Here is another + +00:08:21.840 --> 00:08:23.039 +button that defines + +00:08:23.039 --> 00:08:25.489 +several functions at the same time. + +00:08:25.489 --> 00:08:32.320 +If I execute this, + +00:08:32.320 --> 00:08:34.561 +note that the the result of + +00:08:34.561 --> 00:08:36.719 +executing this expression + +00:08:36.719 --> 00:08:38.447 +is the name of one of the functions + +00:08:38.447 --> 00:08:40.080 +that it defined. + +00:08:40.080 --> 00:08:42.800 +That is this one here. Let me explain + +00:08:42.800 --> 00:08:46.959 +these examples. One of the functions + +00:08:46.959 --> 00:08:48.800 +that this thing here defined + +00:08:48.800 --> 00:08:51.839 +is called find-orggitfile, where + +00:08:51.839 --> 00:08:54.640 +this orggit in the middle of its name + +00:08:54.640 --> 00:08:59.600 +is exactly this first argument to +code-c-d. + +00:08:59.600 --> 00:09:03.120 +The action of running find-orggitfile + +00:09:03.120 --> 00:09:06.399 +on a string like this is that + +00:09:06.399 --> 00:09:09.680 +find-orggitfile takes the string + +00:09:09.680 --> 00:09:13.360 +and prepends this string to it, + +00:09:13.360 --> 00:09:15.600 +this one here which is the second + +00:09:15.600 --> 00:09:17.920 +argument to code-c-d, + +00:09:17.920 --> 00:09:21.760 +and then it executes find-fline + +00:09:21.760 --> 00:09:25.680 +on the result, which is this one. + +00:09:25.680 --> 00:09:28.320 +find-fline is my variant of find-file + +00:09:28.800 --> 00:09:32.080 +that supports both spec lists. + +00:09:32.080 --> 00:09:36.880 +This function here that I'm + +00:09:36.880 --> 00:09:38.538 +referring to as a button, + +00:09:38.538 --> 00:09:41.200 +it also defines a function called + +00:09:41.200 --> 00:09:44.880 +find-orggitnode here, where the orggit + +00:09:44.880 --> 00:09:46.839 +is the same string as here. + +00:09:46.839 --> 00:09:50.320 +This function opens a node + +00:09:50.320 --> 00:09:54.160 +of an info manual. This one, + +00:09:54.160 --> 00:09:57.310 +this text here opens this node + +00:09:57.310 --> 00:10:00.080 +in the Org manual. + +00:10:00.080 --> 00:10:03.519 +It is equivalent to this text here. + +00:10:03.519 --> 00:10:06.225 +So in the passage from this line + +00:10:06.225 --> 00:10:08.720 +to this line, we prepended + +00:10:08.720 --> 00:10:12.310 +to the node name the name of +the manual here. + +00:10:12.310 --> 00:10:15.040 +find-node is my variant + +00:10:15.040 --> 00:10:18.160 +of this standard Emacs function here, + +00:10:18.160 --> 00:10:20.119 +but find-node also supports + +00:10:20.119 --> 00:10:23.519 +postback lists. + +00:10:23.519 --> 00:10:26.640 +eev also defines some functions that + +00:10:26.640 --> 00:10:28.423 +define shorter hyperlinks to PDFs + +00:10:28.423 --> 00:10:30.800 +and videos. + +00:10:30.800 --> 00:10:32.574 +Remember that this thing here + +00:10:32.574 --> 00:10:34.322 +is a shorter hyperlink + +00:10:34.322 --> 00:10:36.668 +to a file. This thing here + +00:10:36.668 --> 00:10:39.040 +is a shorter hyperlink to a node + +00:10:39.040 --> 00:10:43.200 +in an Emacs menu in an info manual. + +00:10:43.200 --> 00:10:47.279 +If we run this thing here, this +code-pdf-page, + +00:10:47.279 --> 00:10:50.240 +this acts like a button that defines a + +00:10:50.240 --> 00:10:52.880 +certain function + +00:10:52.880 --> 00:10:56.669 +and this string, +this other sexp here, + +00:10:56.669 --> 00:10:58.430 +defines another function. + +00:10:58.430 --> 00:11:00.240 +The first one defines + +00:11:00.240 --> 00:11:02.745 +the function find-fongspivak-page, + +00:11:02.745 --> 00:11:05.360 +and the second one defines the +function find-fongspivak-text. + +00:11:05.360 --> 00:11:09.608 +When we run the file, + +00:11:09.608 --> 00:11:12.020 +when we run find-fongspivak-page, + +00:11:12.020 --> 00:11:15.686 +it opens this PDF here. + +00:11:15.686 --> 00:11:20.640 +The name is quite long. + +00:11:20.640 --> 00:11:23.839 +This example opens this PDF at page 8 + +00:11:23.839 --> 00:11:26.079 +and searches for the string contents. + +00:11:26.079 --> 00:11:31.279 +In this case, it just ignores +this string. + +00:11:31.279 --> 00:11:33.519 +Here it only considers + +00:11:33.519 --> 00:11:37.360 +the number of the page. Let's try. + +00:11:42.640 --> 00:11:45.200 +Here it is, the contents of a book + +00:11:45.200 --> 00:11:51.760 +that is freely available. Here is +another page of the book. + +00:11:51.760 --> 00:11:55.519 +And if we execute this +hyperlink here, + +00:11:55.519 --> 00:11:58.399 +find-fongspivak-text, it converts the + +00:11:58.399 --> 00:11:59.920 +PDF to text + +00:11:59.920 --> 00:12:03.382 +and it searches for +page eight in it, + +00:12:03.382 --> 00:12:04.754 +and then for the string, + +00:12:04.754 --> 00:12:08.079 +this string here in page eight. + +00:12:08.079 --> 00:12:12.240 +It takes a few seconds. + +00:12:12.240 --> 00:12:16.160 +Here it is. So this is the + +00:12:16.160 --> 00:12:20.892 +ASCII version of this contents page +here. + +00:12:20.892 --> 00:12:25.040 +Note that this block here + +00:12:25.040 --> 00:12:28.800 +is a kind of an index to that book. + +00:12:28.800 --> 00:12:31.360 +I have the full index somewhere, + +00:12:31.360 --> 00:12:32.506 +but it's very long, + +00:12:32.506 --> 00:12:34.959 +so I just copied a few lines here. + +00:12:34.959 --> 00:12:38.959 +So this is a link to s + +00:12:38.959 --> 00:12:42.160 +section one, chapter one. This is the + +00:12:42.160 --> 00:12:48.959 +section 1.1, section 1.1.1, and so on. + +00:12:48.959 --> 00:12:54.000 +Here is a link to the index. + +00:12:54.000 --> 00:12:58.079 +Here is a part of my index + +00:12:58.079 --> 00:13:03.279 +of positions in the video +that we just saw + +00:13:03.279 --> 00:13:07.360 +that I think that are especially +relevant. + +00:13:07.360 --> 00:13:11.940 +So this hyperlink is a kind +of a button + +00:13:11.940 --> 00:13:14.160 +that defines this function here, + +00:13:14.160 --> 00:13:18.839 +find-punchandjudyvideo. Into the video. + +00:13:27.600 --> 00:13:30.800 +We can also use this for + +00:13:30.800 --> 00:13:33.360 +video tutorials. For example, + +00:13:33.360 --> 00:13:37.200 +this is a very good tutorial on Magit. + +00:13:37.200 --> 00:13:40.880 +If we execute this, + +00:13:40.880 --> 00:13:42.560 +then these functions are going to be + +00:13:42.560 --> 00:13:44.800 +defined, and these functions open + +00:13:44.800 --> 00:13:48.399 +this tutorial on Magit. + +00:13:48.399 --> 00:13:50.079 +These are some of the positions in the + +00:13:50.079 --> 00:13:52.904 +tutorial that I found +especially relevant. + +00:13:52.904 --> 00:13:54.408 +This is a very dense tutorial. + +00:13:54.408 --> 00:13:56.480 +I had to take notes +of everything, + +00:13:56.480 --> 00:13:59.040 +and I had to watch everything + +00:13:59.040 --> 00:14:00.800 +several times. + +00:14:00.800 --> 00:14:02.896 +For example, this is a link + +00:14:02.896 --> 00:14:05.444 +to the position in the tutorial + +00:14:05.444 --> 00:14:11.005 +that explains how in Spacemacs, + +00:14:11.005 --> 00:14:17.600 +Magit interprets SPC g s as magit-status. + +00:14:17.600 --> 00:14:20.480 +Let's see. "...beginners. +SPC g s to initiate + +00:14:20.480 --> 00:14:22.320 +Magit's git status. + +00:14:22.320 --> 00:14:25.600 +You can also do..." That's it. + +00:14:25.600 --> 00:14:28.800 +Here are some examples that I + +00:14:28.800 --> 00:14:31.200 +took from somewhere else. + +00:14:31.200 --> 00:14:34.240 +The video tutorials from + +00:14:34.240 --> 00:14:43.519 +Rainer Koenig about Org Mode. + +00:14:43.519 --> 00:14:45.308 +Now let me show how the functions + +00:14:45.308 --> 00:14:47.220 +that define these shorter hyperlinks + +00:14:47.220 --> 00:14:48.720 +are implemented. + +00:14:48.720 --> 00:14:50.509 +The standard ways in Emacs + +00:14:50.509 --> 00:14:53.741 +to define functions that define +other functions + +00:14:53.741 --> 00:14:55.760 +would be with macros. + +00:14:55.760 --> 00:14:58.320 +Let's see an example. This is a standard + +00:14:58.320 --> 00:15:01.540 +function that defines new functions. + +00:15:02.959 --> 00:15:06.959 +If we execute it, + +00:15:06.959 --> 00:15:09.040 +its result is the last function that it + +00:15:09.040 --> 00:15:11.527 +defined, which is ee-glyph, + +00:15:11.527 --> 00:15:13.920 +which is here. + +00:15:13.920 --> 00:15:16.959 +It's implemented as a macro. We can + +00:15:16.959 --> 00:15:20.880 +look at the result of macro-expand, +which is going to + +00:15:20.880 --> 00:15:22.975 +show us the result of this, + +00:15:22.975 --> 00:15:25.519 +of the expansion of this. + +00:15:25.519 --> 00:15:27.804 +Instead of expanding and executing, + +00:15:27.804 --> 00:15:33.199 +it just expands and shows us the result. + +00:15:33.199 --> 00:15:35.439 +Here the result is a bit messy. + +00:15:35.439 --> 00:15:39.396 +It's too big for humans to understand, + +00:15:39.396 --> 00:15:42.894 +but we can run this or this text here. + +00:15:42.894 --> 00:15:47.519 +That takes that result +and pretty-prints it. + +00:15:47.519 --> 00:15:50.701 +So this is the pretty-printed version + +00:15:50.701 --> 00:15:54.000 +of this macro here. + +00:15:54.000 --> 00:15:57.600 +We can see that it defines + +00:15:57.600 --> 00:16:01.120 +several functions here. + +00:16:01.120 --> 00:16:06.399 +For example, this one. + +00:16:06.399 --> 00:16:09.360 +And this, just as a curiosity, is a link + +00:16:09.360 --> 00:16:13.839 +to the definition of cl-defstruct. + +00:16:13.839 --> 00:16:16.880 +Note that the code is huge. + +00:16:16.880 --> 00:16:18.677 +Well, it's very well-commented, + +00:16:18.677 --> 00:16:22.577 +but it has lots of special cases. + +00:16:22.577 --> 00:16:26.210 +It supports lots of constructions, + +00:16:26.210 --> 00:16:27.920 +and so it's huge. + +00:16:27.920 --> 00:16:30.174 +It's very difficult to understand. + +00:16:30.174 --> 00:16:33.360 +I mean, I found it very difficult +to understand. + +00:16:33.360 --> 00:16:35.040 +Here's a link to document the + +00:16:35.040 --> 00:16:37.759 +documentation of cl-defstruct + +00:16:37.759 --> 00:16:42.210 +here in the manual for cl, + +00:16:42.210 --> 00:16:45.025 +which is a kind of support + +00:16:45.025 --> 00:16:50.480 +for some features of Common Lisp +in Emacs. + +00:16:50.480 --> 00:16:53.825 +So let's compare this standard way of + +00:16:53.825 --> 00:16:56.560 +defining functions that +define new functions, + +00:16:56.560 --> 00:16:59.253 +which is with macros, +with this. + +00:16:59.253 --> 00:17:02.300 +I'm going to use a slogan +repeatedly. + +00:17:02.300 --> 00:17:06.319 +The slogan is: "I am a very bad +programmer." + +00:17:06.319 --> 00:17:08.005 +I'm a very bad programmer. + +00:17:08.005 --> 00:17:10.082 +So, when I was trying to create +functions + +00:17:10.082 --> 00:17:12.240 +that would define new functions, + +00:17:12.240 --> 00:17:14.480 +I found it easier to generally generate + +00:17:14.480 --> 00:17:16.400 +this code as text, + +00:17:16.400 --> 00:17:20.559 +and then run read and eval in it. + +00:17:20.559 --> 00:17:24.640 +The code-c-d that we saw +in the previous section, + +00:17:24.640 --> 00:17:28.079 +we can see the code that it produces + +00:17:28.079 --> 00:17:30.769 +by making a copy of this line + +00:17:30.769 --> 00:17:32.579 +and prepending this string here + +00:17:32.579 --> 00:17:34.480 +to the name of the function. + +00:17:34.480 --> 00:17:36.317 +So, instead of running code-c-d, + +00:17:36.317 --> 00:17:38.400 +we run find-code-cd, + +00:17:38.400 --> 00:17:41.280 +and it creates a new temporary buffer + +00:17:41.280 --> 00:17:44.400 +with the code that + +00:17:44.400 --> 00:17:47.760 +code-c-d would execute. + +00:17:47.760 --> 00:17:54.080 +So it's a series of the defuns +and a few setqs and so on. + +00:17:54.080 --> 00:17:59.120 +And this thing is implemented mostly as +a template. + +00:18:02.160 --> 00:18:04.045 +There's an inner function called + +00:18:04.045 --> 00:18:06.240 +ee-code-c-d-base that receives just + +00:18:06.240 --> 00:18:08.799 +these two arguments, and it says... + +00:18:08.799 --> 00:18:10.640 +Essentially, it just runs the function + +00:18:10.640 --> 00:18:14.320 +ee-template0 on the string here, and + +00:18:14.320 --> 00:18:16.480 +the things between curly braces are + +00:18:16.480 --> 00:18:18.559 +substituted by the values + +00:18:18.559 --> 00:18:23.600 +of these arguments here. + +00:18:23.600 --> 00:18:25.919 +There's one part of the tutorial here + +00:18:25.919 --> 00:18:28.480 +that explains all these things, + +00:18:28.480 --> 00:18:31.039 +except for the rationale for some + +00:18:31.039 --> 00:18:32.559 +design decisions, + +00:18:32.559 --> 00:18:35.360 +and those design decisions are one of + +00:18:35.360 --> 00:18:37.280 +the many motivations for this talk. + +00:18:37.760 --> 00:18:39.679 +I'm only going to explain these + +00:18:39.679 --> 00:18:42.640 +things in detail at the end, + +00:18:42.640 --> 00:18:48.480 +which is kind of... + +00:18:48.480 --> 00:18:49.662 +So in the beginning, I said + +00:18:49.662 --> 00:18:51.600 +that the three main keys of eev + +00:18:51.600 --> 00:18:56.000 +are M-e, M-k and M-j. + +00:18:56.000 --> 00:19:00.080 +Let's see now what M-j does. + +00:19:00.080 --> 00:19:02.447 +I need to start with some +motivation. + +00:19:02.447 --> 00:19:04.640 +The motivation is that we + +00:19:04.640 --> 00:19:06.559 +can define commands with very short + +00:19:06.559 --> 00:19:08.240 +names. Actually, I became kind of + +00:19:08.240 --> 00:19:10.160 +addicted to that. + +00:19:10.160 --> 00:19:13.200 +This is an example of defun that + +00:19:13.200 --> 00:19:15.600 +defines a comment with a very short name. + +00:19:15.600 --> 00:19:18.000 +Its name is just one letter, "e." + +00:19:18.000 --> 00:19:20.530 +and I can invoke... You invoke it + +00:19:20.530 --> 00:19:21.856 +with M-x e. + +00:19:21.856 --> 00:19:24.720 +If I type M-x p, + +00:19:24.720 --> 00:19:26.661 +now it opens a LaTeX file + +00:19:26.661 --> 00:19:31.130 +that I'm working on. + +00:19:32.559 --> 00:19:35.200 +I create most of my LaTeX files + +00:19:35.200 --> 00:19:39.200 +using template-based functions like + +00:19:39.200 --> 00:19:43.760 +the implementation of code-c-d above. + +00:19:43.760 --> 00:19:45.576 +These template-based functions + +00:19:45.576 --> 00:19:49.280 +create files with extension .tex + +00:19:49.280 --> 00:19:51.280 +that start with a series of defuns + +00:19:51.280 --> 00:19:53.919 +in comments. For example, + +00:19:53.919 --> 00:19:55.926 +let's look at this example here. + +00:19:55.926 --> 00:19:58.049 +If I execute find-latex-links + +00:19:58.049 --> 00:19:59.440 +with this argument, + +00:19:59.440 --> 00:20:02.525 +it's going to do several things + +00:20:02.525 --> 00:20:08.320 +for creating a file called /tmp/foo.tex, + +00:20:08.320 --> 00:20:10.387 +and the header of that file + +00:20:10.387 --> 00:20:12.400 +is going to be this, + +00:20:12.400 --> 00:20:16.080 +which starts with three + +00:20:16.080 --> 00:20:19.280 +defuns with functions with very short + +00:20:19.280 --> 00:20:21.919 +names and comments. + +00:20:21.919 --> 00:20:27.520 +Let's compare with the situation here. + +00:20:27.520 --> 00:20:32.799 +In my file, 2020favorite-conventions.tex, + +00:20:32.799 --> 00:20:34.640 +I have this header here in which I + +00:20:34.640 --> 00:20:39.360 +define six functions with +very short names. + +00:20:39.360 --> 00:20:41.919 +And in this case here, that is even + +00:20:41.919 --> 00:20:44.799 +explained in the tutorial. + +00:20:44.799 --> 00:20:48.000 +These... We have mnemonics for + +00:20:48.000 --> 00:20:51.520 +these short names here. c is compile, + +00:20:51.520 --> 00:20:54.799 +d is display. I mean, display the PDF. + +00:20:54.799 --> 00:20:57.377 +e is added in the sense of + +00:20:57.377 --> 00:21:02.320 +make Emacs visit that file. + +00:21:02.320 --> 00:21:06.480 +Now I can explain what is M-j +itself. + +00:21:06.480 --> 00:21:09.600 +We just saw commands with +very short names. + +00:21:09.600 --> 00:21:12.048 +The idea behind M-j is that + +00:21:12.048 --> 00:21:14.031 +we can define commands with + +00:21:14.031 --> 00:21:16.480 +very short numbers. + +00:21:16.480 --> 00:21:19.679 +Let me explain this. + +00:21:19.679 --> 00:21:23.039 +The short explanation +for what M-j does + +00:21:23.039 --> 00:21:25.360 +is that it jumps to set certain + +00:21:25.360 --> 00:21:27.039 +predefined places. + +00:21:27.039 --> 00:21:30.799 +In particular, a M-j without +a numeric argument + +00:21:30.799 --> 00:21:32.216 +takes us to a buffer + +00:21:32.216 --> 00:21:34.080 +with the basic help + +00:21:34.080 --> 00:21:37.679 +and a list of the current jump targets. + +00:21:37.679 --> 00:21:39.760 +This is something that is a bit + +00:21:39.760 --> 00:21:41.520 +simpler to understand. + +00:21:41.520 --> 00:21:44.559 +If we type M-5 M-j, + +00:21:44.559 --> 00:21:48.411 +then M-j runs this sexp here + +00:21:48.411 --> 00:21:51.120 +that is associated to + +00:21:51.120 --> 00:21:55.440 +the argument 5. I say that the target + +00:21:55.440 --> 00:21:59.039 +for the argument 5 is this one, + +00:21:59.039 --> 00:22:01.520 +and if the argument is true, then the + +00:22:01.520 --> 00:22:03.760 +target associated to the true + +00:22:03.760 --> 00:22:07.039 +is this sexp here that opens... + +00:22:07.039 --> 00:22:09.600 +This one opens the main tutorial +for eev, + +00:22:09.600 --> 00:22:13.679 +and this one opens another tutorial. + +00:22:13.679 --> 00:22:15.679 +This is a link to one of the tutorials + +00:22:15.679 --> 00:22:20.480 +of eev to the part that explains M-j. + +00:22:20.480 --> 00:22:22.212 +I've copied the the main part + +00:22:22.212 --> 00:22:24.559 +of the text here. + +00:22:24.559 --> 00:22:28.159 +The header that M-j shows... + +00:22:28.159 --> 00:22:31.360 +Let me show it very quickly here. + +00:22:31.360 --> 00:22:36.320 +Here is their head and +here is the rest. + +00:22:36.320 --> 00:22:38.773 +The header is very beginner friendly, + +00:22:38.773 --> 00:22:40.000 +and if you're a beginner + +00:22:40.000 --> 00:22:42.159 +who only knows how to use M-e to + +00:22:42.159 --> 00:22:44.559 +execute and... + +00:22:44.559 --> 00:22:46.706 +This should be okay. + +00:22:46.706 --> 00:22:48.240 +M-k to go back. + +00:22:48.240 --> 00:22:52.320 +Then you can and should use that header-- + +00:22:52.320 --> 00:22:56.720 +I mean, this header here-- + +00:22:56.720 --> 00:22:58.894 +as your main starting point. + +00:22:58.894 --> 00:23:00.799 +Every time that you feel lost, + +00:23:00.799 --> 00:23:04.799 +you can type M-j to go back to +that header, + +00:23:04.799 --> 00:23:08.000 +and you can use its links to +navigate to the documentation + +00:23:08.000 --> 00:23:11.360 +for Emacs and eev. Let me explain that. + +00:23:11.360 --> 00:23:15.679 +This header here has several elisp +hyperlinks. + +00:23:15.679 --> 00:23:22.400 +One here, one here, one here, +one here, and so on. + +00:23:22.400 --> 00:23:25.760 +These ones are links to the + +00:23:25.760 --> 00:23:29.280 +to the intros, which are the tutorials. + +00:23:29.280 --> 00:23:31.520 +find-eev-quick-intro is the +main tutorial, + +00:23:31.520 --> 00:23:35.760 +and find-emacs-keys-intro is a +kind of tutorial that is + +00:23:35.760 --> 00:23:40.000 +an index of the main keys. + +00:23:40.000 --> 00:23:42.559 +After that, we have an explanation of + +00:23:42.559 --> 00:23:45.449 +what some numeric prefixes do. + +00:23:45.449 --> 00:23:49.913 +So if we type M-1 M-j, +the effect of that + +00:23:49.913 --> 00:23:53.200 +is exactly the same as +executing this. + +00:23:53.200 --> 00:24:00.159 +We can execute this with M-e also. + +00:24:00.159 --> 00:24:03.679 +M-2 M-j runs this sexp and + +00:24:03.679 --> 00:24:06.960 +I can also execute it with M-e. + +00:24:06.960 --> 00:24:18.400 +Here it is. It's this intro, this +sandbox tutorial. + +00:24:18.400 --> 00:24:24.640 +Here is another sandbox tutorial. + +00:24:24.640 --> 00:24:27.039 +Let me go back. Then the + +00:24:27.039 --> 00:24:29.388 +documentation says that header, + +00:24:29.388 --> 00:24:31.760 +the header that is beginner-friendly + +00:24:31.760 --> 00:24:33.679 +is followed by a section that is very + +00:24:33.679 --> 00:24:35.520 +beginner-unfriendly + +00:24:35.520 --> 00:24:40.400 +that contains a series of defuns +like these ones. + +00:24:40.400 --> 00:24:44.640 +Here, the last line of the header is +this comment here. + +00:24:44.640 --> 00:24:48.559 +Then we have several defuns like this. + +00:24:48.559 --> 00:24:51.440 +Let me explain how these things work. + +00:24:51.440 --> 00:24:53.082 +Technically, what happens + +00:24:53.082 --> 00:24:56.399 +when we type M-j without any arguments + +00:24:56.399 --> 00:25:00.230 +is that it runs eejump with argument nil, + +00:25:00.230 --> 00:25:04.640 +and then this runs 5 eejumps. + +00:25:04.640 --> 00:25:07.224 +When I run M-j with a numeric argument, + +00:25:07.224 --> 00:25:13.374 +for example, with argument 5, +it runs a jump 5. + +00:25:13.374 --> 00:25:17.679 +eejump-5 concatenates this 5 one + +00:25:17.679 --> 00:25:19.999 +to make a name of a function, + +00:25:19.999 --> 00:25:21.679 +this function here. + +00:25:21.679 --> 00:25:24.720 +and it executes this function +eejump-5. + +00:25:24.720 --> 00:25:31.919 +You jump -5, and eejump-5 + +00:25:31.919 --> 00:25:35.520 +executes find-eev-quick-intro. + +00:25:35.520 --> 00:25:39.360 +If I execute just M-j, + +00:25:39.360 --> 00:25:40.533 +the section that shows + +00:25:40.533 --> 00:25:43.919 +the current jump targets + +00:25:43.919 --> 00:25:46.719 +has a line for eejump-5. This is... + +00:25:46.719 --> 00:25:52.400 +That is exactly the thing +that I was explaining before. + +00:25:52.400 --> 00:25:54.544 +So we can use M-j to navigate + +00:25:54.544 --> 00:25:59.520 +the tutorials. We can copy the links. + +00:25:59.520 --> 00:26:03.440 +Sorry. We can copy links to the + +00:26:03.440 --> 00:26:07.919 +tutorials to our notes. + +00:26:07.919 --> 00:26:11.840 +Oh, sorry, this has some typos. + +00:26:11.840 --> 00:26:14.880 +For example, if I execute this, + +00:26:14.880 --> 00:26:18.080 +I go to a section of this tutorial here + +00:26:18.080 --> 00:26:20.640 +that explains the main keys of eev. + +00:26:20.640 --> 00:26:23.670 +These things are hyperlinks. + +00:26:23.670 --> 00:26:25.597 +I can mark a hyperlink like this. + +00:26:25.597 --> 00:26:27.286 +it is just plain text. + +00:26:27.286 --> 00:26:29.525 +I can copy it to my notes. + +00:26:29.525 --> 00:26:31.760 +The idea is that every time + +00:26:31.760 --> 00:26:34.016 +that I find something that is +interesting, + +00:26:34.016 --> 00:26:36.240 +I can create a hyperlink to it. + +00:26:36.240 --> 00:26:38.513 +I can put these links in my notes + +00:26:38.513 --> 00:26:40.799 +so I can navigate back + +00:26:40.799 --> 00:26:42.667 +to all the interesting positions + +00:26:42.667 --> 00:26:48.799 +very quickly. + +00:26:48.799 --> 00:26:57.600 +Okay, next feature. +If we type M-J (uppercase), then + +00:26:57.600 --> 00:27:00.080 +this is a function that transforms + +00:27:00.080 --> 00:27:03.679 +the current line in a certain way. + +00:27:03.679 --> 00:27:06.471 +Let me give an example. +Let me isolate this. + +00:27:06.471 --> 00:27:11.039 +Let me duplicate this line +to make clear what happens. + +00:27:11.039 --> 00:27:14.240 +If I type M-J (uppercase) here, + +00:27:14.240 --> 00:27:17.561 +this line here becomes +the defun for eejump-6, + +00:27:17.561 --> 00:27:21.200 +and the target of this eejump + +00:27:21.200 --> 00:27:24.799 +is exactly this sexp here. + +00:27:24.799 --> 00:27:28.559 +Let me undo this mess. + +00:27:28.559 --> 00:27:30.815 +If the first word in the line + +00:27:30.815 --> 00:27:32.840 +is not a number... For example, + +00:27:32.840 --> 00:27:36.240 +here, let me do the same thing: + +00:27:36.240 --> 00:27:41.200 +duplicate the line and type M-J, + +00:27:41.200 --> 00:27:44.014 +then M-J (uppercase) converts that to + +00:27:44.014 --> 00:27:49.440 +a defun that defines a function +with a very short name. + +00:27:49.440 --> 00:27:52.720 +This function with a very short name + +00:27:52.720 --> 00:27:56.720 +opens this file here in the directory + +00:27:56.720 --> 00:27:59.360 +with the copy of the git repository + +00:27:59.360 --> 00:28:01.360 +for Org Mode. + +00:28:01.360 --> 00:28:05.360 +Let me undo the mess again. + +00:28:05.360 --> 00:28:14.640 +Oops. That's it. + +00:28:14.640 --> 00:28:21.279 +M-J (uppercase) is a particular case +of something that + +00:28:21.279 --> 00:28:23.708 +I use a lot in eev. + +00:28:23.708 --> 00:28:28.799 +eev has lots of commands that-- +sorry, key sequences + +00:28:28.799 --> 00:28:31.466 +that are like M- uppercase letter, + +00:28:31.466 --> 00:28:34.660 +and almost all of them operate + +00:28:34.660 --> 00:28:36.019 +on the current line and + +00:28:36.019 --> 00:28:37.616 +transform the current line + +00:28:37.616 --> 00:28:38.880 +in a certain way. + +00:28:38.880 --> 00:28:42.000 +For example, this is a filename. + +00:28:42.000 --> 00:28:45.360 +If I type M-F (uppercase) here, + +00:28:45.360 --> 00:28:47.967 +it becomes a link to that file. + +00:28:47.967 --> 00:28:50.000 +This is the name of a man page. + +00:28:50.000 --> 00:28:53.600 +If I type M-M (uppercase) here, + +00:28:53.600 --> 00:28:55.292 +it converts that to the link + +00:28:55.292 --> 00:28:58.080 +to a manpage. This is a shell command. + +00:28:58.080 --> 00:29:01.679 +If I type M-S (uppercase) here, + +00:29:01.679 --> 00:29:04.960 +it converts that to a link to a + +00:29:04.960 --> 00:29:08.720 +to find-sh (shell). + +00:29:08.720 --> 00:29:12.960 +Until a few years ago, +these functions + +00:29:12.960 --> 00:29:16.159 +with M- uppercase letter were half + +00:29:16.159 --> 00:29:18.880 +of my main ways of creating +sexp hyperlinks + +00:29:18.880 --> 00:29:20.085 +with a few key strokes. + +00:29:20.085 --> 00:29:22.399 +In the beginning, of course, +I had to create my + +00:29:22.399 --> 00:29:25.600 +sexp pipelines by typing each character. + +00:29:25.600 --> 00:29:28.640 +But after some time, I decided that + +00:29:28.640 --> 00:29:31.520 +I needed something more efficient. + +00:29:31.520 --> 00:29:38.480 +So this is the end of part one +of the presentation. + +00:29:38.480 --> 00:29:40.640 +So this is part two of the presentation, + +00:29:40.640 --> 00:29:42.070 +and the main theme here + +00:29:42.070 --> 00:29:44.320 +is the standard describe-key + +00:29:44.320 --> 00:29:46.320 +function that comes with Emacs. + +00:29:46.320 --> 00:29:49.200 +My variant of it... The thing is that + +00:29:49.200 --> 00:29:50.960 +the standard describe-key in Emacs + +00:29:50.960 --> 00:29:52.738 +is user-friendly, but it is + +00:29:52.738 --> 00:29:55.600 +hacker-unfriendly. Well, I felt so. + +00:29:55.600 --> 00:29:58.281 +When I tried to complement it + +00:29:58.281 --> 00:30:00.799 +by writing a hacker-friendly +version of it + +00:30:00.799 --> 00:30:03.919 +that produced the sexp hyperlinks +that I needed, + +00:30:03.919 --> 00:30:06.457 +I got something that +I found really lovely. + +00:30:07.039 --> 00:30:08.994 +Several of the main + +00:30:08.994 --> 00:30:12.480 +design decisions of eev can be seen there. + +00:30:12.480 --> 00:30:13.995 +When I showed my variants to + +00:30:13.995 --> 00:30:15.520 +other people, they hated it. + +00:30:15.520 --> 00:30:16.851 +They felt that it was + +00:30:16.851 --> 00:30:19.360 +totally against their notions of + +00:30:19.360 --> 00:30:23.440 +user-friendliness. + +00:30:23.440 --> 00:30:24.606 +Okay. So let's see. + +00:30:24.606 --> 00:30:26.297 +The standard describe-key, + +00:30:26.297 --> 00:30:30.401 +if I run this hyperlink here, +I get this. + +00:30:30.401 --> 00:30:31.866 +The result of running + +00:30:31.866 --> 00:30:34.399 +describe-key on the key down... + +00:30:34.399 --> 00:30:35.799 +This is a big buffer + +00:30:35.799 --> 00:30:38.080 +with some things in italics. + +00:30:38.080 --> 00:30:40.752 +Some hyperlinks here. + +00:30:40.752 --> 00:30:42.387 +These hyperlinks are standard + +00:30:42.387 --> 00:30:43.679 +in the sense that + +00:30:43.679 --> 00:30:45.407 +the targets are not visible, + +00:30:45.407 --> 00:30:47.760 +and they are implemented using + +00:30:47.760 --> 00:30:49.519 +buttons in Emacs Lisp. + +00:30:49.519 --> 00:30:52.385 +This section of the Emacs Lisp manual + +00:30:52.385 --> 00:30:56.799 +describes how buttons work. + +00:30:56.799 --> 00:31:01.957 +The source code is quite difficult. + +00:31:01.957 --> 00:31:04.240 +I mean, when I was starting to + +00:31:04.240 --> 00:31:05.721 +to try to decipher this + +00:31:05.721 --> 00:31:07.600 +when I was a beginner + +00:31:07.600 --> 00:31:11.200 +using Emacs 19.34, I felt that this + +00:31:11.200 --> 00:31:12.320 +describe-key was + +00:31:12.320 --> 00:31:15.519 +very difficult to understand. + +00:31:15.519 --> 00:31:20.080 +I felt that the the designers, + +00:31:20.080 --> 00:31:22.640 +the people who wrote it, +were sacrificing + +00:31:22.640 --> 00:31:24.839 +too much of the hacker-friendliness + +00:31:24.839 --> 00:31:27.154 +that I was expecting from it + +00:31:27.154 --> 00:31:31.279 +to make it beginner-friendly. + +00:31:31.279 --> 00:31:33.600 +Let me explain. What are the problems + +00:31:33.600 --> 00:31:35.511 +with the standard describe-key? + +00:31:35.511 --> 00:31:37.336 +If we think that hyperlinks + +00:31:37.336 --> 00:31:38.640 +are things like this + +00:31:38.640 --> 00:31:41.600 +with the target and the text, then in the + +00:31:41.600 --> 00:31:43.600 +button hyperlinks of describe-key, + +00:31:43.600 --> 00:31:46.516 +these three bad things happen. + +00:31:46.516 --> 00:31:49.983 +First, it is hard to extract +the target from the hyperlink. + +00:31:49.983 --> 00:31:52.000 +Second, it is hard to recreate + +00:31:52.000 --> 00:31:55.440 +a list of code that would +go to that target. + +00:31:55.440 --> 00:31:57.519 +Third, it is hard to copy the full + +00:31:57.519 --> 00:32:00.640 +hyperlink, including the targets +to other buffers. + +00:32:00.640 --> 00:32:04.960 +I only knew how to copy the text + +00:32:04.960 --> 00:32:06.937 +when I was trying to decipher + +00:32:06.937 --> 00:32:09.039 +what describe-key was doing. + +00:32:09.039 --> 00:32:11.679 +I created lots of hyperlinks like this + +00:32:11.679 --> 00:32:16.159 +to inspect the text properties and +things like that. + +00:32:16.159 --> 00:32:18.113 +For example, in the description + +00:32:18.113 --> 00:32:20.390 +of the key down here, + +00:32:20.390 --> 00:32:26.799 +we have a button that points to +simple.el. + +00:32:26.799 --> 00:32:29.336 +The text of that button is simple.el. + +00:32:29.336 --> 00:32:31.600 +This hyperlink goes to the + +00:32:31.600 --> 00:32:35.519 +to the middle of this +button hyperlink here. + +00:32:35.519 --> 00:32:39.120 +This hyperlink here + +00:32:39.120 --> 00:32:43.279 +goes to the middle of the button +of this button hyperlink, + +00:32:43.279 --> 00:32:46.240 +and then inspects its text properties, + +00:32:46.240 --> 00:32:51.679 +and then goes to this section here +of the description. + +00:32:51.679 --> 00:32:53.521 +So this is a high-level description + +00:32:53.521 --> 00:32:56.159 +of the text properties. + +00:32:56.159 --> 00:32:58.782 +I mean, the text properties that make it +a button. + +00:32:58.782 --> 00:33:04.320 +This is a lower-level description of +these text properties. + +00:33:04.320 --> 00:33:08.000 +The button that points to + +00:33:08.000 --> 00:33:11.440 +forward-line--sorry, the button + +00:33:11.440 --> 00:33:14.399 +whose text is forward-line, this one is + +00:33:14.399 --> 00:33:16.480 +slightly different-- + +00:33:16.480 --> 00:33:21.200 +this hyperlink here goes to the middle +of that button. + +00:33:21.200 --> 00:33:25.760 +This hyperlink goes to the middle of +that button, + +00:33:25.760 --> 00:33:28.173 +inspects its text properties, + +00:33:28.173 --> 00:33:29.360 +and goes to the section + +00:33:29.360 --> 00:33:33.617 +of this button of this help buffer here + +00:33:33.617 --> 00:33:36.399 +that describes the button + +00:33:36.399 --> 00:33:41.679 +and the lower-level view of the text +properties. + +00:33:41.679 --> 00:33:45.519 +So I started with things like this + +00:33:45.519 --> 00:33:47.866 +to understand what these buttons +were doing + +00:33:47.866 --> 00:33:49.339 +and I was able to figure out + +00:33:49.339 --> 00:33:51.620 +how these things are implemented + +00:33:51.620 --> 00:33:53.120 +in describe-key, and then + +00:33:53.120 --> 00:33:55.519 +similar help functions in Emacs. + +00:33:55.519 --> 00:33:57.506 +I discovered that one of the + +00:33:57.506 --> 00:33:59.049 +main lower-level functions + +00:33:59.049 --> 00:34:01.360 +that Emacs used for this + +00:34:01.360 --> 00:34:05.279 +is a function called +find-function-noselect. + +00:34:05.279 --> 00:34:09.929 +If I run find-function-noselect +on next line, + +00:34:11.200 --> 00:34:14.240 +it returns a pair: + +00:34:14.240 --> 00:34:18.079 +a cons made of a buffer and a position. + +00:34:18.079 --> 00:34:20.560 +So I created functions that would + +00:34:21.679 --> 00:34:24.320 +follow this. That would open that + +00:34:24.320 --> 00:34:26.510 +buffer in that position + +00:34:26.510 --> 00:34:29.679 +and then this is a postback list. + +00:34:29.679 --> 00:34:31.679 +So we could go to these positions and + +00:34:31.679 --> 00:34:33.919 +then search for this string, and another + +00:34:33.919 --> 00:34:36.000 +string, and another string, and so on. + +00:34:36.000 --> 00:34:41.040 +So this goes to the definition +of find-efunction + +00:34:41.040 --> 00:34:45.006 +and then to a string after it. + +00:34:45.006 --> 00:34:48.296 +I use these things to implement + +00:34:48.296 --> 00:34:51.839 +my own functions that pointed to the + +00:34:51.839 --> 00:34:55.339 +same targets as the button hyperlinks + +00:34:55.339 --> 00:35:00.240 +and describe-key. + +00:35:00.240 --> 00:35:02.673 +Again, let me show the comparison. + +00:35:02.673 --> 00:35:06.322 +This is the standard +describe-key here, + +00:35:06.322 --> 00:35:10.480 +and this is my variant. + +00:35:10.480 --> 00:35:13.839 +It creates a buffer with links, + +00:35:13.839 --> 00:35:17.680 +with the list of hyperlinks about this key. + +00:35:17.680 --> 00:35:20.960 +We get this. So, each one of these + +00:35:20.960 --> 00:35:22.960 +functions is either a blank line + +00:35:22.960 --> 00:35:28.720 +or an elisp hyperlink. + +00:35:28.720 --> 00:35:34.506 +Here is a slight variant of the +function find-ekey-links above. + +00:35:34.506 --> 00:35:39.280 +In this variant, the argument is a +string that has to be processed by + +00:35:39.280 --> 00:35:42.400 +read-kbd-macro to convert it to the + +00:35:42.400 --> 00:35:45.280 +lower-level format. + +00:35:45.280 --> 00:35:49.040 +Note that these functions here +that I wrote, + +00:35:49.040 --> 00:35:50.934 +they display temporary buffers + +00:35:50.934 --> 00:35:53.599 +with no help at all. + +00:35:53.599 --> 00:35:57.131 +To be honest, there's a link to + +00:35:57.131 --> 00:35:58.345 +a tutorial here, + +00:35:58.345 --> 00:36:00.467 +but this is a recent edition + +00:36:00.467 --> 00:36:03.200 +so let's ignore this. + +00:36:03.200 --> 00:36:06.640 +They display temporary buffers + +00:36:06.640 --> 00:36:07.949 +with no help at all, + +00:36:07.949 --> 00:36:09.520 +just lots of hyperlinks. + +00:36:09.520 --> 00:36:11.172 +And these hyperlinks can be... + +00:36:11.172 --> 00:36:13.359 +They are very hacker-friendly +in the sense that + +00:36:13.359 --> 00:36:15.477 +they can be followed with M-e. + +00:36:15.477 --> 00:36:17.520 +They can be copied to other + +00:36:17.520 --> 00:36:19.920 +buffers because they are plain text, + +00:36:19.920 --> 00:36:23.680 +because they are just sexp. + +00:36:23.680 --> 00:36:28.000 +And they can be inspected +in the sense that... + +00:36:28.000 --> 00:36:32.400 +For example, here, + +00:36:32.400 --> 00:36:35.520 +we have a hyperlink to a function +that we... + +00:36:35.520 --> 00:36:37.599 +It may be difficult to figure out what + +00:36:37.599 --> 00:36:39.200 +this function does, + +00:36:39.200 --> 00:36:41.600 +but we can go to that position, + +00:36:41.600 --> 00:36:45.839 +and then type C-h f to see the + +00:36:45.839 --> 00:36:48.240 +description of this function. + +00:36:48.240 --> 00:36:53.890 +And here is a hyperlink that does that + +00:36:56.000 --> 00:37:00.160 +in my syntax, say. + +00:37:00.160 --> 00:37:02.800 +This list of hyperlinks were + +00:37:02.800 --> 00:37:08.000 +generated by this code here that just + +00:37:08.000 --> 00:37:11.119 +used a back quote to generate + +00:37:11.119 --> 00:37:14.640 +lists of sexps. + +00:37:14.640 --> 00:37:18.240 +I felt that this function here + +00:37:18.240 --> 00:37:20.700 +that just generated this list + +00:37:20.700 --> 00:37:23.393 +was very easy to understand +and to modify, + +00:37:23.393 --> 00:37:28.480 +so this was hacker-friendly +in the way that I wanted. + +00:37:28.480 --> 00:37:31.599 +So I started using this, + +00:37:31.599 --> 00:37:33.459 +and this idea of using buffers + +00:37:33.459 --> 00:37:36.066 +with sexp hyperlinks and no help + +00:37:36.066 --> 00:37:38.720 +violated all the notions +of user-friendliness + +00:37:38.720 --> 00:37:40.079 +that I knew, so I was + +00:37:40.079 --> 00:37:41.504 +exploring something new + +00:37:41.504 --> 00:37:46.160 +at that time. This is the end of +part two. + +00:37:46.160 --> 00:37:49.359 +Part three of this presentation is + +00:37:49.359 --> 00:37:51.735 +about the killer features of eev, + +00:37:51.735 --> 00:37:53.778 +or why everybody should use eev + +00:37:53.778 --> 00:37:55.789 +or at least have eev installed + +00:37:55.789 --> 00:37:59.280 +even if they think that eev +is too weird. + +00:37:59.280 --> 00:38:01.200 +So this is a very quick listing. + +00:38:01.200 --> 00:38:04.240 +eev has elisp hyperlinks +which are super nice. + +00:38:04.240 --> 00:38:06.050 +It comes with lots of tutorials. + +00:38:06.050 --> 00:38:10.800 +The main one here explains all the +main features. + +00:38:10.800 --> 00:38:14.079 +There's also a tutorial that's + +00:38:14.079 --> 00:38:18.079 +an index of all the other tutorials here. + +00:38:18.079 --> 00:38:20.509 +Many, many, many tutorials. + +00:38:20.509 --> 00:38:24.079 +If we forget everything, +we can just type M-j. + +00:38:24.079 --> 00:38:28.104 +Remember that this part here +is beginner-friendly, + +00:38:28.104 --> 00:38:32.960 +and the rest is +beginner-unfriendly. + +00:38:32.960 --> 00:38:38.320 +There's a tutorial on Emacs Lisp here. + +00:38:38.320 --> 00:38:41.920 +It mainly explains how to understand + +00:38:41.920 --> 00:38:44.640 +Elisp code, which is much easier than... + +00:38:44.640 --> 00:38:46.673 +It's much easier to understand +Elisp code + +00:38:46.673 --> 00:38:50.160 +than to understand how to +program in Elisp. + +00:38:50.160 --> 00:38:53.440 +Most people are only going to need this. + +00:38:53.440 --> 00:38:55.368 +eev is very easy to install. + +00:38:55.368 --> 00:38:58.240 +It's in ELPA, so we just need to do + +00:38:58.240 --> 00:39:03.520 +this thing here, and it's very +non-invasive. + +00:39:03.520 --> 00:39:05.472 +Years ago, several years ago, + +00:39:05.472 --> 00:39:07.039 +it was a very invasive package, + +00:39:07.039 --> 00:39:08.960 +but then I changed everything. + +00:39:08.960 --> 00:39:13.520 +Now, if we toggle eev-mode on and off, + +00:39:13.520 --> 00:39:16.320 +what's going to happen is just that + +00:39:16.320 --> 00:39:21.599 +the eev-keymap becomes activated or +deactivated. + +00:39:21.599 --> 00:39:24.720 +When we install eev-- + +00:39:24.720 --> 00:39:27.064 +I mean when we require eev, + +00:39:27.064 --> 00:39:32.640 +the only things that happens globally +are these things here: + +00:39:32.640 --> 00:39:34.993 +several functions and variables +become defined. + +00:39:34.993 --> 00:39:40.079 +All of them have standard prefixes, +except for one. + +00:39:40.079 --> 00:39:43.040 +Three characters are changed in the + +00:39:43.040 --> 00:39:44.480 +standard display table + +00:39:44.480 --> 00:39:48.640 +to make them appear as colored glyphs: + +00:39:48.640 --> 00:39:52.780 +the red star, the open +double angle brackets, + +00:39:52.780 --> 00:39:58.160 +and the closed double angle brackets. + +00:39:58.160 --> 00:40:01.359 +Two environment variables are set. + +00:40:01.359 --> 00:40:04.560 +This is a trivial technicality. + +00:40:04.560 --> 00:40:10.800 +We just run a defadvice around one +function that is used by "man." + +00:40:10.800 --> 00:40:18.400 +Also, eev has a very high +discoverability factor. + +00:40:18.400 --> 00:40:22.135 +There's a way to create, +a very easy way + +00:40:22.135 --> 00:40:25.200 +to create a hyperlink to here. + +00:40:25.200 --> 00:40:27.760 +I do not have time to show this now, + +00:40:27.760 --> 00:40:31.200 +but for example, if I'm here +in a tutorial, + +00:40:31.200 --> 00:40:35.736 +and I think that this section +is something interesting + +00:40:35.736 --> 00:40:39.520 +and I want to create a hyperlink to it, + +00:40:39.520 --> 00:40:43.040 +I just have to type a certain key +sequence here, + +00:40:43.040 --> 00:40:45.783 +and here I got a hyperlink + +00:40:45.783 --> 00:40:48.269 +that I can copy to my notes, + +00:40:48.269 --> 00:40:52.260 +and this hyperlink goes to that section. + +00:40:58.240 --> 00:41:02.092 +We have hyperlinks that point to +specific positions + +00:41:02.092 --> 00:41:05.382 +in PDF documents and in video files. + +00:41:05.382 --> 00:41:09.119 +Here, this one opens a PDF +and displays it. + +00:41:09.119 --> 00:41:13.920 +This one opens a PDF +and converts it to text. + +00:41:13.920 --> 00:41:18.400 +and this one opens the video in a +certain position. + +00:41:18.400 --> 00:41:20.480 +We also have a way to control + +00:41:20.480 --> 00:41:22.079 +shell-like programs. + +00:41:22.079 --> 00:41:25.111 +In my presentation of the last year, + +00:41:25.111 --> 00:41:28.163 +I spent one third of the presentation +explaining this, + +00:41:28.163 --> 00:41:31.839 +and I think that I gave a very good +demonstration there. + +00:41:31.839 --> 00:41:35.680 +The demonstration is here. + +00:41:35.680 --> 00:41:37.908 +We can go to the web page, + +00:41:37.908 --> 00:41:41.839 +go to this section of the web page, + +00:41:41.839 --> 00:41:47.680 +and start by this point. + +00:41:47.680 --> 00:41:55.920 +And here we have an explanation +and so on. Whatever. + +00:41:55.920 --> 00:41:58.720 +I've already mentioned this before. + +00:41:59.200 --> 00:42:02.240 +eev comes with a very nice Elisp +tutorial. + +00:42:02.240 --> 00:42:05.599 +So that's it. This is the end of part +three. + +00:42:05.599 --> 00:42:08.103 +So this is the last part of my +presentation, + +00:42:08.103 --> 00:42:10.965 +and it's about the title of the +presentation. + +00:42:10.965 --> 00:42:13.599 +I called the presentation, "Why + +00:42:13.599 --> 00:42:16.560 +Most of the Best Features in eev Look + +00:42:16.560 --> 00:42:20.480 +Like Five-Minute Hacks." I've already + +00:42:20.480 --> 00:42:23.920 +run out of time, so I have to skip this + +00:42:23.920 --> 00:42:28.485 +first part here in which +I describe how + +00:42:28.485 --> 00:42:33.440 +I was exposed to several different +notions of user-friendliness, + +00:42:33.440 --> 00:42:35.920 +and how the one that really blew my mind + +00:42:35.920 --> 00:42:41.680 +was the one in a certain +Forth environment. + +00:42:41.680 --> 00:42:44.160 +Let me make the long, long story + +00:42:44.160 --> 00:42:46.560 +very, very short. + +00:42:46.560 --> 00:42:49.280 +In all this process, I switched from + +00:42:49.680 --> 00:42:52.960 +the belief that the user was always +someone else, + +00:42:52.960 --> 00:42:55.359 +someone external, and that I always + +00:42:55.359 --> 00:42:57.040 +had to write my programs for + +00:42:57.040 --> 00:43:00.079 +this external user. I switched + +00:43:00.079 --> 00:43:00.173 +from that to the belief + +00:43:00.173 --> 00:43:03.200 +that I am the user. + +00:43:03.200 --> 00:43:06.319 +I can play with the interface +that I want. + +00:43:06.319 --> 00:43:10.079 +I can write programs + +00:43:10.079 --> 00:43:11.786 +that only I am going to understand. + +00:43:11.786 --> 00:43:14.240 +I can experiment with +hundreds of interfaces, + +00:43:14.240 --> 00:43:16.079 +select the best ones, + +00:43:16.079 --> 00:43:18.720 +document them, and then share them + +00:43:18.720 --> 00:43:20.960 +with other people + +00:43:20.960 --> 00:43:24.056 +who are also experimenting +with interfaces + +00:43:24.056 --> 00:43:27.050 +in their own ways. + +00:43:27.050 --> 00:43:30.879 +So eev has lots of things +that are user-friendly + +00:43:30.879 --> 00:43:34.880 +in these unusual ways that I've +explained before. + +00:43:34.880 --> 00:43:37.160 +If we consider that + +00:43:37.160 --> 00:43:40.319 +this notion of user-friendliness +is valid, + +00:43:40.319 --> 00:43:44.651 +then these things that eev implements, + +00:43:44.651 --> 00:43:46.904 +they are user-friendly +and hacker-friendly + +00:43:46.904 --> 00:43:48.800 +at the same time. + +00:43:48.800 --> 00:43:50.346 +Let me show one example. + +00:43:51.119 --> 00:43:56.640 +This is one that really took me only +five minutes to implement. + +00:43:56.640 --> 00:43:59.430 +At one point a few months ago, + +00:43:59.430 --> 00:44:05.599 +I discovered that Sacha Chua's weekly +posts about Emacs News + +00:44:05.599 --> 00:44:08.800 +were also being posted to a + +00:44:08.800 --> 00:44:12.893 +mailing list that is stored at +lists.gnu.org, + +00:44:12.893 --> 00:44:16.319 +and it's called emacs-tangents. + +00:44:16.319 --> 00:44:19.760 +I found a way to create + +00:44:19.760 --> 00:44:25.440 +the links to the posts in both places, + +00:44:25.440 --> 00:44:28.178 +but I had to use a template for that. + +00:44:28.178 --> 00:44:30.640 +So what we are seeing here now + +00:44:30.640 --> 00:44:33.221 +is a template with +the default values. + +00:44:33.221 --> 00:44:38.243 +So this means that we have not set the +year correctly. + +00:44:38.243 --> 00:44:40.720 +We have not set the month correctly, + +00:44:40.720 --> 00:44:42.173 +or the day correctly, + +00:44:42.173 --> 00:44:45.462 +but if we run this sexp here... + +00:44:45.462 --> 00:44:48.960 +Let me do something else before... + +00:44:48.960 --> 00:44:53.359 +If we run this sexp here, + +00:44:53.359 --> 00:45:00.880 +we change some of these entries + +00:45:00.880 --> 00:45:05.200 +in the template, and we get +these links here. + +00:45:05.200 --> 00:45:07.719 +They all work. For example, + +00:45:07.719 --> 00:45:13.552 +this one opens the blog post in +Sacha Chua's site, + +00:45:13.552 --> 00:45:21.280 +and this one opens it +in the mailing list. + +00:45:21.280 --> 00:45:23.672 +Sometimes I want +the Org source of that, + +00:45:23.672 --> 00:45:26.520 +and the easiest way +to get the Org source + +00:45:26.520 --> 00:45:31.680 +is to look at this link here +that has an attachment. + +00:45:31.680 --> 00:45:35.839 +If I take this link here, + +00:45:35.839 --> 00:45:43.342 +and I take this stem that points to the +attachment, and I put it here, + +00:45:43.342 --> 00:45:45.440 +and I generate this page again + +00:45:45.440 --> 00:45:50.000 +with all this data, +then I get a script here + +00:45:50.000 --> 00:45:51.673 +that downloads... + +00:45:51.673 --> 00:45:54.640 +Let me switch to a smaller font. + +00:45:54.640 --> 00:45:58.160 +It downloads this attachment + +00:45:58.160 --> 00:46:01.599 +and it renames that attachment to +something: + +00:46:01.599 --> 00:46:06.000 +./emacs-news -- sorry, something's... + +00:46:06.000 --> 00:46:10.720 +-emacs-news-something + +00:46:10.720 --> 00:46:15.119 +something emacs-news.org here. + +00:46:15.119 --> 00:46:16.750 +The file is already here, + +00:46:16.750 --> 00:46:18.400 +already with the right name. + +00:46:18.400 --> 00:46:22.079 +So I can open it with +just this hyperlink. + +00:46:22.079 --> 00:46:23.780 +Let me go to the big font again. + +00:46:25.200 --> 00:46:28.673 +And now I have the Org source +for that hyperlink-- + +00:46:28.673 --> 00:46:33.839 +Sorry, for that blog post. + +00:46:33.839 --> 00:46:37.911 +And so this one-line thing here + +00:46:37.911 --> 00:46:40.960 +is, in a sense, + +00:46:40.960 --> 00:46:45.119 +a hyperlink to this blog post +in all its formats. + +00:46:45.119 --> 00:46:48.640 +If I execute this, I get links to + +00:46:48.640 --> 00:46:52.000 +all the places where it is posted, + +00:46:52.000 --> 00:46:56.000 +and I get a script to +download the local copy + +00:46:56.000 --> 00:47:00.480 +of the Org source of it. And that's it. + +00:47:00.480 --> 00:47:02.506 +Well, I'm already out of time, + +00:47:02.506 --> 00:47:04.480 +so let me finish here. + +00:47:04.480 --> 00:47:10.079 +Thanks. Bye. -- cgit v1.2.3