WEBVTT Kind: captions Language: en-GB 00:00:54.000 --> 00:00:55.000 00:00:55.000 --> 00:00:57.000 Hi! My name is Eduardo Ochs. I'm the 00:00:57.000 --> 00:01:00.000 author of an Emacs package called eev and 00:01:00.000 --> 00:01:03.000 the title of this video is 00:01:03.000 --> 00:01:05.000 "Some problems of modernizing Emacs". 00:01:05.000 --> 00:01:08.000 Here is a summary of the main themes 00:01:08.000 --> 00:01:10.000 of this video. I'm going to talk mainly 00:01:10.000 --> 00:01:12.000 about these four things here. The first 00:01:12.000 --> 00:01:15.000 one is that Emacs has changed a lot in its 00:01:15.000 --> 00:01:18.000 recent versions, and now it has lots of 00:01:18.000 --> 00:01:21.000 types... so if we want to look under the 00:01:21.000 --> 00:01:24.000 hood and to understand what Emacs 00:01:24.000 --> 00:01:27.000 really does we are going to stumble on 00:01:27.000 --> 00:01:30.000 lots of types... and the 00:01:30.000 --> 00:01:34.000 current tree of classes and types 00:01:34.000 --> 00:01:37.000 looks like this... that is, 00:01:37.000 --> 00:01:46.000 is quite big. 00:01:46.000 --> 00:01:49.000 The second theme is that people used 00:01:49.000 --> 00:01:53.000 to say things like "Anyone can learn Lisp 00:01:53.000 --> 00:01:56.000 in one day"... I'm going to explain 00:01:56.000 --> 00:02:01.000 this quote, and I'm also going to show 00:02:01.000 --> 00:02:04.000 that now this is gone... anyway. This is a 00:02:04.000 --> 00:02:08.000 very short summary... details soon. 00:02:08.000 --> 00:02:10.000 I will also show how to display 00:02:10.000 --> 00:02:13.000 better "inner views" of Emacs objects... 00:02:13.000 --> 00:02:16.000 I'm going to Define what is an inner view, 00:02:16.000 --> 00:02:18.000 of course. 00:02:18.000 --> 00:02:20.000 The main trick is that we are going 00:02:20.000 --> 00:02:24.000 to use one of the ways of displaying 00:02:24.000 --> 00:02:29.000 internal objects, that is the `cl-print' 00:02:29.000 --> 00:02:32.000 family of functions, for example, 00:02:32.000 --> 00:02:35.000 `cl-prin1-to-string', and here are some 00:02:35.000 --> 00:02:37.000 examples of the kind of output that we 00:02:37.000 --> 00:02:38.000 are going to see... 00:02:38.000 --> 00:02:44.000 for example, if we run these two lines 00:02:44.000 --> 00:02:47.000 here the first line defines a function `foo' 00:02:47.000 --> 00:02:52.000 and the second line sets `o' to the 00:02:52.000 --> 00:02:54.000 internal view of the definition of `foo'. 00:02:54.000 --> 00:02:59.000 In older Emacses `o' would be just a 00:02:59.000 --> 00:03:02.000 list that looks... that would look very 00:03:02.000 --> 00:03:05.000 similar to this line here... but in newer 00:03:05.000 --> 00:03:09.000 Emacses the result of this - I mean, the 00:03:09.000 --> 00:03:12.000 the contents of `o' is this thing here, 00:03:12.000 --> 00:03:15.000 that looks quite different 00:03:15.000 --> 00:03:18.000 from this definition. 00:03:18.000 --> 00:03:21.000 So, in older Emacses 00:03:21.000 --> 00:03:25.000 the contents of the 00:03:25.000 --> 00:03:28.000 function cell of `o'... 00:03:28.000 --> 00:03:30.000 sorry, of the function cell of `foo', 00:03:30.000 --> 00:03:32.000 would be an "old-style lambda", 00:03:32.000 --> 00:03:35.000 that would be just a list like this... 00:03:35.000 --> 00:03:39.000 and in newer Emacses uh the contents of O would 00:03:39.000 --> 00:03:42.000 be a "vector-like lambda"... look for the 00:03:42.000 --> 00:03:44.000 square brackets here - this is a 00:03:44.000 --> 00:03:47.000 vector, but it is preceded by a hash sign. 00:03:47.000 --> 00:03:49.000 So this is what we call 00:03:49.000 --> 00:03:51.000 a "vector-like lambda", 00:03:51.000 --> 00:03:53.000 and vector-like lambas do not 00:03:53.000 --> 00:03:55.000 have a canonical printed representation - 00:03:55.000 --> 00:03:57.000 they have at least two semicanonical 00:03:57.000 --> 00:03:59.000 printed representations... 00:03:59.000 --> 00:04:01.000 The first semicanonical 00:04:01.000 --> 00:04:04.000 printed representation is this one, that is 00:04:04.000 --> 00:04:07.000 generated by a family of functions with 00:04:07.000 --> 00:04:09.000 names like `prin1'... 00:04:09.000 --> 00:04:13.000 and the second semicanonical printed 00:04:13.000 --> 00:04:17.000 representation is like this - 00:04:17.000 --> 00:04:20.000 it looks like a list... 00:04:20.000 --> 00:04:23.000 it looks somewhat like this definition 00:04:23.000 --> 00:04:27.000 of `foo' here, but it has this 00:04:27.000 --> 00:04:29.000 `:dynbind' symbol here... 00:04:29.000 --> 00:04:32.000 and it turns out that when we use 00:04:32.000 --> 00:04:35.000 the `cl-print' family of functions we can 00:04:35.000 --> 00:04:37.000 reconfigure how things are printed... 00:04:37.000 --> 00:04:40.000 and I'm going to show several interesting 00:04:40.000 --> 00:04:47.000 ways of reconfiguring how lambdas are printed, 00:04:47.000 --> 00:04:49.000 and one of the ways is going to 00:04:49.000 --> 00:04:52.000 be like this. 00:04:52.000 --> 00:04:56.000 We can also use the `cl-print' 00:04:56.000 --> 00:04:59.000 functions with my indentation tricks to 00:04:59.000 --> 00:05:04.000 to display how types, or classes, are 00:05:04.000 --> 00:05:07.000 viewed internally by Emacs, and this is a 00:05:07.000 --> 00:05:10.000 big example... 00:05:10.000 --> 00:05:14.000 This is what Emacs considers as being 00:05:14.000 --> 00:05:16.000 the definition of the type 00:05:16.000 --> 00:05:18.000 `cl-structure-class', 00:05:18.000 --> 00:05:21.000 class and it is this big thing here. 00:05:21.000 --> 00:05:24.000 I edited it very lightly... 00:05:24.000 --> 00:05:30.000 I just uh deleted some line breaks here. 00:05:30.000 --> 00:05:33.000 And another thing that I want to to 00:05:33.000 --> 00:05:35.000 explain is that Emacs 00:05:35.000 --> 00:05:37.000 has some help functions that 00:05:37.000 --> 00:05:39.000 I have never liked... 00:05:39.000 --> 00:05:41.000 for most people they are good enough, 00:05:41.000 --> 00:05:44.000 but for me they aren't... they... 00:05:44.000 --> 00:05:48.000 uh, well - I'm going to say 00:05:48.000 --> 00:05:50.000 more about this later... 00:05:50.000 --> 00:05:52.000 and, for example, 00:05:52.000 --> 00:05:54.000 if we want a description of what is 00:05:54.000 --> 00:05:58.000 this type here, that we just saw in 00:05:58.000 --> 00:06:00.000 its internal view here... 00:06:00.000 --> 00:06:02.000 we can run either `describe-type' 00:06:02.000 --> 00:06:04.000 or my variant of `describe-type', 00:06:04.000 --> 00:06:07.000 and we get a help buffer 00:06:07.000 --> 00:06:10.000 that looks like this, in which 00:06:10.000 --> 00:06:13.000 these blue things that are underlined 00:06:13.000 --> 00:06:15.000 are "buttons", in the classical sense... 00:06:15.000 --> 00:06:17.000 you can click on these buttons, or type 00:06:17.000 --> 00:06:19.000 RET on these buttons, and you will be 00:06:19.000 --> 00:06:22.000 taken to another help page, that is 00:06:22.000 --> 00:06:24.000 generated dynamically... 00:06:24.000 --> 00:06:28.000 and you can navigate back and forth... 00:06:28.000 --> 00:06:30.000 and well, whatever... 00:06:30.000 --> 00:06:33.000 and I'm going to explain my 00:06:33.000 --> 00:06:35.000 problems with these kinds of help buffers 00:06:35.000 --> 00:06:37.000 and what I'm trying to do to 00:06:37.000 --> 00:06:41.000 overcome these problems... 00:06:41.000 --> 00:06:43.000 One of my slogans in this video 00:06:43.000 --> 00:06:43.000 is going to be this one: 00:06:43.000 --> 00:06:45.000 "Anyone can learn Lisp in one day". 00:06:45.000 --> 00:06:49.000 this is a part of a bigger quote 00:06:49.000 --> 00:06:51.000 that I took from a keynote presentation 00:06:51.000 --> 00:06:54.000 by Abelson and Sussman, who 00:06:54.000 --> 00:06:58.000 are two dinosaurs of Computer Science... 00:06:58.000 --> 00:07:00.000 Here is the full quote: 00:07:00.000 --> 00:07:04.000 "Anyone can learn Lisp in one day - 00:07:04.000 --> 00:07:06.000 except that if they already know Fortran 00:07:06.000 --> 00:07:11.000 then it would take three days." 00:07:11.000 --> 00:07:24.000 This is a frame of the video... 00:07:24.000 --> 00:07:28.000 By the way I am going to to add 00:07:28.000 --> 00:07:32.000 this... "and if the person is starting 00:07:32.000 --> 00:07:34.000 with Doom Emacs then it would take 5 years." 00:07:34.000 --> 00:07:39.000 why? I'm going to explain why. 00:07:39.000 --> 00:07:43.000 This is how Emacs used to be. 00:07:43.000 --> 00:07:46.000 If we execute these two expressions here 00:07:46.000 --> 00:07:51.000 the first one... sorry, each symbol can 00:07:51.000 --> 00:07:53.000 have two "values", 00:07:53.000 --> 00:07:54.000 one is its "value as a variable" 00:07:54.000 --> 00:07:58.000 and another one is its "value as a function"... 00:07:58.000 --> 00:08:02.000 and if we run this we store 42 00:08:02.000 --> 00:08:07.000 in the "value cell" of the symbol `foo', and 00:08:07.000 --> 00:08:11.000 if we run this defun here it stores a 00:08:11.000 --> 00:08:14.000 certain anonymous function in the 00:08:14.000 --> 00:08:18.000 "function cell" of the symbol `foo'... 00:08:18.000 --> 00:08:22.000 and in Emacs, until some time ago 00:08:22.000 --> 00:08:27.000 if we did that and and if we ran 00:08:27.000 --> 00:08:30.000 this expression here the result 00:08:30.000 --> 00:08:31.000 would be 42, 00:08:31.000 --> 00:08:35.000 because of this line here, and if we 00:08:35.000 --> 00:08:37.000 ran this line here the result would be 00:08:37.000 --> 00:08:40.000 the anonymous function corresponding to 00:08:40.000 --> 00:08:41.000 this defun here... 00:08:41.000 --> 00:08:45.000 but now this has changed... 00:08:45.000 --> 00:08:48.000 the result of this thing here is this 00:08:48.000 --> 00:08:51.000 vector-like lambda here - but that doesn't 00:08:51.000 --> 00:08:54.000 matter much now... 00:08:54.000 --> 00:08:56.000 So, until some time ago 00:08:56.000 --> 00:08:58.000 if we did that and if we ran 00:08:58.000 --> 00:09:01.000 this expression here, (foo foo)... 00:09:01.000 --> 00:09:04.000 Emacs would do this: it would 00:09:04.000 --> 00:09:06.000 replace the first `foo' by this 00:09:06.000 --> 00:09:09.000 anonymous function here, it would replace 00:09:09.000 --> 00:09:11.000 the second `foo' by the value of `foo' as a 00:09:11.000 --> 00:09:13.000 variable, that is 42, 00:09:13.000 --> 00:09:16.000 and it would evaluate this, and the 00:09:16.000 --> 00:09:20.000 result would be 420. 00:09:20.000 --> 00:09:23.000 So, again, we used to have this slogan 00:09:23.000 --> 00:09:26.000 here, "anyone can learn Lisp in one day"... 00:09:26.000 --> 00:09:28.000 but now this is gone. 00:09:28.000 --> 00:09:30.000 Let me show... let me talk 00:09:30.000 --> 00:09:34.000 a bit more about why... 00:09:34.000 --> 00:09:36.000 the title of this slide is 00:09:36.000 --> 00:09:38.000 "Lambdas for beginners broken"... 00:09:38.000 --> 00:09:41.000 if we run this, as I've shown 00:09:41.000 --> 00:09:43.000 in the previous slide... 00:09:43.000 --> 00:09:45.000 in the old style, in old Emacses, 00:09:45.000 --> 00:09:47.000 the result of (symbol-function 'foo) 00:09:47.000 --> 00:09:49.000 would be this anonymous function here... 00:09:49.000 --> 00:09:54.000 and now we get this strange thing here. 00:09:54.000 --> 00:09:58.000 So, this is an "old-style lambda", 00:09:58.000 --> 00:10:02.000 this is a "vector-like lambda", 00:10:02.000 --> 00:10:05.000 and until the middle of 2024 00:10:05.000 --> 00:10:08.000 beginners could learn a lot of Lisp 00:10:08.000 --> 00:10:11.000 by thinking only in terms of 00:10:11.000 --> 00:10:13.000 objects like these... 00:10:13.000 --> 00:10:15.000 this is a function and this 00:10:15.000 --> 00:10:17.000 is an anonymous function, and 00:10:17.000 --> 00:10:20.000 they would learn how to draw cons cell 00:10:20.000 --> 00:10:23.000 diagrams like this thing here and this 00:10:23.000 --> 00:10:25.000 thing here... 00:10:25.000 --> 00:10:27.000 they would think on lists as 00:10:27.000 --> 00:10:29.000 being these trees here, and they 00:10:29.000 --> 00:10:32.000 would be able to understand a lot of 00:10:32.000 --> 00:10:35.000 Lisp just by thinking in these terms... 00:10:35.000 --> 00:10:39.000 and then vector-like lambdas started 00:10:39.000 --> 00:10:43.000 to appear in many places... and if we use 00:10:43.000 --> 00:10:46.000 "vector-like lambdas" in a wide sense, 00:10:46.000 --> 00:10:50.000 to mean all the new objects, 00:10:50.000 --> 00:10:54.000 these new objects, that are 00:10:54.000 --> 00:10:56.000 difficult to visualize... they also started 00:10:56.000 --> 00:10:58.000 to appear in many places. 00:10:58.000 --> 00:11:01.000 This is a continuation of the 00:11:01.000 --> 00:11:04.000 previous slide - this part here is a copy 00:11:04.000 --> 00:11:06.000 of things that were in the previous slide... 00:11:06.000 --> 00:11:12.000 before 2024 beginners could 00:11:12.000 --> 00:11:17.000 open black boxes like this... 00:11:17.000 --> 00:11:20.000 they could try to see what was in the 00:11:20.000 --> 00:11:24.000 function cell of the symbol `foo'... 00:11:24.000 --> 00:11:27.000 and they would see something elegant and 00:11:27.000 --> 00:11:29.000 mind-blowing... and they would start to love 00:11:29.000 --> 00:11:31.000 Lisp immediately. 00:11:31.000 --> 00:11:33.000 Now what they get - what they see - 00:11:33.000 --> 00:11:35.000 is a tiny part of a very complex structure 00:11:35.000 --> 00:11:39.000 that is very powerful but that is 00:11:39.000 --> 00:11:41.000 very difficult to understand... 00:11:41.000 --> 00:11:44.000 and now our beginners are overwhelmed 00:11:44.000 --> 00:11:46.000 instead of mind-blown. 00:11:46.000 --> 00:11:48.000 Note that I said "black box" here. 00:11:48.000 --> 00:11:52.000 Let me explain the term. 00:11:52.000 --> 00:11:57.000 We can open what's inside of `foo'... 00:11:57.000 --> 00:11:59.000 we can open `foo' to see the contents of 00:11:59.000 --> 00:12:02.000 the symbol `foo', and we can try to see 00:12:02.000 --> 00:12:06.000 what's in the function cell of the 00:12:06.000 --> 00:12:08.000 symbol `foo'... 00:12:08.000 --> 00:12:10.000 so we can open the box, but what we get 00:12:10.000 --> 00:12:13.000 is something very difficult to understand, 00:12:13.000 --> 00:12:17.000 and so I'm going to say that 00:12:17.000 --> 00:12:21.000 when this happens that box is black. 00:12:21.000 --> 00:12:23.000 It is not totally black - we can open open it - 00:12:23.000 --> 00:12:26.000 but we don't understand what is going on there, 00:12:26.000 --> 00:12:30.000 so we declare that that is black. 00:12:30.000 --> 00:12:33.000 And... when these things started to happen 00:12:33.000 --> 00:12:38.000 _I_ was overwhelmed - 00:12:38.000 --> 00:12:40.000 and in this video I'm going to pretend 00:12:40.000 --> 00:12:44.000 that I was not the only person 00:12:44.000 --> 00:12:46.000 that was overwhelmed 00:12:46.000 --> 00:12:50.000 by these new structures 00:12:50.000 --> 00:12:52.000 that are not so elegant 00:12:52.000 --> 00:12:54.000 as the ones that we had before. 00:12:54.000 --> 00:12:56.000 Anyway... 00:12:56.000 --> 00:20:38.000