summaryrefslogtreecommitdiffstats
path: root/2021/captions/exec.md
blob: 0363771cde7b22391dc80c6d6ab0a903a4367bbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<a name="transcript"></a>
# Transcript

[[!template text="Hello all! Welcome to EmacsConf 2021." start="00:00:00.320" video="mainVideo" id=subtitle]]
[[!template text="I'm Tom Gillespie." start="00:00:03.679" video="mainVideo" id=subtitle]]
[[!template text="Thank you to the organizers for" start="00:00:05.040" video="mainVideo" id=subtitle]]
[[!template text="all your hard work," start="00:00:06.799" video="mainVideo" id=subtitle]]
[[!template text="and for inviting me to" start="00:00:07.680" video="mainVideo" id=subtitle]]
[[!template text="give this short talk on" start="00:00:08.639" video="mainVideo" id=subtitle]]
[[!template text="&quot;Org as an executable format&quot;." start="00:00:10.021" video="mainVideo" id=subtitle]]
[[!template text="The links to the talk page," start="00:00:12.240" video="mainVideo" id=subtitle]]
[[!template text="the GitHub page for the project," start="00:00:13.840" video="mainVideo" id=subtitle]]
[[!template text="and the package on MELPA" start="00:00:16.000" video="mainVideo" id=subtitle]]
[[!template text="are listed on the right." start="00:00:18.880" video="mainVideo" id=subtitle]]
[[!template new="1" text="Let's start with one of the motivating" start="00:00:20.160" video="mainVideo" id=subtitle]]
[[!template text="use cases for executable Org files." start="00:00:21.760" video="mainVideo" id=subtitle]]
[[!template text="Many users keep global configuration" start="00:00:25.920" video="mainVideo" id=subtitle]]
[[!template text="for Org in an init.el file," start="00:00:29.339" video="mainVideo" id=subtitle]]
[[!template text="which works for many workflows." start="00:00:31.840" video="mainVideo" id=subtitle]]
[[!template text="However, for reproducible research," start="00:00:33.520" video="mainVideo" id=subtitle]]
[[!template text="this is a challenge" start="00:00:36.239" video="mainVideo" id=subtitle]]
[[!template text="because if an Org file is" start="00:00:37.600" video="mainVideo" id=subtitle]]
[[!template text="dissociated from the init.el file," start="00:00:39.280" video="mainVideo" id=subtitle]]
[[!template text="then often it will no longer" start="00:00:41.440" video="mainVideo" id=subtitle]]
[[!template text="function as expected." start="00:00:43.040" video="mainVideo" id=subtitle]]
[[!template new="1" text="One potential solution to this problem" start="00:00:44.640" video="mainVideo" id=subtitle]]
[[!template text="is to be able to include all of the" start="00:00:46.719" video="mainVideo" id=subtitle]]
[[!template text="global configuration for Emacs" start="00:00:48.160" video="mainVideo" id=subtitle]]
[[!template text="and the environment in the Org file itself," start="00:00:50.239" video="mainVideo" id=subtitle]]
[[!template text="in which case when you" start="00:00:52.960" video="mainVideo" id=subtitle]]
[[!template text="go to reuse the Org file," start="00:00:53.840" video="mainVideo" id=subtitle]]
[[!template text="it will work as expected." start="00:00:55.440" video="mainVideo" id=subtitle]]
[[!template new="1" text="What does an executable Org file" start="00:00:58.640" video="mainVideo" id=subtitle]]
[[!template text="look like in action?" start="00:01:00.480" video="mainVideo" id=subtitle]]
[[!template text="Here's a demo of an executable Org file" start="00:01:02.559" video="mainVideo" id=subtitle]]
[[!template text="running in Bash, Dash, Zsh, and PowerShell." start="00:01:05.280" video="mainVideo" id=subtitle]]
[[!template text="So, we are currently in Bash," start="00:01:09.680" video="mainVideo" id=subtitle]]
[[!template text="and we can run our demo," start="00:01:14.799" video="mainVideo" id=subtitle]]
[[!template text="and it will print some stuff," start="00:01:19.360" video="mainVideo" id=subtitle]]
[[!template text="and wait for input." start="00:01:21.119" video="mainVideo" id=subtitle]]
[[!template text="We can also run it in Dash," start="00:01:22.640" video="mainVideo" id=subtitle]]
[[!template text="which is the default for Debian" start="00:01:24.144" video="mainVideo" id=subtitle]]
[[!template text="and derivatives." start="00:01:25.720" video="mainVideo" id=subtitle]]
[[!template text="Same program works as expected." start="00:01:29.840" video="mainVideo" id=subtitle]]
[[!template text="Zsh also. And lastly PowerShell," start="00:01:32.320" video="mainVideo" id=subtitle]]
[[!template text="if we try to run demo.org itself," start="00:01:38.560" video="mainVideo" id=subtitle]]
[[!template text="we see (that) we get an error" start="00:01:41.439" video="mainVideo" id=subtitle]]
[[!template text="because PowerShell cares" start="00:01:42.640" video="mainVideo" id=subtitle]]
[[!template text="about file extensions," start="00:01:43.764" video="mainVideo" id=subtitle]]
[[!template text="so, if we symlink to ps1," start="00:01:45.439" video="mainVideo" id=subtitle]]
[[!template text="then it works as expected," start="00:01:49.840" video="mainVideo" id=subtitle]]
[[!template text="and there are ways to alias this," start="00:01:51.680" video="mainVideo" id=subtitle]]
[[!template text="so that you can run it as a program" start="00:01:53.341" video="mainVideo" id=subtitle]]
[[!template text="without the ps1 extension." start="00:01:55.044" video="mainVideo" id=subtitle]]
[[!template new="1" text="So, how does this work?" start="00:01:58.640" video="mainVideo" id=subtitle]]
[[!template text="There are three components" start="00:02:03.920" video="mainVideo" id=subtitle]]
[[!template text="to an executable Org file" start="00:02:05.759" video="mainVideo" id=subtitle]]
[[!template text="that all need to be present" start="00:02:07.352" video="mainVideo" id=subtitle]]
[[!template text="in order for this to work." start="00:02:08.560" video="mainVideo" id=subtitle]]
[[!template text="Starting from the top of the file," start="00:02:10.080" video="mainVideo" id=subtitle]]
[[!template text="we have a shebang block." start="00:02:11.920" video="mainVideo" id=subtitle]]
[[!template text="Next we have an Org Babel block" start="00:02:14.239" video="mainVideo" id=subtitle]]
[[!template text="written in Emacs Lisp," start="00:02:16.640" video="mainVideo" id=subtitle]]
[[!template text="which is what we actually saw executing," start="00:02:17.760" video="mainVideo" id=subtitle]]
[[!template text="and then there are some" start="00:02:20.000" video="mainVideo" id=subtitle]]
[[!template text="eval local variables or Elvs" start="00:02:20.959" video="mainVideo" id=subtitle]]
[[!template text="that are involved in making this" start="00:02:23.520" video="mainVideo" id=subtitle]]
[[!template text="actually executable." start="00:02:25.200" video="mainVideo" id=subtitle]]
[[!template new="1" text="Let's start with the shebang block." start="00:02:26.800" video="mainVideo" id=subtitle]]
[[!template text="Org syntax does not have support" start="00:02:29.760" video="mainVideo" id=subtitle]]
[[!template text="for shebang lines." start="00:02:33.280" video="mainVideo" id=subtitle]]
[[!template text="However, it supports the shebang block." start="00:02:34.959" video="mainVideo" id=subtitle]]
[[!template text="This is because Org comments, blocks," start="00:02:37.120" video="mainVideo" id=subtitle]]
[[!template text="keywords, etc. that start with the" start="00:02:39.440" video="mainVideo" id=subtitle]]
[[!template text="sharp sign have the same syntax as" start="00:02:41.760" video="mainVideo" id=subtitle]]
[[!template text="comments in POSIX and PowerShell." start="00:02:43.920" video="mainVideo" id=subtitle]]
[[!template text="This block is in fact valid" start="00:02:46.720" video="mainVideo" id=subtitle]]
[[!template text="Bash, Dash, Zsh, PowerShell," start="00:02:53.280" video="mainVideo" id=subtitle]]
[[!template text="and maybe some other shells as well." start="00:02:55.040" video="mainVideo" id=subtitle]]
[[!template text="In essence what it does is," start="00:02:57.280" video="mainVideo" id=subtitle]]
[[!template text="perform some setup" start="00:03:02.480" video="mainVideo" id=subtitle]]
[[!template text="to avoid polluting standard output," start="00:03:03.440" video="mainVideo" id=subtitle]]
[[!template text="and then it runs Emacs" start="00:03:06.080" video="mainVideo" id=subtitle]]
[[!template text="to load the file itself." start="00:03:07.516" video="mainVideo" id=subtitle]]
[[!template new="1" text="The Elisp that is passed on the command line" start="00:03:08.959" video="mainVideo" id=subtitle]]
[[!template text="is explicated over here on the right," start="00:03:12.640" video="mainVideo" id=subtitle]]
[[!template text="and in essence what it does is," start="00:03:14.959" video="mainVideo" id=subtitle]]
[[!template text="to keep the startup time minimal" start="00:03:17.920" video="mainVideo" id=subtitle]]
[[!template text="and as low as possible," start="00:03:20.480" video="mainVideo" id=subtitle]]
[[!template text="it loads the absolute bare minimum" start="00:03:21.760" video="mainVideo" id=subtitle]]
[[!template text="needed for Babel," start="00:03:24.080" video="mainVideo" id=subtitle]]
[[!template text="and then it calls hack-local-variables" start="00:03:25.120" video="mainVideo" id=subtitle]]
[[!template text="triggering the eval-local-variables." start="00:03:27.519" video="mainVideo" id=subtitle]]
[[!template text="What do the eval-local-variables do," start="00:03:31.680" video="mainVideo" id=subtitle]]
[[!template text="and how those work?" start="00:03:33.614" video="mainVideo" id=subtitle]]
[[!template text="The essence of the approach is to" start="00:03:34.799" video="mainVideo" id=subtitle]]
[[!template text="use org-confirm-babel-evaluate" start="00:03:36.319" video="mainVideo" id=subtitle]]
[[!template text="to allow Babel execution." start="00:03:38.720" video="mainVideo" id=subtitle]]
[[!template text="We can't set it to nil because that is" start="00:03:40.480" video="mainVideo" id=subtitle]]
[[!template text="an arbitrary code execution vector," start="00:03:43.360" video="mainVideo" id=subtitle]]
[[!template text="which we don't want if we're sharing files." start="00:03:45.308" video="mainVideo" id=subtitle]]
[[!template new="1" text="Instead what we do is," start="00:03:48.000" video="mainVideo" id=subtitle]]
[[!template text="we use the fact that it can be a function," start="00:03:49.555" video="mainVideo" id=subtitle]]
[[!template text="and we normalize the block of code," start="00:03:52.000" video="mainVideo" id=subtitle]]
[[!template text="we checksum it, and then we check" start="00:03:55.280" video="mainVideo" id=subtitle]]
[[!template text="that it matches this checksum up here" start="00:03:57.320" video="mainVideo" id=subtitle]]
[[!template text="at the top of the file," start="00:03:59.280" video="mainVideo" id=subtitle]]
[[!template text="and then sort of inside there," start="00:04:00.400" video="mainVideo" id=subtitle]]
[[!template text="inside of org-sbe," start="00:04:02.640" video="mainVideo" id=subtitle]]
[[!template text="which is Org source block evaluate," start="00:04:04.159" video="mainVideo" id=subtitle]]
[[!template text="we call the block." start="00:04:06.560" video="mainVideo" id=subtitle]]
[[!template new="1" text="The actual implementation of this" start="00:04:08.959" video="mainVideo" id=subtitle]]
[[!template text="is somewhat more complicated." start="00:04:11.120" video="mainVideo" id=subtitle]]
[[!template text="However, it's small enough to fit in" start="00:04:12.497" video="mainVideo" id=subtitle]]
[[!template text="the local variables at the end of the file." start="00:04:14.799" video="mainVideo" id=subtitle]]
[[!template text="One thing to note is that" start="00:04:17.519" video="mainVideo" id=subtitle]]
[[!template text="if you are using PowerShell," start="00:04:19.040" video="mainVideo" id=subtitle]]
[[!template text="PowerShell parses the whole file" start="00:04:20.799" video="mainVideo" id=subtitle]]
[[!template text="which means that" start="00:04:23.919" video="mainVideo" id=subtitle]]
[[!template text="for any normal Org content," start="00:04:25.040" video="mainVideo" id=subtitle]]
[[!template text="you need to put it in" start="00:04:27.759" video="mainVideo" id=subtitle]]
[[!template text="a multi-line PowerShell comment," start="00:04:28.639" video="mainVideo" id=subtitle]]
[[!template text="and close it." start="00:04:30.240" video="mainVideo" id=subtitle]]
[[!template new="1" text="So, once we hit" start="00:04:31.199" video="mainVideo" id=subtitle]]
[[!template text="hack-local-variables at the end," start="00:04:32.371" video="mainVideo" id=subtitle]]
[[!template text="we run the eval-local-variables block," start="00:04:34.160" video="mainVideo" id=subtitle]]
[[!template text="then we enter this Elisp block," start="00:04:37.120" video="mainVideo" id=subtitle]]
[[!template text="and you can write whatever you want." start="00:04:40.880" video="mainVideo" id=subtitle]]
[[!template text="All the power of Org Babel is" start="00:04:42.720" video="mainVideo" id=subtitle]]
[[!template text="now at your fingertips" start="00:04:44.160" video="mainVideo" id=subtitle]]
[[!template text="in order to do what you need" start="00:04:45.360" video="mainVideo" id=subtitle]]
[[!template text="for this file." start="00:04:47.199" video="mainVideo" id=subtitle]]
[[!template new="1" text="Finally, let's do a quick demo" start="00:04:48.800" video="mainVideo" id=subtitle]]
[[!template text="of how to use this to make" start="00:04:50.320" video="mainVideo" id=subtitle]]
[[!template text="your own Org files executable." start="00:04:52.453" video="mainVideo" id=subtitle]]
[[!template text="Orgstrap is available on MELPA as mentioned," start="00:04:54.800" video="mainVideo" id=subtitle]]
[[!template text="and it can be installed using package.el" start="00:05:01.840" video="mainVideo" id=subtitle]]
[[!template text="by calling package-install orgstrap." start="00:05:06.080" video="mainVideo" id=subtitle]]
[[!template text="It will download, and it will install." start="00:05:11.280" video="mainVideo" id=subtitle]]
[[!template text="Then you can open an existing file" start="00:05:13.520" video="mainVideo" id=subtitle]]
[[!template text="or a new file. In this case," start="00:05:18.720" video="mainVideo" id=subtitle]]
[[!template text="let me open a file called example.org." start="00:05:21.919" video="mainVideo" id=subtitle]]
[[!template text="And then orgstrap provides" start="00:05:25.199" video="mainVideo" id=subtitle]]
[[!template text="command called orgstrap-init." start="00:05:26.996" video="mainVideo" id=subtitle]]
[[!template text="What orgstrap-init does is," start="00:05:29.360" video="mainVideo" id=subtitle]]
[[!template text="it populates a file with the machinery" start="00:05:30.953" video="mainVideo" id=subtitle]]
[[!template text="needed to run an orgstrap block." start="00:05:33.759" video="mainVideo" id=subtitle]]
[[!template text="We're just going to do a message" start="00:05:36.639" video="mainVideo" id=subtitle]]
[[!template text="&quot;hello orgstrap!&quot;." start="00:05:38.560" video="mainVideo" id=subtitle]]
[[!template text="If you look up at the top," start="00:05:43.440" video="mainVideo" id=subtitle]]
[[!template text="you will see that the" start="00:05:46.160" video="mainVideo" id=subtitle]]
[[!template text="orgstrap-block-checksum will change" start="00:05:47.386" video="mainVideo" id=subtitle]]
[[!template text="when I save the file." start="00:05:50.320" video="mainVideo" id=subtitle]]
[[!template text="This makes it much easier to author files" start="00:05:51.520" video="mainVideo" id=subtitle]]
[[!template text="with orgstrap blocks." start="00:05:53.840" video="mainVideo" id=subtitle]]
[[!template text="And then we need one last piece" start="00:05:55.120" video="mainVideo" id=subtitle]]
[[!template text="of machinery," start="00:05:56.560" video="mainVideo" id=subtitle]]
[[!template text="which is the shebang block." start="00:05:57.876" video="mainVideo" id=subtitle]]
[[!template text="I am just going to steal" start="00:06:00.400" video="mainVideo" id=subtitle]]
[[!template text="the shebang block from" start="00:06:01.520" video="mainVideo" id=subtitle]]
[[!template text="this other file over here" start="00:06:02.560" video="mainVideo" id=subtitle]]
[[!template text="since it is available." start="00:06:06.080" video="mainVideo" id=subtitle]]
[[!template text="You can also get it from shebang.org," start="00:06:07.039" video="mainVideo" id=subtitle]]
[[!template text="and I have plans to add a command" start="00:06:08.880" video="mainVideo" id=subtitle]]
[[!template text="to insert this into the file directly," start="00:06:10.800" video="mainVideo" id=subtitle]]
[[!template text="which may actually be done by the time" start="00:06:12.560" video="mainVideo" id=subtitle]]
[[!template text="this video is actually posted and visible." start="00:06:15.600" video="mainVideo" id=subtitle]]
[[!template new="1" text="There's one last step," start="00:06:19.520" video="mainVideo" id=subtitle]]
[[!template text="which is that we need to run dired" start="00:06:21.120" video="mainVideo" id=subtitle]]
[[!template text="in order to… There we go." start="00:06:24.160" video="mainVideo" id=subtitle]]
[[!template text="So, we use Shift m, capital m," start="00:06:27.520" video="mainVideo" id=subtitle]]
[[!template text="in order to make our" start="00:06:31.039" video="mainVideo" id=subtitle]]
[[!template text="example file executable," start="00:06:32.800" video="mainVideo" id=subtitle]]
[[!template text="and then if we come back to here," start="00:06:35.520" video="mainVideo" id=subtitle]]
[[!template text="we see that example.org is now executable," start="00:06:42.140" video="mainVideo" id=subtitle]]
[[!template text="and we can run it." start="00:06:47.360" video="mainVideo" id=subtitle]]
[[!template text="&quot;hello orgstrap!&quot;, and we're done." start="00:06:48.000" video="mainVideo" id=subtitle]]
[[!template new="1" text="So, that's the basic workflow" start="00:06:50.560" video="mainVideo" id=subtitle]]
[[!template text="for getting orgstrap files" start="00:06:52.639" video="mainVideo" id=subtitle]]
[[!template text="to be executable." start="00:06:54.880" video="mainVideo" id=subtitle]]
[[!template text="I will be around to answer questions live," start="00:06:56.240" video="mainVideo" id=subtitle]]
[[!template text="and I will be also available in" start="00:06:58.960" video="mainVideo" id=subtitle]]
[[!template text="the #emacsconf IRC channel all day." start="00:07:00.800" video="mainVideo" id=subtitle]]
[[!template text="I hope you have found this useful," start="00:07:03.280" video="mainVideo" id=subtitle]]
[[!template text="and thank you very much for watching." start="00:07:04.960" video="mainVideo" id=subtitle]]
[[!template text="captions by bhavin192 (Bhavin Gandhi)" start="00:07:08.160" video="mainVideo" id=subtitle]]