WEBVTT captioned by rodrigo NOTE Introduction 00:00:01.750 --> 00:00:11.969 Welcome everyone to my EmacsConf presentation, 00:00:15.370 --> 00:00:22.089 where we're going to look at Lisp's vdemo[??] app from 1978, 00:00:22.139 --> 00:00:25.659 but done in modern Elisp. 00:00:28.460 --> 00:00:33.039 Then we're going to look at getting inferior-lisp working, 00:00:33.390 --> 00:00:34.753 my dear Common Lisp. 00:00:37.003 --> 00:00:42.059 Then we're going to use the Common Lisp interface manager, 00:00:42.159 --> 00:00:45.663 the open source child of the Common Lisp interface manager, 00:00:47.813 --> 00:00:52.959 McCLIM, from inferior-lisp in Superior Lisp, 00:00:55.710 --> 00:00:58.325 which is the opposite order that I initially thought 00:00:58.375 --> 00:00:59.276 we were going to do things in, 00:00:59.326 --> 00:01:00.779 but this is how it's kind of turned out. 00:01:00.829 --> 00:01:01.795 So it's this article, 00:01:01.845 --> 00:01:05.199 I thought, from 1978, was interesting to us today. 00:01:05.999 --> 00:01:08.702 “Programming in an Interactive Environment: 00:01:08.752 --> 00:01:11.805 the ‘Lisp’ Experience.” 00:01:12.005 --> 00:01:17.678 Explaining what all these LISP programmers were doing to 00:01:19.478 --> 00:01:22.466 people unfamiliar with LISP programming. 00:01:22.566 --> 00:01:24.401 “LISP systems have been used for 00:01:24.451 --> 00:01:27.454 highly interactive programming for more than a decade.” 00:01:27.604 --> 00:01:29.790 This was from 1978. 00:01:29.990 --> 00:01:31.959 And we're just going to go and, 00:01:34.109 --> 00:01:39.717 almost verbatim, port the demo application for LISP 00:01:40.017 --> 00:01:46.119 out of 1978 Interlisp and into Emacs Lisp. 00:01:49.720 --> 00:01:51.428 And we're going to do it without Org Mode, 00:01:51.478 --> 00:01:54.231 because I think everyone is finding out 00:01:54.281 --> 00:01:56.950 how great Org Mode is already. 00:01:58.100 --> 00:02:00.787 For inferior Lisp, I thought instead of org-mode, 00:02:00.837 --> 00:02:02.823 we'll theme it around slime-mode and then it turned out 00:02:02.873 --> 00:02:06.059 most of this presentation happens in Emacs Lisp, 00:02:06.109 --> 00:02:08.929 because this is an Emacs Lisp conference. 00:02:09.379 --> 00:02:12.799 But I found out that there's ielm-mode, 00:02:12.849 --> 00:02:17.604 which is pretty similar to slime-mode, 00:02:19.054 --> 00:02:23.610 but in our hearts, we can imagine that this is 00:02:23.660 --> 00:02:27.448 an Emacs example, homed around slime-mode, 00:02:27.498 --> 00:02:33.353 Superior Lisp Interaction Mode for Emacs, instead of org-mode. 00:02:33.403 --> 00:02:36.390 Though, you know, I do secretly use org-mode as well, 00:02:36.440 --> 00:02:37.858 not very secretly. 00:02:37.958 --> 00:02:40.539 But that means we're kind of improvising, 00:02:46.790 --> 00:02:48.786 improvising a presentation mode. 00:02:49.986 --> 00:02:55.576 So we have this big buffer of Elisp, and let's just... 00:02:56.726 --> 00:02:59.164 This is me, not Sandewall, out of interest, 00:03:00.614 --> 00:03:02.616 let's make a keyboard macro, 00:03:04.216 --> 00:03:10.240 go get the S-expression wherever the cursor is, 00:03:10.290 --> 00:03:13.611 move it to the next S-expression, paste it in here, 00:03:13.661 --> 00:03:15.989 and the keyboard macro, alright. 00:03:20.190 --> 00:03:21.652 What was basically happening... NOTE Calendar 00:03:21.702 --> 00:03:25.306 So the demo application in this case is 00:03:25.356 --> 00:03:27.842 a scheduling application. 00:03:28.792 --> 00:03:34.631 And so you can imagine improvising a calendar like this 00:03:34.731 --> 00:03:36.633 if you weren't existingly using an 00:03:36.683 --> 00:03:38.952 org-mode integrated calendar. 00:03:39.252 --> 00:03:42.739 So, you know, just have a list and maybe 00:03:43.989 --> 00:03:49.479 each list is of sublists, where the first element, 00:03:49.579 --> 00:03:51.531 the car of the sublist, I guess, 00:03:51.931 --> 00:03:55.669 is a sensible-sounding date format, like sat dec 7, 00:03:56.119 --> 00:03:59.589 this is clearly the first day of EmacsConf. 00:03:59.939 --> 00:04:06.230 Then after that, a list of basically from and to times, 00:04:06.280 --> 00:04:18.592 and then a quick written description of whatever event 00:04:18.642 --> 00:04:19.576 was at that time. 00:04:19.876 --> 00:04:23.130 So similar to what we were seeing recently 00:04:23.180 --> 00:04:25.449 as of me recording this in our Structure and 00:04:25.499 --> 00:04:28.902 Interpretation of Computer Programs study group, 00:04:29.902 --> 00:04:35.709 you have all these little methods, sorry, defuns. 00:04:35.759 --> 00:04:39.513 So hours of a time is actually just car of the time, 00:04:40.763 --> 00:04:42.966 minutes of the time, cadr of time. 00:04:43.216 --> 00:04:46.719 And so we all know these kind of little, 00:04:46.720 --> 00:04:50.173 basically turning car and cadr, 00:04:50.223 --> 00:04:53.093 which we do use into descriptive names like from and to. 00:04:53.143 --> 00:04:56.329 You can see how this lines up with the appointments. 00:04:56.379 --> 00:05:01.701 So for "reproducibly building emacs" described event, 00:05:01.751 --> 00:05:05.679 I guess from would be 16 25. 00:05:05.680 --> 00:05:07.658 Let's just grab that and literally use those, 00:05:07.708 --> 00:05:11.011 because we're in interactive programming, right? 00:05:11.711 --> 00:05:18.216 So we have this quoted form and then 00:05:18.266 --> 00:05:22.240 let's do from of that. Great. 00:05:22.290 --> 00:05:24.458 And let's do minutes. 00:05:25.308 --> 00:05:31.498 So from 16 25, 16 45 reproducibly building Emacs, 00:05:31.548 --> 00:05:34.801 so when I do from to that I get 16 25 00:05:34.851 --> 00:05:40.707 when I do minutes to 16 25, I get 25 00:05:42.057 --> 00:05:45.489 and a description of this number in octal and hexadecimal, 00:05:45.590 --> 00:05:47.147 out of interest. 00:05:48.047 --> 00:05:52.953 What was up next? Okay, getting nextday from a date. 00:05:53.553 --> 00:05:57.023 And so, what was it? Saturday, December 27th. 00:05:57.073 --> 00:05:59.245 So what happens? So this function, 00:06:01.345 --> 00:06:05.932 I guess this was part of Sandewall's personal exploration of 00:06:06.032 --> 00:06:12.188 atoms using symbols with property lists, 00:06:12.238 --> 00:06:15.492 with an attached property list to every symbol. 00:06:15.942 --> 00:06:18.059 And so you can kind of see how this works. 00:06:21.510 --> 00:06:32.799 I get whatever was keyed by the symbol nextweekday out of 00:06:32.800 --> 00:06:36.529 the day symbol, so I guess we would do... 00:06:36.579 --> 00:06:46.640 so if we had Sat December 6, I guess we get Sat 00:06:48.140 --> 00:06:54.379 Oh, it destructures that itself somehow, get nextweekday. 00:06:58.429 --> 00:07:02.279 Sorry, nextday. 00:07:02.280 --> 00:07:10.170 set December 6th 00:07:10.270 --> 00:07:12.732 But of course these weren't defined yet, 00:07:12.782 --> 00:07:23.593 so what if we (setf (get 'sat 'nextweekday) 'sun) 00:07:23.793 --> 00:07:25.239 and it's going to be sun right 00:07:28.990 --> 00:07:34.369 And then if we (nextday '(sat dec 6)), 00:07:36.720 --> 00:07:38.392 Sunday, December 7th. 00:07:38.942 --> 00:07:41.628 Yeah, so that kind of makes sense in an intuitive way. 00:07:41.778 --> 00:07:43.550 And you can see cond is being used. 00:07:43.850 --> 00:07:51.538 So if you're not a Lisp person, cond evaluates a condition. 00:07:51.588 --> 00:07:54.708 If the condition returns non-nil, 00:07:54.758 --> 00:07:57.160 it executes the code attached to that condition. 00:07:57.210 --> 00:08:00.247 It evaluates each of these conditions in terms 00:08:00.297 --> 00:08:04.851 and then stops when one returns non-nil, 00:08:04.901 --> 00:08:07.420 as you might expect as a Lisp programmer. 00:08:07.670 --> 00:08:09.622 Let's keep marching along. 00:08:09.672 --> 00:08:11.691 Okay, so we have to populate this. 00:08:11.741 --> 00:08:13.493 And this was an interesting one. 00:08:13.543 --> 00:08:15.562 As you can see, this was my attempt. 00:08:15.612 --> 00:08:19.199 let days mon tue wed, so forth. 00:08:19.249 --> 00:08:23.403 Then I used cl-loop from Emacs Lisp, you know, 00:08:23.453 --> 00:08:32.359 for day in days, for nex in cdr days, setf nextweekday. 00:08:32.610 --> 00:08:35.382 This I thought was surprisingly deep, was that 00:08:36.432 --> 00:08:38.435 Lisp programmers, Sandewall thought, 00:08:38.485 --> 00:08:43.123 are basically constantly trying to break new ground and they 00:08:43.723 --> 00:08:45.325 lose interest very quickly when 00:08:45.425 --> 00:08:46.743 that's not what they're doing. 00:08:46.843 --> 00:08:50.129 And he was making the point that breaking new ground 00:08:50.229 --> 00:08:52.832 involves solving a problem exactly once. 00:08:54.232 --> 00:08:55.903 And so you kind of should do it 00:08:56.003 --> 00:08:58.572 in the most expedient way possible 00:08:58.672 --> 00:09:00.692 to solve it kind of for the first time. 00:09:00.992 --> 00:09:07.113 And after that, it's not breaking new ground anymore. 00:09:07.663 --> 00:09:10.350 And so I thought that was a kind of fun point 00:09:10.400 --> 00:09:14.521 from Sandewall's paper that we could kind of chew on. 00:09:15.121 --> 00:09:19.359 Do something similar for months and month lengths. 00:09:21.059 --> 00:09:30.120 But as we can see, if I get Feb, 00:09:32.120 --> 00:09:41.982 nrdr days I think that characters in 1978, 00:09:42.082 --> 00:09:45.418 characters and symbols in 1978 were more precious 00:09:45.468 --> 00:09:47.821 which is why Sandewall was writing in this abbreviated way. 00:09:47.871 --> 00:09:51.341 We might write more verbosely these days. 00:09:51.391 --> 00:09:54.177 We get 28th but it is in fact a leap year, 00:09:54.277 --> 00:09:58.998 so let's just set that to be 29. Now, it's fine. 00:09:59.048 --> 00:10:05.638 Then I guess if we do, we were doing nextday. 00:10:06.038 --> 00:10:10.944 Sure, nextday. I don't know what day it was. 00:10:10.994 --> 00:10:16.716 let's assume it was Sunday Feb 28 00:10:22.716 --> 00:10:26.179 some kind of typo crept in there, but we can deal with it. 00:10:26.230 --> 00:10:43.844 Let's just setf get sun nextweekday month. 00:10:43.944 --> 00:10:48.648 So once we've solved it once, we should be fine, right? 00:10:48.698 --> 00:10:51.849 Okay, I think I have to speed up a bit. 00:10:52.000 --> 00:10:55.555 Yeah, there we go, Monday February 29th and then 00:10:55.605 --> 00:11:01.194 what if we nextday... Tuesday March 1st. 00:11:01.244 --> 00:11:03.700 Okay, it basically seems to be working. 00:11:03.750 --> 00:11:06.398 And I'd argue it's actually fun that 00:11:06.448 --> 00:11:08.535 we kind of had to do that. 00:11:08.585 --> 00:11:13.473 Then, just imagining you're kind of functioning with 00:11:13.523 --> 00:11:18.311 other people: day begins at 900, ends at 1700, 00:11:18.361 --> 00:11:22.415 so kind of a 9:00 to 5:00, imagining... though perhaps, 00:11:23.915 --> 00:11:25.318 shorter is more appropriate, 00:11:25.368 --> 00:11:27.320 but let's not quibble about that. 00:11:27.420 --> 00:11:29.789 What was happening next in this app? 00:11:29.839 --> 00:11:35.562 holesin. Oh, yeah, so get me the free slots 00:11:35.712 --> 00:11:40.060 in from start time, list of appointments, 00:11:40.110 --> 00:11:45.238 remembering characters, I guess, were more precious 00:11:45.288 --> 00:11:46.556 is my theory. 00:11:46.906 --> 00:11:58.399 And then an end time, so if I go holesin and then from 900 00:11:59.050 --> 00:12:02.689 to where I've written 9 space 0 0 00:12:03.389 --> 00:12:05.959 and what are my appointments? 00:12:07.459 --> 00:12:09.930 So I have a list of appointments that 00:12:09.980 --> 00:12:12.032 need to have start times and finish times. 00:12:12.132 --> 00:12:20.080 So let's go 12 59 to 13 01. 00:12:23.580 --> 00:12:25.379 The description, I guess, can be test. 00:12:25.429 --> 00:12:28.715 And then let's finish that at 1700, 00:12:29.115 --> 00:12:30.729 like we kind of thought. 00:12:37.830 --> 00:12:41.049 Oops, some of these were meant to be arguments. 00:12:54.800 --> 00:12:55.742 Okay, there we go. 00:12:56.042 --> 00:13:01.297 And so the available times between nine and five, 00:13:01.397 --> 00:13:04.429 if there's one appointment from 12:59 to 1:01, 00:13:05.580 --> 00:13:13.092 are from 9 to 1259 and from 1 past 1 to 5, 00:13:13.792 --> 00:13:15.528 which is kind of what we were expecting. 00:13:15.728 --> 00:13:18.631 And so our appointment app is kind of coming along. 00:13:18.931 --> 00:13:20.379 Then we have commonholes, 00:13:23.430 --> 00:13:25.189 kind of works in a sensible way. 00:13:33.890 --> 00:13:36.199 Do we have, what are some common holes from 00:13:36.249 --> 00:13:40.153 two lists of appointments, I guess? commonholes. 00:13:50.903 --> 00:13:53.800 I guess, let's have one person have an appointment 00:13:53.850 --> 00:13:56.419 from 9 to 10. 00:13:59.569 --> 00:14:02.508 That's going to be their only appointment. 00:14:02.558 --> 00:14:05.946 And let's have another person have an appointment 00:14:05.996 --> 00:14:10.399 from 9.30 to 10.30. 00:14:14.450 --> 00:14:18.391 Oh, we didn't do beforetime yet. 00:14:18.441 --> 00:14:22.295 This is the order Sandewall implemented things in there. 00:14:22.345 --> 00:14:25.465 Ok, there. 00:14:25.515 --> 00:14:32.972 So the commonholes are from 9.30 to 10. 00:14:34.272 --> 00:14:42.182 That's actually the overlapping time. 00:14:42.232 --> 00:14:43.850 I'll re-record this 00:14:43.900 --> 00:14:50.799 if some kind of gremlin has crept into my things. 00:15:04.150 --> 00:15:06.839 And then, what did we first start by doing? 00:15:07.389 --> 00:15:11.444 Emacsconf track 1 and Emacsconf track 2, 00:15:11.494 --> 00:15:15.139 and we'll do it on Saturday, December 7. 00:15:21.140 --> 00:15:23.756 commontime, and I'm being prompted, of course. 00:15:23.806 --> 00:15:27.226 emacsconf-track-1, 00:15:29.676 --> 00:15:32.369 emacsconf-track-2, 00:15:33.370 --> 00:15:35.485 the date that we grabbed. 00:15:36.585 --> 00:15:39.519 Let's say we want five minutes. 00:15:49.120 --> 00:15:52.418 And, as always, I'm forgetting to quote things. 00:15:52.468 --> 00:15:56.689 And so my opportunities for common times 00:15:56.739 --> 00:16:01.326 between emacsconf-track-1 to emacsconf-track-2 00:16:01.376 --> 00:16:02.819 on the first day of the conference, 00:16:02.869 --> 00:16:05.464 Saturday, December 7th, for five minutes. 00:16:05.864 --> 00:16:08.834 I have an opportunity between 9:20 and 9:40, 00:16:08.984 --> 00:16:13.639 11:40 and 13:00, 13:10, 13:25, 00:16:14.489 --> 00:16:19.612 13:45, 13:55, and 16:15 to 16:25. 00:16:19.662 --> 00:16:21.581 So I think that's all working. 00:16:23.881 --> 00:16:29.155 And it was done with almost exactly the same code, 00:16:31.355 --> 00:16:38.965 except for my loopy populating symbol plist bits earlier, 00:16:39.015 --> 00:16:46.489 in Interlisp in 1978 as Emacs Lisp in 2024. 00:16:46.539 --> 00:16:48.625 I thought that was pretty interesting that 00:16:48.675 --> 00:16:49.492 you could do that. 00:16:49.542 --> 00:16:57.049 I think setf get was put prop 00:16:57.099 --> 00:17:02.737 was the biggest difference in 1978 Interlisp and 00:17:02.787 --> 00:17:04.690 modern Emacs Lisp. 00:17:04.740 --> 00:17:09.178 And obviously modern Emacs Lisp has Common Lisp loop in it, 00:17:09.228 --> 00:17:11.514 kind of. It's another big difference. 00:17:11.914 --> 00:17:16.099 How are we doing for time? 17 minutes? 00:17:16.450 --> 00:17:19.105 Great, because now let's get a bit closer to what 00:17:19.805 --> 00:17:21.941 my talk title has promised. 00:17:21.991 --> 00:17:24.911 We're going to use Common Lisp from Emacs Lisp 00:17:25.211 --> 00:17:28.080 and we're going to use Common Lisp Interface Manager, 00:17:28.130 --> 00:17:30.116 the open source implementation of 00:17:30.166 --> 00:17:33.786 Common Lisp Interface Manager from 00:17:33.836 --> 00:17:36.999 Inferior Lisp from Emacs Lisp. 00:17:37.300 --> 00:17:42.695 And what we just went over in Sandewall's paper... 00:17:45.550 --> 00:17:47.683 This was the starting point, and Sandewall says, 00:17:47.783 --> 00:17:51.537 well, if you just kind of jammed these ideas using lists 00:17:51.587 --> 00:17:55.341 you just kind of made hour a synonym for car and 00:17:55.391 --> 00:17:58.945 minute a synonym for cadr and so forth, 00:17:59.795 --> 00:18:03.066 you can then make a whole bunch of improvements. 00:18:04.166 --> 00:18:06.689 Can we actually get a glimpse of the … 00:18:09.239 --> 00:18:10.423 No, I didn't really write this. 00:18:10.473 --> 00:18:14.244 Yeah, so you can see I basically just ported out of 00:18:14.294 --> 00:18:17.430 the Interlisp code in the text of this paper. 00:18:17.580 --> 00:18:21.300 Yeah, you see from lambda of appointment, 00:18:21.350 --> 00:18:24.904 car appointment, and that's defineq. 00:18:24.954 --> 00:18:27.857 I guess Interlisp in 1978 used defineq, 00:18:27.907 --> 00:18:32.311 whereas we used defun in Elisp, 00:18:33.361 --> 00:18:35.264 but I'd encourage you to explore that yourselves. 00:18:35.314 --> 00:18:38.551 But the extension that I wanted to develop today is, 00:18:38.601 --> 00:18:41.187 since Common Lisp interface manager is just Lisp, 00:18:41.237 --> 00:18:43.422 and Inferior Lisp is just Lisp, 00:18:43.472 --> 00:18:45.291 and Emacs Lisp is just Lisp, 00:18:45.341 --> 00:18:48.878 and Interlisp in 1978 is just Lisp, 00:18:48.928 --> 00:18:50.112 we could kind of use them all together 00:18:50.162 --> 00:18:51.430 in a kind of funky way. 00:18:51.480 --> 00:18:57.036 But a complaint you often hear, or a statement of confusion 00:18:57.086 --> 00:19:00.373 that you often hear as a Lisp person, 00:19:00.423 --> 00:19:06.712 people from other languages often can't kind of figure out 00:19:06.762 --> 00:19:09.715 how to get started with Lisp. 00:19:09.765 --> 00:19:12.752 So I'm just going to try and do everything here and now. NOTE Inferior Lisp and McCLIM 00:19:12.802 --> 00:19:18.357 And this is the second piece of my three pieces, 00:19:18.407 --> 00:19:22.628 so let's just get inferior lisp and McCLIM happening. 00:19:22.928 --> 00:19:29.268 We normally use slime Superior Lisp Interaction Mode 00:19:29.318 --> 00:19:41.847 for Emacs, which we could get from Emacs's package manager. 00:19:41.897 --> 00:19:48.604 If I go package-list-packages and then we wait 00:19:48.954 --> 00:19:50.969 for however fast my network is, 00:19:54.270 --> 00:19:55.311 we're going to see how long it's been 00:19:55.361 --> 00:19:57.079 since I updated something. 00:19:58.629 --> 00:20:00.999 Yeah, but you see it's in MELPA, right? 00:20:15.750 --> 00:20:16.982 It's got to be somewhere here. 00:20:18.082 --> 00:20:18.501 Yeah, all right. 00:20:18.551 --> 00:20:21.420 So there's one slime available in non-GNU, 00:20:21.470 --> 00:20:25.958 one possibly more recent one available in 00:20:26.758 --> 00:20:28.678 the MELPA package repositories. 00:20:30.278 --> 00:20:30.963 I don't know about you, 00:20:31.013 --> 00:20:33.616 but I can sympathize with people who feel confused by this 00:20:33.666 --> 00:20:36.469 because I think if you look online, 00:20:36.519 --> 00:20:38.637 if you found a search engine result, 00:20:38.687 --> 00:20:44.110 it doesn't customize these like I customize them. 00:20:44.160 --> 00:20:45.945 So let's just do this. 00:20:45.995 --> 00:20:48.147 customize-variable. 00:20:48.197 --> 00:20:52.318 package-archives. 00:20:54.518 --> 00:21:00.392 Yeah and you can see here I've ins-ed gnu, non-gnu, and melpa. 00:21:00.542 --> 00:21:02.628 It's melpa, not melpa stable. 00:21:03.478 --> 00:21:04.359 Saved and set. 00:21:06.810 --> 00:21:08.334 So that's how I do that. 00:21:08.384 --> 00:21:13.279 We're just kind of totally get an inferior lisp working. 00:21:17.130 --> 00:21:20.599 And then, like we saw before, 00:21:20.949 --> 00:21:22.648 this might occur, buffer is still open. 00:21:23.148 --> 00:21:26.879 No. occur. slime. 00:21:35.330 --> 00:21:38.631 So we could install and execute that. 00:21:38.681 --> 00:21:41.734 I cloned slime since Common Lisp people 00:21:41.784 --> 00:21:48.874 might use slime and swank, like McCLIM does outside of Emacs. 00:21:48.924 --> 00:21:51.043 I think we can secretly see 00:21:51.093 --> 00:21:55.614 I've got it here already in my ~/.emacs.d/slime, 00:21:56.064 --> 00:22:00.119 but you could install it like that. The hotkey is I, 00:22:00.169 --> 00:22:02.021 and then execute the install. 00:22:02.071 --> 00:22:03.789 I realize you all already know this, 00:22:04.039 --> 00:22:06.759 but many of you might not yet be Common Lisp programmers, 00:22:06.809 --> 00:22:09.569 and you can use both Superior and Inferior Lisp. 00:22:10.370 --> 00:22:14.733 Instead of package archives in Emacs, 00:22:14.783 --> 00:22:19.705 in Inferior Lisp, and with great controversy, 00:22:19.755 --> 00:22:22.708 we often use QuickLisp. 00:22:22.758 --> 00:22:25.778 People sometimes complain QuickLisp releases 00:22:25.828 --> 00:22:27.780 get out of date quite quickly. 00:22:28.630 --> 00:22:31.717 But there was one recently, so they're pretty in date. 00:22:32.167 --> 00:22:35.321 And so there should be a … 00:22:35.371 --> 00:22:39.058 Yeah, so basically you download quicklisp.lisp, 00:22:39.158 --> 00:22:41.959 you check its SHA-256 sum. 00:22:44.910 --> 00:22:47.829 So I guess in, ooh, over here, if I press D, 00:22:51.229 --> 00:22:53.706 ~screwtape/downloads/quicklisp.lisp. 00:22:53.756 --> 00:22:57.376 Great. If we open a shell, we realize that 00:22:57.426 --> 00:23:03.599 this is just riveting for all of our experts there. 00:23:06.450 --> 00:23:15.919 sha256 ~/Downloads/quicklisp.lisp 00:23:19.720 --> 00:23:22.001 Your SHA-256 might be different to mine. 00:23:22.601 --> 00:23:25.471 Somebody please tell me during the actual conference, 00:23:25.621 --> 00:23:29.125 the right Emacs idiom to do this. 00:23:29.225 --> 00:23:32.679 I guess it will be tools decrypt something. 00:23:33.930 --> 00:23:36.014 But then once you have QuickLisp, 00:23:36.214 --> 00:23:37.959 let's go back to our shell. 00:23:41.810 --> 00:23:46.625 I'm on OpenBSD or a BSD, so I type pkg_add ecl 00:23:46.675 --> 00:23:48.239 to get embeddable Common Lisp. 00:23:53.590 --> 00:23:55.090 However, I think I already have it. 00:23:58.540 --> 00:24:02.069 And then, let's start ecl [embeddable Common Lisp]. 00:24:04.670 --> 00:24:07.039 Quicklisp inserts itself already, 00:24:11.290 --> 00:24:14.920 but just loading that quicklisp.lisp file 00:24:14.970 --> 00:24:16.989 kind of would get you here anyway. 00:24:17.039 --> 00:24:22.939 Now let's (ql:quickload :mcclim) 00:24:27.140 --> 00:24:28.769 I'm actually following my plan. 00:24:33.269 --> 00:24:38.294 McCLIM is kind of like Emacs in that 00:24:38.344 --> 00:24:40.713 it handles all sorts of graphical stuff 00:24:41.013 --> 00:24:42.748 like if you have GTK Emacs, 00:24:42.798 --> 00:24:44.333 you know, it can do really a lot of stuff. 00:24:44.383 --> 00:24:48.604 That's the reason why compiling and loading 00:24:50.504 --> 00:24:53.125 the McCLIM package takes a while 00:24:53.175 --> 00:24:56.962 and I do use my old computer laptop, 00:24:57.012 --> 00:25:00.299 my old computer challenge laptop all the time, 00:25:00.349 --> 00:25:02.685 so when you do this, your computer will be 00:25:02.735 --> 00:25:05.504 substantially faster or you will be feeling 00:25:06.404 --> 00:25:09.609 smug about how slow you're running your computer, 00:25:12.759 --> 00:25:15.481 and so there's no problem. 00:25:15.531 --> 00:25:17.316 Next, we're going to start Swank 00:25:17.366 --> 00:25:23.699 which is the Lisp part of Emacs's slime-mode. 00:25:27.649 --> 00:25:32.298 If I remember, we looked at this before 00:25:32.348 --> 00:25:34.700 in my .emacs.d, 00:25:35.050 --> 00:25:40.499 and then there should be slime/start-swank.lisp. 00:25:41.699 --> 00:25:44.643 Let's just grab that and load it. 00:25:46.293 --> 00:25:48.470 You don't have to type #p. 00:25:48.870 --> 00:25:51.150 The string will work as well as the path name, 00:25:51.200 --> 00:25:52.618 but it's kind of fun to do so. 00:25:52.668 --> 00:25:55.287 Now, slime-connect. 00:25:55.437 --> 00:25:56.859 You installed slime earlier. 00:25:57.559 --> 00:25:59.024 Default values. 00:25:59.074 --> 00:26:01.794 Oh, the reason we had to do this 00:26:01.844 --> 00:26:07.064 and not use Slime, start Slime normally was that 00:26:07.214 --> 00:26:10.736 CLIM, Common Lisp Interface Manager, 00:26:10.786 --> 00:26:12.204 McCLIM, implementation of the 00:26:12.254 --> 00:26:16.275 Common Lisp Interface Manager spec, also uses Swank 00:26:16.675 --> 00:26:19.912 and McCLIM really wants to be in the driver's seat. 00:26:20.162 --> 00:26:23.282 We can have our Emacs connect 00:26:23.332 --> 00:26:28.053 to the Swank that McCLIM was already running. 00:26:28.553 --> 00:26:30.823 So (in-package :clim-user)... 00:26:30.873 --> 00:26:33.575 I don't know if this is an Emacs Lisp idiom, 00:26:33.625 --> 00:26:37.112 so you normally have user packages to absorb user code 00:26:37.162 --> 00:26:38.809 just for fooling around. 00:26:42.110 --> 00:26:47.556 Then let's just use clim at all. 00:26:47.606 --> 00:26:52.544 And so clim does lots of things around presentations 00:26:53.094 --> 00:26:58.317 but one thing it does is automatically, to a large extent, 00:26:58.367 --> 00:27:03.956 generate graphical user interfaces. 00:27:04.006 --> 00:27:09.394 So there's a lot to it that's not about graphics, 00:27:09.444 --> 00:27:13.332 kind of richer interfaces than 00:27:14.082 --> 00:27:17.089 ANSI Common Lisp's character streams. 00:27:19.389 --> 00:27:23.158 But let's use it to grab a graphical pop-up 00:27:23.258 --> 00:27:24.393 that returns a value. 00:27:24.743 --> 00:27:27.413 So we have this accepting-values tool. 00:27:28.013 --> 00:27:31.950 t is just choose whatever you think the default stream is. 00:27:32.150 --> 00:27:36.088 We're going to want our own window, t as well, 00:27:36.688 --> 00:27:38.390 so just a keyword argument. 00:27:38.640 --> 00:27:43.328 After that, we can just write things like (accept 'string). 00:27:44.978 --> 00:27:47.883 And I'm just doing this in, for people only listening, 00:27:47.933 --> 00:27:50.936 I've just done this in my ECL Slime REPL. 00:27:50.986 --> 00:27:55.279 Enter a string: foo bar baz. 00:27:56.530 --> 00:27:58.849 Alt-Enter, I think, is the shortcut to return that. 00:27:59.150 --> 00:28:02.248 As you can see, its first return was "foo bar baz", 00:28:02.298 --> 00:28:04.316 and it had second and third returns, 00:28:04.366 --> 00:28:10.105 string being the type, presentation type that it got, 00:28:10.155 --> 00:28:13.739 and t, I think, to indicate that it exited successfully. 00:28:16.189 --> 00:28:20.916 We can also do expression, might be more interesting. 00:28:20.966 --> 00:28:22.189 There are a whole bunch of these. 00:28:26.140 --> 00:28:29.308 clim's examples folder is pretty good. 00:28:29.358 --> 00:28:32.294 And the documentation, everybody's documentation, 00:28:32.344 --> 00:28:34.713 McCLIM's documentation, you know, 00:28:35.413 --> 00:28:39.135 lispworks and franz's documentation will tell you about 00:28:39.385 --> 00:28:45.069 the different default presentation types you can accept. 00:28:47.969 --> 00:28:49.862 And they're pretty intuitive and 00:28:49.912 --> 00:28:52.464 they're kind of very Lisp compatible, 00:28:53.264 --> 00:28:54.266 which everything kind of is. 00:28:54.316 --> 00:29:00.399 We could accept an expression. foo bar baz. 00:29:05.350 --> 00:29:09.414 return "foo bar baz 123" because that's what I wrote. NOTE Putting things together 00:29:10.964 --> 00:29:14.570 And now the kind of pièce de résistance 00:29:14.820 --> 00:29:17.055 of putting those things together. 00:29:17.555 --> 00:29:21.326 Let's just run over to our scratch buffer. 00:29:22.226 --> 00:29:24.096 Oh, or our ielm thing, right? 00:29:24.246 --> 00:29:25.564 That's what we're actually doing. 00:29:25.964 --> 00:29:28.951 So now, I think we're going to do, hang on, 00:29:30.251 --> 00:29:32.871 M-:. 00:29:32.921 --> 00:29:41.313 I think it's going to be slime-eval-save, 00:29:41.663 --> 00:29:44.549 because it'll eval asynchronously. 00:29:45.849 --> 00:29:49.121 There's a question of how to get the value out of 00:29:49.171 --> 00:29:52.124 the asynchronous slime evaluation. 00:29:52.524 --> 00:29:55.761 And so an obvious way is to yank it. 00:29:59.661 --> 00:30:02.234 I'm looking forward to learning from kickingvegas. 00:30:02.284 --> 00:30:06.638 He finally makes it stick in my brain how to... 00:30:07.138 --> 00:30:10.559 Options other than just starting to write a command 00:30:10.959 --> 00:30:14.013 in the minibuffer and then mashing Tab 00:30:14.063 --> 00:30:16.465 and looking at what the likely sounding results are. 00:30:16.765 --> 00:30:21.720 That's what I will be learning this conference, if anything. 00:30:22.070 --> 00:30:26.558 slime-eval-save and then, what was happening over here? 00:30:26.958 --> 00:30:31.769 (accepting-values (t :own-window t) (accept 'expression)). 00:30:33.369 --> 00:30:38.319 Kind of confusingly, slime-eval-save takes a string, 00:30:39.169 --> 00:30:41.840 but it works really well, I'd argue. 00:30:41.940 --> 00:30:43.475 I think it's about to work really well. 00:30:45.825 --> 00:30:46.712 Ok, this is great. 00:30:46.762 --> 00:30:50.182 So you can see I've used... Oh, please enter an expression. 00:30:50.882 --> 00:30:52.117 So we're doing an expression. 00:30:52.167 --> 00:30:59.057 And so let's write like (3 4/2 5/6). 00:30:59.357 --> 00:31:00.609 That's an expression, right? 00:31:03.609 --> 00:31:05.797 And now I've yanked it. 00:31:05.847 --> 00:31:07.379 I should have really been in *scratch*, 00:31:07.429 --> 00:31:11.770 because I just want to dump. Sorry, *scratch*. 00:31:13.770 --> 00:31:15.290 Dump whatever that did. 00:31:16.540 --> 00:31:19.480 Oh, yeah, and see, it kind of simplified that 00:31:19.530 --> 00:31:20.712 while it was reading it. 00:31:20.762 --> 00:31:27.486 So running in Elisp, (slime-eval-save "(accepting-values 00:31:27.536 --> 00:31:32.557 (t :own-window t), accept 'expression))"). 00:31:33.157 --> 00:31:36.328 And I got the three returns all the way 00:31:36.378 --> 00:31:43.235 from McCLIM to inferior-lisp to Elisp. 00:31:43.885 --> 00:31:46.471 3, 2, 5/6. 00:31:46.521 --> 00:31:50.575 Second return, it was a presentation type of expression, 00:31:50.625 --> 00:31:52.811 returned successfully, key. 00:31:53.561 --> 00:31:56.679 Yeah, so that's pretty cool. How out of time are we? 00:31:58.530 --> 00:32:00.859 Oh, we did this in basically half an hour. 00:32:04.009 --> 00:32:07.209 Maybe we could stop and assume there will be a bit under 00:32:07.259 --> 00:32:10.796 half an hour of interactive discussion. 00:32:11.646 --> 00:32:15.634 And when I also watch this and also receive suggestions, 00:32:16.934 --> 00:32:20.071 there will be additions and changes to make, I think. 00:32:21.671 --> 00:32:32.617 But can we quickly defun accept-date? 00:32:34.667 --> 00:32:36.589 Let's not take any arguments. 00:32:40.239 --> 00:32:41.709 Let's do this. 00:32:48.409 --> 00:32:49.769 accept-date. 00:32:55.519 --> 00:32:58.099 Saturday, December 7th. 00:33:02.649 --> 00:33:04.015 Oh, it doesn't return it. 00:33:04.215 --> 00:33:05.518 But it gets pretty close to returning it. 00:33:05.568 --> 00:33:06.718 I guess it yanks it. 00:33:07.818 --> 00:33:18.359 I would have to call … I'm going to say it's slime-sync, 00:33:21.160 --> 00:33:25.370 at which point it will resolve the slime-eval-async. 00:33:25.670 --> 00:33:28.757 And then I could get the first value out of 00:33:28.807 --> 00:33:32.179 my kill-ring pop, right? 00:33:33.629 --> 00:33:35.046 Does kill ring pop what I want? 00:33:36.646 --> 00:33:39.918 You know, you tell me in the interactive feedback, 00:33:39.968 --> 00:33:41.720 which should be happening in LambdaMOO. 00:33:43.020 --> 00:33:45.559 Well, I'll record another draft of this later 00:33:45.609 --> 00:33:47.709 after getting some feedback. 00:33:48.609 --> 00:33:51.580 Or worse to worse, this is just what you'll hear. 00:33:52.180 --> 00:33:58.503 Hopefully we have some questions and constructive comments. 00:33:59.303 --> 00:34:00.255 All right, see everybody later. 00:34:00.305 --> 00:34:01.359 Thank you so much for being here. 00:34:04.470 --> 00:34:08.613 Please do drop in to my live show 00:34:08.663 --> 00:34:11.266 if you're so inclined on Wednesdays 00:34:11.316 --> 00:34:14.186 where you're not busy with cool Emacs conferences. 00:34:14.936 --> 00:34:16.169 The list be go for climate. 00:34:16.219 --> 00:34:17.572 Thank you to everyone who helped. 00:34:17.772 --> 00:34:18.640 Thank you to Sacha 00:34:18.690 --> 00:34:21.660 for really getting me into this conference 00:34:21.710 --> 00:34:23.428 and kind of getting me going and 00:34:23.678 --> 00:34:26.181 submitting this prerecorded talk. 00:34:27.981 --> 00:34:28.780 See everybody later.