|
REPLs in strange places: updates, a demo, and how to try it - subtitles
The main page about this video is here.
Its subtitles in Lua are here.
The rest of this page contains a conversion of the subtitles in Lua
to a slightly more readable format.
00:00 Hi! My name is Eduardo Ochs, I'm the author of
00:03 an Emacs package called eev, and a few weeks
00:06 ago I gave a very bad presentation at
00:09 the EmacsConf 2023 about an application of eev.
00:12 The title of my presentation was: REPLs
00:16 in strange places: Lua, LaTeX, Lpeg, LPegRex,
00:19 and TikZ, and the idea is that the
00:23 presentation should have a way to let
00:26 people try what I was showing, because
00:30 the central idea of eev is that
00:32 everything should be easy to try...
00:35 well, let me explain that in a better way.
00:41 Let me start with a
00:44 question: why should people learn eev?
00:48 Most people say that it looks like a
00:50 kind of Org mode, but uglier and less
00:54 powerful, and let's look at these ideas here.
00:58 Scripts made with
01:02 Org mode and code blocks look
01:05 very professional - they can be
01:08 exported to HTML and PDF easily, you can
01:10 show to other people what you're doing,
01:12 you can make blog posts... all the
01:16 fortification happens in the right
01:19 way, you have colors and so on...
01:21 and scripts made with eev - and eepitch,
01:25 which is one of the best starting points
01:28 for eev, they look very barebones...
01:31 they have some ideas that are
01:35 the opposite of "this must look
01:38 professional", and they have some strange
01:40 influences in their aesthetics... for
01:42 example, they are influenced by ideas by
01:45 the ideas of Peter Brook -
01:48 about rough theater, about using
01:53 the least scenery possible, and so on...
01:56 whatever. So people have very good
02:00 reasons for spending 10 years trying to
02:02 learn Org, and they have very good
02:04 reasons for spending just a few minutes
02:06 trying to learn eev... but the
02:09 tutorials of eev are full of "try it"s,
02:12 and one of the filters of eev is that
02:15 some people who try the "try it"s like eev,
02:18 but some people refuse to try the "try it"s -
02:21 they just want to see explanations
02:24 and a professional description of what
02:26 this can do for them, how this can
02:29 solve their problems, how this can
02:31 earn them money and so on... and they
02:34 don't find that, they refuse to try
02:37 the "try it"s, and they hate eev.
02:42 Anyway, what I want to show in this short
02:44 video is the "try it"s for my presentation
02:48 on REPLs in strange places. These "try it"s
02:51 only became ready several weeks after the
02:53 presentation... and now I'm going to show
02:56 rather quickly how to run them.
03:02 This is the list of intros of eev...
03:06 let me switch to a smaller font here...
03:12 the one that we are going to see
03:15 is here, in the section of advanced
03:19 features that require extra setup... and
03:21 the name of this intro is find-show2-intro.
03:24 Let me go straight to that intro...
03:27 it's here... here we have an
03:30 introduction that explains
03:32 very roughly what these things are...
03:35 the main idea is that at some point the
03:38 the main attraction of this thing will
03:41 be a tutorial on how to use Lpeg, that is
03:44 a tool for generating parsers...
03:47 but this tutorial does not exist yet...
03:51 anyway, the focus here is on how
03:54 to try this
03:55 thing. You need to start here...
04:01 this is not a very basic "try it", it
04:04 has some prerequisites... it expects
04:07 that people will understand most of
04:09 these expressions here... and one of
04:14 the most basic things is that when you
04:16 type f8 on a line that starts with
04:19 two red stars the f8 treats that line
04:22 as a comment and shows the content of
04:25 that line in the echo area.
04:29 When yoy type f8 on a line that has only one
04:32 red star the rest of the line is treated as
04:34 Lisp... so these lines here,
04:37 that take a few seconds to run...
04:40 they will assure that we have access to
04:44 melpa and that the package system is
04:48 installed...
04:51 oops, oh no, I need to fix something here...
04:54 whatever - I'll do that later...
04:57 and then these other two sexps here
05:01 will guarantee that
05:04 we have pdf-tools installed, and this
05:07 last one here, that is a comment... if we
05:10 execute it with M-e... then it
05:14 will show the description of the
05:16 package pdf-tools, in my case it
05:19 will show that is installed... and so on.
05:23 Then, to try the demo people have to
05:27 install some system-wide dependencies...
05:30 I mean, this first block was for an
05:34 Emacs-wide dependency, that is pdf-tools...
05:37 In my case I need to run this
05:40 block here, because I'm running Debian...
05:42 so I need to run this... in this
05:47 case if I send these lines to a shell
05:49 with f8s it's going to show that
05:51 all these packages are already
05:54 installed... and then I have to give
05:56 more f8s here, just to define links to
06:00 some manuals... for example, now this
06:05 link here... if I execute it with M-e it
06:07 will open the manual of lpeg... a local
06:09 copy of the manual of lpeg.
06:19 Then we have to run this part here
06:21 that installs some things in
06:25 /tmp, and this first block here clears
06:28 the directory in which I'm going to put
06:30 most of the things, and it clones my
06:34 programs - the ones that I showed in my
06:37 presentation in a very incomplete form...
06:41 then this other block here
06:45 clones other two repositories of
06:47 something very specific about Lua - some
06:50 extensions of Lpeg... and they compile one
06:54 of these extensions, that needs to be
06:56 compiled with gcc...
06:57 and then we have to run this
07:00 other block here, that defines links to
07:02 some manuals... for example...
07:07 oops, well, whatever... and then I have
07:11 to run this block here because the
07:14 communication with some of the external
07:16 programs that will be run from Emacs will
07:19 be done using environment variables...
07:24 then this block here is
07:27 just a technical comment...
07:30 then here we have the first
07:31 non-trivial test.
07:34 These three lines here will
07:37 create
07:38 a target buffer running Lua here...
07:43 and then it will check with if my
07:47 pretty-printer works...
07:49 it does, it's able to print
07:53 associative tables in this format...
07:56 and then I'm going to do some other things
07:58 here... I'm going to inspect the path and
08:02 then load an extension of my pretty-printer
08:05 and ask it to tell me the contents of the
08:11 table of methods of my pretty-printer...
08:15 so, for example, it prints the method
08:19 getsortedkvs as this, and this thing
08:24 is something that I can run in Emacs...
08:26 and it shows the source code
08:28 here in the window at the right. let me
08:31 close this and go back...
08:34 This is a test that we need
08:38 to run just to check if lpegrex is
08:40 working... it's not very important, lpegrex
08:44 is only going to be used in a
08:47 very few tests, and just to compare
08:50 lpegrex with my hacker-friendly version
08:52 of its main functions...
08:56 so here is a test... it adds some
09:01 paths to the to the LUA_PATH...
09:05 and then we just need to check that
09:08 these things here run without errors...
09:11 but the output is boring, as I've said.
09:13 This is another test, that just
09:17 checks if lpegrex can be loaded in
09:20 another way... it's also boring it only
09:22 shows that some the functions are defined...
09:25 and this is the non-trivial part,
09:28 that shows the things that I've explained in
09:34 my presentation... the first thing is that
09:38 most of my tools use one of the
09:41 windows to display a PDF,
09:43 but the PDF must be regenerated
09:46 by Lua and we need to tell Lua where to
09:48 put that PDF and this is done by setting
09:52 some environment variables, and the
09:54 function that does that is called
09:56 show2-use, that tells Show2
10:00 which directory to use, and it works in a
10:03 very non-trivial way... but usually we run
10:08 show2-use before a block like this one...
10:10 and remember that some parts of
10:14 blocks like these are things
10:15 that are not important... for example, if I
10:17 run this then it shows in the window at
10:21 the right the current... sorry, this
10:25 example. If I run just this it shows
10:28 in the window at the right a target
10:31 buffer that may not be important, then in
10:34 the second line here it kills the
10:36 current target buffer and then in this
10:38 other line here it recreates the target
10:40 buffer so that I got a new target buffer
10:43 running Lua.
10:45 This line here, whose
10:49 logic is very non-trivial... it also uses
10:52 the window at the right, but it uses the
10:53 window at right to explain what it is
10:55 doing. So if I run this it shows in the
10:59 window at the right how its argument
11:02 is going to be interpreted, how it's
11:03 going to be processed to set some
11:08 environment variables, and explains lots
11:10 of things, including how it's going to
11:13 define these functions here, that set up
11:16 a 3-window setting like this.
11:19 But let me go back to this
11:22 part of the demo here... if I run
11:26 all these lines with f8, each one of the
11:29 lines will show a buffer like this,
11:32 with the information about what show2-use
11:36 does with each of these
11:39 arguments... so I can just type several
11:42 f8s here and compare how things change.
11:45 So this is just a way
11:49 to let people understand how this
11:52 function works... and it uses a nice trick
11:55 that I only invented a few weeks ago,
11:57 that is using the window at the right for
12:00 explaining the logic...
12:02 and now here is a basic
12:07 example of using show2-use...
12:11 and using Show2...
12:15 and this line
12:17 here, with the show... it takes a few
12:20 seconds to run... it creates a
12:22 PDF, and this line here creates the
12:26 3-window setting with the script
12:29 being edited here - the "e", the target
12:33 buffer here - the "t", and the viewing
12:37 buffer here - the "v"... so this works,
12:40 but it's very basic... there are some
12:43 explanations here...
12:46 this is an example that is
12:51 slightly less
12:53 trival... we can first execute it like
12:56 this... note that
12:59 here we have these two lines, that look
13:01 redundant... in the first we define the
13:03 global variable "body" in a certain way,
13:06 and in the second we we redefine "body" in
13:08 another way...
13:09 let me run this again... :show00 and :show0
13:15 are just debugging functions
13:17 that show what is going to be saved
13:20 in the .tex file... and this last line here,
13:23 with just ":show" without any "0"s,
13:25 saves the .tex file and
13:28 produces the PDF... and it takes a few
13:30 seconds to run... we need to wait
13:33 until it finishes, and we need to to
13:36 check if its output says either success
13:40 or error... and if we got a success then we
13:44 can run this, the "(etv)"...
13:45 and note that this option
13:50 here has told show to include some
13:53 things here that would scale the output...
13:56 it includes this \scalebox{4} here...
14:01 and then this part of the
14:05 tutorial explains that we can run
14:09 these lines here in any order, and we can...
14:13 remember that in the first time
14:17 this first line was ignored because the
14:20 second one redefined "body"...
14:22 but now we can run this first
14:26 line here and now this value is going to
14:29 override the other one...
14:31 then we skip this "HELLO" without
14:34 the backslash here... we run these lines
14:37 again... and now the show is going to say
14:41 that we didn't get a success, we get
14:44 an error... so now the "(etv)" would not
14:49 work, it's going to show something spurious...
14:52 and we can show the log of the
14:55 compilation... we're going to see what went
14:58 wrong...
15:00 and we can also run this to to examine
15:04 what was saved in the .tex file.
15:07 So this was just a basic demo to
15:11 explain how Show2 works, and how "(etv)"
15:14 works, and how we can use these several
15:17 variants of :show to inspect what is
15:19 being saved and compiled...
15:21 and now we have a few
15:24 less trival tests, in the
15:27 sense that these tests are going to
15:30 show something in the PDF that is not so
15:34 trivial... here we get one test that is in
15:36 a test block in this file...
15:38 the file is called ParseTree2.lua,
15:42 and this line here goes to
15:49 this test block... and if we run this
15:53 block here, in the test block...
15:55 it uses a parser that is defined in
15:59 this file, it parses this string
16:04 here, it displays this, the abstract
16:08 syntax tree generated by parsing this
16:11 string... and then we have some
16:17 other lines here that process the tree
16:20 in several ways...
16:23 that I do not want to explain... but the
16:26 important is that at this point here at
16:29 this line I take this object here,
16:31 produced by underbracifying o9, and I
16:37 run the show method on it. It takes a
16:40 few seconds, it says success, so now this
16:44 is going to work...
16:45 and it displays this parse tree here.
16:50 So this was one of the non-trivial
16:55 tests... here is another one...
16:59 that... the output looks trivial, but
17:03 the logic is not...
17:07 the test is this one, it produces
17:11 this .tex here, that loads
17:15 several .tex files and the
17:18 style file... they are all included
17:21 this directory here...
17:27 here you can see that is,
17:30 /tmp/show2-elpeg1/LATEX/,
17:33 so it's a temporary thing... but it has
17:37 lots of Lua files and some .tex files.
17:42 and this thing here is processed by
17:46 one of the things that I use to
17:48 to generate diagrams in LaTeX, it's a
17:51 package called Dednat6...
17:53 and if I run this it generates a PDF and
18:00 the PDF is this.. so this thing is a
18:03 variant of verbatim mode...
18:07 and this is something that will be very
18:14 interesting at some point, but at this
18:16 point is not really interesting...
18:18 this is my hacker-friendly
18:22 version of lpegrex, and here
18:26 are some examples of how it works...
18:30 I tested either all or most of its
18:35 test blocks and they are working... for
18:38 example, this one is a test block that
18:41 defines a grammar that starts very
18:43 basic... and then it's changed a bit at a
18:50 time... and then we change the grammar and
18:53 we ask this function here to use the
18:57 current grammar to parse this thing
18:59 here considering that this symbol
19:02 here is the top level symbol of the
19:04 grammar. So... it shows how we can parse
19:08 arithmetical expressions with the right
19:16 precedence, and... that's it.
19:18 At some point this thing is going to become
19:20 a tutorial of lpeg but at at this moment
19:23 it is not. Anyway...
19:25 So, here we have lots of Lua files,
19:31 and most of these Lua files have...
19:34 let me see... let me see if I have
19:38 something interesting here...
19:40 Most of these Lua files
19:43 have test blocks that that you can run
19:45 in your installation, in which
19:48 everything is in the /tmp/ directory...
19:51 for example this one... no, let me try the
19:55 last test block in this file...
20:02 it does some weird things here, but
20:06 then it has a :show()... the :show()
20:10 saves a .tex file and compiles it into a PDF,
20:12 and then this thing here shows the result,
20:15 that is something three-dimensional here,
20:17 and some other things here.
20:19 So, yeah, that's it! I hope that
20:22 everything is... will be easy to
20:27 run... I have only tested this thing on
20:31 Debian and I have one friend that is
20:33 testing that on Mac OS and another
20:36 friend who's testing that on Arch Linux...
20:39 and if you can test that on
20:41 your system then please get in touch!
20:43 Please tell me if things are working,
20:45 please help me to debug these things...
20:48 and yeah! That's it. That's it for the
20:50 moment. Thanks! Bye! =)
20:52
|