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
|
<!-- Automatically generated by emacsconf-publish-after-page -->
<a name="detached-mainVideo-transcript"></a>
# Transcript
[[!template new="1" text="""Hello, everyone! Welcome to my talk,""" start="00:00:00.000" video="mainVideo-detached" id="subtitle"]]
[[!template text=""""Getting detached from Emacs".""" start="00:00:04.454" video="mainVideo-detached" id="subtitle"]]
[[!template text="""When I started to use Emacs,""" start="00:00:07.321" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I quickly gravitated towards using it""" start="00:00:09.720" video="mainVideo-detached" id="subtitle"]]
[[!template text="""as much as I could.""" start="00:00:12.920" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Magit, Org, Dired,""" start="00:00:15.000" video="mainVideo-detached" id="subtitle"]]
[[!template text="""a lot of new possibilities opened up.""" start="00:00:17.880" video="mainVideo-detached" id="subtitle"]]
[[!template text="""However, there was a workflow""" start="00:00:21.360" video="mainVideo-detached" id="subtitle"]]
[[!template text="""that was difficult for me to replace.""" start="00:00:23.280" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""The problem for me was running shell commands""" start="00:00:27.120" video="mainVideo-detached" id="subtitle"]]
[[!template text="""in sub-processes of Emacs,""" start="00:00:30.120" video="mainVideo-detached" id="subtitle"]]
[[!template text="""which in some situations led me to stick to""" start="00:00:32.560" video="mainVideo-detached" id="subtitle"]]
[[!template text="""using an external terminal.""" start="00:00:34.880" video="mainVideo-detached" id="subtitle"]]
[[!template text="""These situations,""" start="00:00:38.000" video="mainVideo-detached" id="subtitle"]]
[[!template text="""often revolved around long-running shell commands,""" start="00:00:39.688" video="mainVideo-detached" id="subtitle"]]
[[!template text="""either on my local machine""" start="00:00:43.354" video="mainVideo-detached" id="subtitle"]]
[[!template text="""or on a remote host.""" start="00:00:46.154" video="mainVideo-detached" id="subtitle"]]
[[!template text="""When I was on a remote host,""" start="00:00:48.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I would also rely on using the program tmux""" start="00:00:50.240" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to be able to detach from the remote process.""" start="00:00:52.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""My main concern at the time""" start="00:00:57.280" video="mainVideo-detached" id="subtitle"]]
[[!template text="""was that I didn't want to having to avoid""" start="00:00:59.621" video="mainVideo-detached" id="subtitle"]]
[[!template text="""restarting Emacs,""" start="00:01:01.954" video="mainVideo-detached" id="subtitle"]]
[[!template text="""because I needed to wait for a process to complete.""" start="00:01:03.440" video="mainVideo-detached" id="subtitle"]]
[[!template text="""However, there was of course a lot of things""" start="00:01:07.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I was missing out on by not using Emacs.""" start="00:01:11.200" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""Therefore, my solution to resolving""" start="00:01:15.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""the issue of occasionally having to leave Emacs""" start="00:01:19.760" video="mainVideo-detached" id="subtitle"]]
[[!template text="""led me down the path of developing the package""" start="00:01:22.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Detached.""" start="00:01:26.188" video="mainVideo-detached" id="subtitle"]]
[[!template text="""The package allows Emacs to delegate""" start="00:01:28.321" video="mainVideo-detached" id="subtitle"]]
[[!template text="""the responsibility of creating processes""" start="00:01:31.160" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to the program dtach.""" start="00:01:33.640" video="mainVideo-detached" id="subtitle"]]
[[!template text="""It also makes sure to write""" start="00:01:36.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""the output of the process to a file,""" start="00:01:39.121" video="mainVideo-detached" id="subtitle"]]
[[!template text="""which we will see later on how that is being used.""" start="00:01:44.421" video="mainVideo-detached" id="subtitle"]]
[[!template text="""The package makes Emacs capable of""" start="00:01:48.254" video="mainVideo-detached" id="subtitle"]]
[[!template text="""attaching to these processes""" start="00:01:50.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""as well as managing them.""" start="00:01:53.120" video="mainVideo-detached" id="subtitle"]]
[[!template text="""In the package, each process is called a session,""" start="00:01:55.280" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and inside of Emacs that is just""" start="00:01:58.880" video="mainVideo-detached" id="subtitle"]]
[[!template text="""an object with properties""" start="00:02:01.040" video="mainVideo-detached" id="subtitle"]]
[[!template text="""such as what command is being run,""" start="00:02:02.560" video="mainVideo-detached" id="subtitle"]]
[[!template text="""what working directory is used,""" start="00:02:04.688" video="mainVideo-detached" id="subtitle"]]
[[!template text="""where the output is stored, etc.""" start="00:02:06.720" video="mainVideo-detached" id="subtitle"]]
[[!template text="""The important aspect is also that""" start="00:02:10.240" video="mainVideo-detached" id="subtitle"]]
[[!template text="""these objects are being persistent,""" start="00:02:12.480" video="mainVideo-detached" id="subtitle"]]
[[!template text="""so they are stored over time.""" start="00:02:16.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Today, I'm going to walk you through""" start="00:02:20.221" video="mainVideo-detached" id="subtitle"]]
[[!template text="""how I use the package and what advantages""" start="00:02:22.920" video="mainVideo-detached" id="subtitle"]]
[[!template text="""there are of treating processes like text.""" start="00:02:26.154" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""I'm going to start by opening up M-x shell,""" start="00:02:30.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and I will run a command""" start="00:02:35.720" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to update my package manager.""" start="00:02:40.388" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Instead of pressing return,""" start="00:02:46.920" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I'll simply press shift return""" start="00:02:48.354" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to let Emacs delegate the execution""" start="00:02:50.240" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to the dtach program.""" start="00:02:52.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Emacs will immediately attach itself to the process,""" start="00:02:54.920" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and we therefore don't perceive any difference""" start="00:02:57.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""from when running the command as a subprocess.""" start="00:03:00.960" video="mainVideo-detached" id="subtitle"]]
[[!template text="""We now have the option though""" start="00:03:04.480" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to detach from the session,""" start="00:03:06.588" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and later on we can of course""" start="00:03:09.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""reattach Emacs to the session.""" start="00:03:12.080" video="mainVideo-detached" id="subtitle"]]
[[!template text="""For me, this addresses the core""" start="00:03:17.154" video="mainVideo-detached" id="subtitle"]]
[[!template text="""of the problem that I had.""" start="00:03:20.521" video="mainVideo-detached" id="subtitle"]]
[[!template text="""But let’s see what’s more""" start="00:03:23.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""the new workflow inside of Emacs can bring.""" start="00:03:25.040" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""The package supports multiple user interfaces""" start="00:03:30.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""such as Eshell and Compile.""" start="00:03:35.720" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I will therefore switch to the Detached project,""" start="00:03:39.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and I will run the build command that I use.""" start="00:03:43.360" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I will run it with detached-compile""" start="00:03:49.440" video="mainVideo-detached" id="subtitle"]]
[[!template text="""with the difference that""" start="00:03:54.040" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I can detach from the compilation.""" start="00:03:55.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""One benefit of this new workflow is that""" start="00:03:59.800" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I can get a system notification shown up here""" start="00:04:05.000" video="mainVideo-detached" id="subtitle"]]
[[!template text="""once a session has finished.""" start="00:04:08.680" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Previously, I was either forced to have""" start="00:04:10.760" video="mainVideo-detached" id="subtitle"]]
[[!template text="""the terminal open so I could see it or hiding it,""" start="00:04:15.520" video="mainVideo-detached" id="subtitle"]]
[[!template text="""but then risking having forgotten it.""" start="00:04:19.040" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""How do we then see the output of a session?""" start="00:04:27.854" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Get the detached-list-sessions command,""" start="00:04:32.560" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and here we see""" start="00:04:36.888" video="mainVideo-detached" id="subtitle"]]
[[!template text="""the command that we just built,""" start="00:04:42.954" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and we see the guix pull with an asterisk""" start="00:04:45.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""indicating that it is continuously running.""" start="00:04:48.440" video="mainVideo-detached" id="subtitle"]]
[[!template text="""If I press enter,""" start="00:04:54.480" video="mainVideo-detached" id="subtitle"]]
[[!template text="""we will get the output of the session here.""" start="00:05:01.521" video="mainVideo-detached" id="subtitle"]]
[[!template text="""And since it was run using compile,""" start="00:05:04.440" video="mainVideo-detached" id="subtitle"]]
[[!template text="""we also have compilation mode enabled here,""" start="00:05:07.200" video="mainVideo-detached" id="subtitle"]]
[[!template text="""so we could navigate between""" start="00:05:11.720" video="mainVideo-detached" id="subtitle"]]
[[!template text="""potential warnings or errors.""" start="00:05:14.288" video="mainVideo-detached" id="subtitle"]]
[[!template text="""And we see that there is a warning here.""" start="00:05:17.160" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""One thing that""" start="00:05:21.440" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I have prepared here is that""" start="00:05:26.721" video="mainVideo-detached" id="subtitle"]]
[[!template text="""if I open up the user interface,""" start="00:05:28.920" video="mainVideo-detached" id="subtitle"]]
[[!template text="""we only see two sessions,""" start="00:05:32.240" video="mainVideo-detached" id="subtitle"]]
[[!template text="""but that is because we applied a filter here.""" start="00:05:35.760" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, we have actually the only sessions""" start="00:05:39.088" video="mainVideo-detached" id="subtitle"]]
[[!template text="""that are created within the last 12 hours""" start="00:05:43.160" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and that are considered unique.""" start="00:05:46.000" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, if I remove the uniqueness,""" start="00:05:47.360" video="mainVideo-detached" id="subtitle"]]
[[!template text="""we also see that we have a previous build""" start="00:05:50.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""running on the main branch.""" start="00:05:57.040" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, I think that's typically normal""" start="00:05:59.280" video="mainVideo-detached" id="subtitle"]]
[[!template text="""that you might have that.""" start="00:06:02.760" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""And since the sessions can be considered text,""" start="00:06:07.080" video="mainVideo-detached" id="subtitle"]]
[[!template text="""we can just mark these two and check,""" start="00:06:10.920" video="mainVideo-detached" id="subtitle"]]
[[!template text="""does this warning exist on the main branch or not?""" start="00:06:14.760" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, we can just diff these ones""" start="00:06:18.880" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and we see that the warning is only present""" start="00:06:22.720" video="mainVideo-detached" id="subtitle"]]
[[!template text="""on the emacsconf branch.""" start="00:06:27.554" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""Now, another benefit, in my opinion,""" start="00:06:34.040" video="mainVideo-detached" id="subtitle"]]
[[!template text="""of the new way of working is that""" start="00:06:37.520" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I have these properties being displayed""" start="00:06:41.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""in the user interface.""" start="00:06:43.240" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I can quickly see which commands are still running,""" start="00:06:45.421" video="mainVideo-detached" id="subtitle"]]
[[!template text="""what hosts they are running on,""" start="00:06:48.960" video="mainVideo-detached" id="subtitle"]]
[[!template text="""where they are running,""" start="00:06:51.360" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and for how long they have been running.""" start="00:06:53.488" video="mainVideo-detached" id="subtitle"]]
[[!template text="""And if they have run,""" start="00:06:58.221" video="mainVideo-detached" id="subtitle"]]
[[!template text="""how long did it take?""" start="00:07:00.421" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""Occasionally, though, there might be""" start="00:07:04.521" video="mainVideo-detached" id="subtitle"]]
[[!template text="""even more input needed to distinguish sessions.""" start="00:07:06.880" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, what I typically do then is""" start="00:07:16.880" video="mainVideo-detached" id="subtitle"]]
[[!template text="""press A to annotate the session,""" start="00:07:19.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I would add a "Warning found at emacsconf"""" start="00:07:22.200" video="mainVideo-detached" id="subtitle"]]
[[!template text="""And then it will show up this annotation""" start="00:07:29.088" video="mainVideo-detached" id="subtitle"]]
[[!template text="""in the echo area when I select the session.""" start="00:07:32.954" video="mainVideo-detached" id="subtitle"]]
[[!template new="1" text="""Another great improvement of using these sessions""" start="00:07:45.088" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and consider them being text is,""" start="00:07:48.080" video="mainVideo-detached" id="subtitle"]]
[[!template text="""now we also see the guix pull completed here.""" start="00:07:52.640" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Then we can also select and see that, okay,""" start="00:07:57.421" video="mainVideo-detached" id="subtitle"]]
[[!template text="""there is a lot of updates in this command,""" start="00:08:01.021" video="mainVideo-detached" id="subtitle"]]
[[!template text="""but let's not look at it now.""" start="00:08:08.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Let's instead remember that""" start="00:08:10.160" video="mainVideo-detached" id="subtitle"]]
[[!template text="""previously last week""" start="00:08:17.654" video="mainVideo-detached" id="subtitle"]]
[[!template text="""when I ran a guix pull,""" start="00:08:19.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I saw an Emacs package that looks interesting.""" start="00:08:21.640" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I rather don't remember its full name,""" start="00:08:27.680" video="mainVideo-detached" id="subtitle"]]
[[!template text="""but it has something to do with collection.""" start="00:08:30.040" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, what I then can do is""" start="00:08:32.720" video="mainVideo-detached" id="subtitle"]]
[[!template text="""remove the 12 hour narrowing criteria,""" start="00:08:38.840" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and we can see here I got sessions ranging back""" start="00:08:42.280" video="mainVideo-detached" id="subtitle"]]
[[!template text="""even to 28th of October.""" start="00:08:47.680" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Since these are just to be considered text,""" start="00:08:51.040" video="mainVideo-detached" id="subtitle"]]
[[!template text="""I can--""" start="00:08:55.600" video="mainVideo-detached" id="subtitle"]]
[[!template text="""now let's first narrow the sessions""" start="00:08:58.754" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to only show the ones that run guix pull.""" start="00:09:00.320" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Then I would narrow based on the output""" start="00:09:05.288" video="mainVideo-detached" id="subtitle"]]
[[!template text="""containing a regular expression.""" start="00:09:08.440" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, I remember it was something with collection.""" start="00:09:11.280" video="mainVideo-detached" id="subtitle"]]
[[!template text="""And we got one hit.""" start="00:09:14.400" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Here it should be something with collection.""" start="00:09:20.088" video="mainVideo-detached" id="subtitle"]]
[[!template text="""It was emacs-flymake-collection.""" start="00:09:24.188" video="mainVideo-detached" id="subtitle"]]
[[!template text="""This is something that is a""" start="00:09:29.621" video="mainVideo-detached" id="subtitle"]]
[[!template text="""very nice feature to have.""" start="00:09:34.821" video="mainVideo-detached" id="subtitle"]]
[[!template text="""It doesn't create any overhead""" start="00:09:38.400" video="mainVideo-detached" id="subtitle"]]
[[!template text="""of having these old sessions lying around""" start="00:09:42.160" video="mainVideo-detached" id="subtitle"]]
[[!template text="""and occasionally, it can be interesting""" start="00:09:45.280" video="mainVideo-detached" id="subtitle"]]
[[!template text="""to search through them as well.""" start="00:09:47.400" video="mainVideo-detached" id="subtitle"]]
[[!template text="""So, for me, this is another example of""" start="00:09:49.680" video="mainVideo-detached" id="subtitle"]]
[[!template text="""when bringing workflows into Emacs,""" start="00:09:55.000" video="mainVideo-detached" id="subtitle"]]
[[!template text="""it often opens up new exciting possibilities.""" start="00:10:00.054" video="mainVideo-detached" id="subtitle"]]
[[!template text="""Thanks a lot for listening.""" start="00:10:05.121" video="mainVideo-detached" id="subtitle"]]
Captioner: anush
Questions or comments? Please e-mail [niklas.eklund@posteo.net](mailto:niklas.eklund@posteo.net?subject=Comment%20for%20EmacsConf%202022%20detached%3A%20Getting%20detached%20from%20Emacs)
<!-- End of emacsconf-publish-after-page -->
|