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