summaryrefslogtreecommitdiffstats
path: root/2022/captions
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-12-04 13:01:36 -0500
committerSacha Chua <sacha@sachachua.com>2022-12-04 13:01:36 -0500
commit5109247232612602cff9471e19188daff207e953 (patch)
tree67ca0ef5b910983d244841f36dac21741dbeb50a /2022/captions
parent503d8a1f0d752c0e3e834d7456052344062918b5 (diff)
downloademacsconf-wiki-5109247232612602cff9471e19188daff207e953.tar.xz
emacsconf-wiki-5109247232612602cff9471e19188daff207e953.zip
Automated commit
Diffstat (limited to '2022/captions')
-rw-r--r--2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main--chapters.vtt34
-rw-r--r--2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main.vtt502
2 files changed, 536 insertions, 0 deletions
diff --git a/2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main--chapters.vtt b/2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main--chapters.vtt
new file mode 100644
index 00000000..63f883ff
--- /dev/null
+++ b/2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main--chapters.vtt
@@ -0,0 +1,34 @@
+WEBVTT
+
+00:00:00.000 --> 00:00:27.120
+Intro
+
+00:00:27.120 --> 00:01:15.800
+The problem
+
+00:01:15.800 --> 00:02:30.840
+My solution: detached
+
+00:02:30.840 --> 00:03:30.800
+Shell
+
+00:03:30.800 --> 00:04:27.754
+Compile
+
+00:04:27.854 --> 00:05:21.440
+Detached list sessions
+
+00:05:21.440 --> 00:06:07.080
+Narrow criteria
+
+00:06:07.080 --> 00:06:34.040
+Diff sessions
+
+00:06:34.040 --> 00:07:04.421
+Rich interface with properties
+
+00:07:04.521 --> 00:07:44.988
+Annotation
+
+00:07:45.088 --> 00:10:10.760
+Searching through sessions
diff --git a/2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main.vtt b/2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main.vtt
new file mode 100644
index 00000000..09c4a9df
--- /dev/null
+++ b/2022/captions/emacsconf-2022-detached--getting-detached-from-emacs--niklas-eklund--main.vtt
@@ -0,0 +1,502 @@
+WEBVTT captioned by anush
+
+00:00:00.000 --> 00:00:04.354
+Hello, everyone! Welcome to my talk,
+
+00:00:04.454 --> 00:00:07.221
+"Getting detached from Emacs".
+
+00:00:07.321 --> 00:00:09.720
+When I started to use Emacs,
+
+00:00:09.720 --> 00:00:12.920
+I quickly gravitated towards using it
+
+00:00:12.920 --> 00:00:15.000
+as much as I could.
+
+00:00:15.000 --> 00:00:17.880
+Magit, Org, Dired,
+
+00:00:17.880 --> 00:00:21.360
+a lot of new possibilities opened up.
+
+00:00:21.360 --> 00:00:23.280
+However, there was a workflow
+
+00:00:23.280 --> 00:00:27.120
+that was difficult for me to replace.
+
+00:00:27.120 --> 00:00:30.120
+The problem for me was running shell commands
+
+00:00:30.120 --> 00:00:32.560
+in sub-processes of Emacs,
+
+00:00:32.560 --> 00:00:34.880
+which in some situations led me to stick to
+
+00:00:34.880 --> 00:00:38.000
+using an external terminal.
+
+00:00:38.000 --> 00:00:39.588
+These situations,
+
+00:00:39.688 --> 00:00:43.254
+often revolved around long-running shell commands,
+
+00:00:43.354 --> 00:00:46.054
+either on my local machine
+
+00:00:46.154 --> 00:00:48.600
+or on a remote host.
+
+00:00:48.600 --> 00:00:50.240
+When I was on a remote host,
+
+00:00:50.240 --> 00:00:52.800
+I would also rely on using the program tmux
+
+00:00:52.800 --> 00:00:57.280
+to be able to detach from the remote process.
+
+00:00:57.280 --> 00:00:59.521
+My main concern at the time
+
+00:00:59.621 --> 00:01:01.854
+was that I didn't want to having to avoid
+
+00:01:01.954 --> 00:01:03.440
+restarting Emacs,
+
+00:01:03.440 --> 00:01:07.800
+because I needed to wait for a process to complete.
+
+00:01:07.800 --> 00:01:11.200
+However, there was of course a lot of things
+
+00:01:11.200 --> 00:01:15.800
+I was missing out on by not using Emacs.
+
+00:01:15.800 --> 00:01:19.760
+Therefore, my solution to resolving
+
+00:01:19.760 --> 00:01:22.840
+the issue of occasionally having to leave Emacs
+
+00:01:22.840 --> 00:01:26.188
+led me down the path of developing the package
+
+00:01:26.188 --> 00:01:28.221
+Detached.
+
+00:01:28.321 --> 00:01:31.160
+The package allows Emacs to delegate
+
+00:01:31.160 --> 00:01:33.640
+the responsibility of creating processes
+
+00:01:33.640 --> 00:01:36.840
+to the program dtach.
+
+00:01:36.840 --> 00:01:39.021
+It also makes sure to write
+
+00:01:39.121 --> 00:01:44.321
+the output of the process to a file,
+
+00:01:44.421 --> 00:01:48.154
+which we will see later on how that is being used.
+
+00:01:48.254 --> 00:01:50.800
+The package makes Emacs capable of
+
+00:01:50.800 --> 00:01:53.120
+attaching to these processes
+
+00:01:53.120 --> 00:01:55.280
+as well as managing them.
+
+00:01:55.280 --> 00:01:58.880
+In the package, each process is called a session,
+
+00:01:58.880 --> 00:02:01.040
+and inside of Emacs that is just
+
+00:02:01.040 --> 00:02:02.560
+an object with properties
+
+00:02:02.560 --> 00:02:04.588
+such as what command is being run,
+
+00:02:04.688 --> 00:02:06.720
+what working directory is used,
+
+00:02:06.720 --> 00:02:10.240
+where the output is stored, etc.
+
+00:02:10.240 --> 00:02:12.480
+The important aspect is also that
+
+00:02:12.480 --> 00:02:16.840
+these objects are being persistent,
+
+00:02:16.840 --> 00:02:20.121
+so they are stored over time.
+
+00:02:20.221 --> 00:02:22.920
+Today, I'm going to walk you through
+
+00:02:22.920 --> 00:02:26.054
+how I use the package and what advantages
+
+00:02:26.154 --> 00:02:30.840
+there are of treating processes like text.
+
+00:02:30.840 --> 00:02:35.720
+I'm going to start by opening up M-x shell,
+
+00:02:35.720 --> 00:02:40.288
+and I will run a command
+
+00:02:40.388 --> 00:02:46.920
+to update my package manager.
+
+00:02:46.920 --> 00:02:48.254
+Instead of pressing return,
+
+00:02:48.354 --> 00:02:50.240
+I'll simply press shift return
+
+00:02:50.240 --> 00:02:52.600
+to let Emacs delegate the execution
+
+00:02:52.600 --> 00:02:54.920
+to the dtach program.
+
+00:02:54.920 --> 00:02:57.600
+Emacs will immediately attach itself to the process,
+
+00:02:57.600 --> 00:03:00.960
+and we therefore don't perceive any difference
+
+00:03:00.960 --> 00:03:04.480
+from when running the command as a subprocess.
+
+00:03:04.480 --> 00:03:06.488
+We now have the option though
+
+00:03:06.588 --> 00:03:09.800
+to detach from the session,
+
+00:03:09.800 --> 00:03:12.080
+and later on we can of course
+
+00:03:12.080 --> 00:03:17.054
+reattach Emacs to the session.
+
+00:03:17.154 --> 00:03:20.421
+For me, this addresses the core
+
+00:03:20.521 --> 00:03:23.800
+of the problem that I had.
+
+00:03:23.800 --> 00:03:25.040
+But let’s see what’s more
+
+00:03:25.040 --> 00:03:30.800
+the new workflow inside of Emacs can bring.
+
+00:03:30.800 --> 00:03:35.720
+The package supports multiple user interfaces
+
+00:03:35.720 --> 00:03:39.840
+such as Eshell and Compile.
+
+00:03:39.840 --> 00:03:43.360
+I will therefore switch to the Detached project,
+
+00:03:43.360 --> 00:03:49.440
+and I will run the build command that I use.
+
+00:03:49.440 --> 00:03:54.040
+I will run it with detached-compile
+
+00:03:54.040 --> 00:03:55.800
+with the difference that
+
+00:03:55.800 --> 00:03:59.800
+I can detach from the compilation.
+
+00:03:59.800 --> 00:04:05.000
+One benefit of this new workflow is that
+
+00:04:05.000 --> 00:04:08.680
+I can get a system notification shown up here
+
+00:04:08.680 --> 00:04:10.760
+once a session has finished.
+
+00:04:10.760 --> 00:04:15.520
+Previously, I was either forced to have
+
+00:04:15.520 --> 00:04:19.040
+the terminal open so I could see it or hiding it,
+
+00:04:19.040 --> 00:04:27.754
+but then risking having forgotten it.
+
+00:04:27.854 --> 00:04:32.560
+How do we then see the output of a session?
+
+00:04:32.560 --> 00:04:36.788
+Get the detached-list-sessions command,
+
+00:04:36.888 --> 00:04:42.854
+and here we see
+
+00:04:42.954 --> 00:04:45.600
+the command that we just built,
+
+00:04:45.600 --> 00:04:48.440
+and we see the guix pull with an asterisk
+
+00:04:48.440 --> 00:04:54.480
+indicating that it is continuously running.
+
+00:04:54.480 --> 00:05:01.421
+If I press enter,
+
+00:05:01.521 --> 00:05:04.440
+we will get the output of the session here.
+
+00:05:04.440 --> 00:05:07.200
+And since it was run using compile,
+
+00:05:07.200 --> 00:05:11.720
+we also have compilation mode enabled here,
+
+00:05:11.720 --> 00:05:14.188
+so we could navigate between
+
+00:05:14.288 --> 00:05:17.160
+potential warnings or errors.
+
+00:05:17.160 --> 00:05:21.440
+And we see that there is a warning here.
+
+00:05:21.440 --> 00:05:26.621
+One thing that
+
+00:05:26.721 --> 00:05:28.920
+I have prepared here is that
+
+00:05:28.920 --> 00:05:32.240
+if I open up the user interface,
+
+00:05:32.240 --> 00:05:35.760
+we only see two sessions,
+
+00:05:35.760 --> 00:05:38.988
+but that is because we applied a filter here.
+
+00:05:39.088 --> 00:05:43.160
+So, we have actually the only sessions
+
+00:05:43.160 --> 00:05:46.000
+that are created within the last 12 hours
+
+00:05:46.000 --> 00:05:47.360
+and that are considered unique.
+
+00:05:47.360 --> 00:05:50.600
+So, if I remove the uniqueness,
+
+00:05:50.600 --> 00:05:57.040
+we also see that we have a previous build
+
+00:05:57.040 --> 00:05:59.280
+running on the main branch.
+
+00:05:59.280 --> 00:06:02.760
+So, I think that's typically normal
+
+00:06:02.760 --> 00:06:07.080
+that you might have that.
+
+00:06:07.080 --> 00:06:10.920
+And since the sessions can be considered text,
+
+00:06:10.920 --> 00:06:14.760
+we can just mark these two and check,
+
+00:06:14.760 --> 00:06:18.880
+does this warning exist on the main branch or not?
+
+00:06:18.880 --> 00:06:22.720
+So, we can just diff these ones
+
+00:06:22.720 --> 00:06:27.454
+and we see that the warning is only present
+
+00:06:27.554 --> 00:06:34.040
+on the emacsconf branch.
+
+00:06:34.040 --> 00:06:37.520
+Now, another benefit, in my opinion,
+
+00:06:37.520 --> 00:06:41.840
+of the new way of working is that
+
+00:06:41.840 --> 00:06:43.240
+I have these properties being displayed
+
+00:06:43.240 --> 00:06:45.321
+in the user interface.
+
+00:06:45.421 --> 00:06:48.960
+I can quickly see which commands are still running,
+
+00:06:48.960 --> 00:06:51.360
+what hosts they are running on,
+
+00:06:51.360 --> 00:06:53.388
+where they are running,
+
+00:06:53.488 --> 00:06:58.121
+and for how long they have been running.
+
+00:06:58.221 --> 00:07:00.321
+And if they have run,
+
+00:07:00.421 --> 00:07:04.421
+how long did it take?
+
+00:07:04.521 --> 00:07:06.880
+Occasionally, though, there might be
+
+00:07:06.880 --> 00:07:16.880
+even more input needed to distinguish sessions.
+
+00:07:16.880 --> 00:07:19.600
+So, what I typically do then is
+
+00:07:19.600 --> 00:07:22.200
+press A to annotate the session,
+
+00:07:22.200 --> 00:07:28.988
+I would add a "Warning found at emacsconf"
+
+00:07:29.088 --> 00:07:32.854
+And then it will show up this annotation
+
+00:07:32.954 --> 00:07:44.988
+in the echo area when I select the session.
+
+00:07:45.088 --> 00:07:48.080
+Another great improvement of using these sessions
+
+00:07:48.080 --> 00:07:52.640
+and consider them being text is,
+
+00:07:52.640 --> 00:07:57.321
+now we also see the guix pull completed here.
+
+00:07:57.421 --> 00:08:00.921
+Then we can also select and see that, okay,
+
+00:08:01.021 --> 00:08:08.600
+there is a lot of updates in this command,
+
+00:08:08.600 --> 00:08:10.160
+but let's not look at it now.
+
+00:08:10.160 --> 00:08:17.554
+Let's instead remember that
+
+00:08:17.654 --> 00:08:19.840
+previously last week
+
+00:08:19.840 --> 00:08:21.640
+when I ran a guix pull,
+
+00:08:21.640 --> 00:08:27.680
+I saw an Emacs package that looks interesting.
+
+00:08:27.680 --> 00:08:30.040
+I rather don't remember its full name,
+
+00:08:30.040 --> 00:08:32.720
+but it has something to do with collection.
+
+00:08:32.720 --> 00:08:38.840
+So, what I then can do is
+
+00:08:38.840 --> 00:08:42.280
+remove the 12 hour narrowing criteria,
+
+00:08:42.280 --> 00:08:47.680
+and we can see here I got sessions ranging back
+
+00:08:47.680 --> 00:08:51.040
+even to 28th of October.
+
+00:08:51.040 --> 00:08:55.600
+Since these are just to be considered text,
+
+00:08:55.600 --> 00:08:58.654
+I can--
+
+00:08:58.754 --> 00:09:00.320
+now let's first narrow the sessions
+
+00:09:00.320 --> 00:09:05.188
+to only show the ones that run guix pull.
+
+00:09:05.288 --> 00:09:08.440
+Then I would narrow based on the output
+
+00:09:08.440 --> 00:09:11.280
+containing a regular expression.
+
+00:09:11.280 --> 00:09:14.400
+So, I remember it was something with collection.
+
+00:09:14.400 --> 00:09:19.988
+And we got one hit.
+
+00:09:20.088 --> 00:09:24.088
+Here it should be something with collection.
+
+00:09:24.188 --> 00:09:29.521
+It was emacs-flymake-collection.
+
+00:09:29.621 --> 00:09:34.721
+This is something that is a
+
+00:09:34.821 --> 00:09:38.400
+very nice feature to have.
+
+00:09:38.400 --> 00:09:42.160
+It doesn't create any overhead
+
+00:09:42.160 --> 00:09:45.280
+of having these old sessions lying around
+
+00:09:45.280 --> 00:09:47.400
+and occasionally, it can be interesting
+
+00:09:47.400 --> 00:09:49.680
+to search through them as well.
+
+00:09:49.680 --> 00:09:55.000
+So, for me, this is another example of
+
+00:09:55.000 --> 00:09:59.954
+when bringing workflows into Emacs,
+
+00:10:00.054 --> 00:10:05.021
+it often opens up new exciting possibilities.
+
+00:10:05.121 --> 00:10:10.760
+Thanks a lot for listening.