summaryrefslogblamecommitdiffstats
path: root/2023/captions/emacsconf-2023-unentangling--unentangling-projects-and-repos--alexey-bochkarev--main.vtt
blob: 1086b80b85e67a0059756aadbd95e4df663435be (plain) (tree)
1
2
3
4
5
6
7
8
9
                          
 
                 
 
                             
                            
 

                                           
 

                                           
 






                                             

                       


























                                             

                
                             
                             










                                             
                                            




                                        
                                      




                                          
                                             







                                           
                               




                             
                                     

                             
                                            

                             
                                           













                                           
                                      

                             
                                        

                             
                                        









                                         

                   









                                          
                               































                                          
                                      































                                             
                                        







                                         
                                    



                                     

              



















                                            
 

                                           
 

                                           
 

                                   
 

                                        
 

                                       
 

                                           
 

                                          
 

                                     
 

                                        
 

                                         
 

                             
 
                             
                               
 
                             
                                   
 

                                          
 

                                     
 

                                         
 

                                          
 

                                           
 

                             
 

                                            
 

                             
 

          
                             
                                              
 

                                           
 

                                             
 

                                         
 

                                          
 

                                            
 

                                             
 

                                           
 

                                             
 

                             
 

                                    
 

                              
 

                                             
 

                             
 

                                            
 

                                       
 

                                       
 

                                            
 

                             
 

             

                               
 

                                            
 

                                        
 

                             
 

                                             
 

                                             
 

                                
 

                             
 

                                            
 

                                          
 

                             
 

                                             
 

                                           
 

                                             
 

                                             
 

                                           
 

                             
 

                                        
 

                              
 

                                           
 

                                         
 

                             
 

                             
 

                                            
 

                                  
 

                             
 

                                        
 

                                          
 

                                      
 

                                       
 

                                      
 

                             
 

                                     
 

                                             
 

                                           
 

                               
 

                                            
 

                                         
 

                                      
 

                                          
 
                             
                                              
 

                                         
 
                             
                                        
 

                                    
 

                                     
 

                                             
 

                                          
 

                                          
 






                             
 

                                        
 

                                        
 

                                             
 

                              
 

                                           
 

                                        
 

                             
 

                                     
 

                                           
 

                                         
 

                                            
 

                                  
 

                             
 

                                           
 

                             
 

                                  
 

                             
 

                                    
 
                             
                                         
 
                             
                                           
 

                               
 

                                 
 

                                        
 

                             
 

                                   
 
                             
                     
 

                                          
 

                             
 

                             
 

                                          
 

                             
 

                             
 

                                           
 

                                             
 

                                            
 

                                           
 

                                    
 

                                             
 

                                     
 

                                          
 

                                        
 

                                          
 

                                  
 

                                            
 

                                                        
 

                                          
 

                             
 

                             
 

                             
 

                             
 

                  

                                          
 

                                     
 

                             
 

                                             
 

                                            
 

                                            
 

                                         
 

                                            
 

                                         
 

                                           
 

                                           
 

                                            
 

                                            
 

                                         
 

                                        
 

                                            
 

                                        
 

                               
 

                              
 
                             
                                   
 

                                         
 

                                 
 

                                       
 

                                           
 

                                            
 

                                       
 

                                   
 

                             
 

                                            
 

                                            
 

                             
 

                                           
 

                                            
 

                                             
 

                             
 

                                          
 

                                       
 

                                        
 

                                        
 

                                   
 

                                             
 

                                           
 

                                            
 

                                
WEBVTT captioned by sachac

NOTE Introduction

00:00:01.220 --> 00:00:03.580
Hello, I'm Alexey Bochkarev,

00:00:03.740 --> 00:00:06.899
and I'm talking about unentangling projects

00:00:06.899 --> 00:00:09.679
and repositories, or maybe entangling them,

00:00:09.679 --> 00:00:11.340
depending on how you look at that.

00:00:12.980 --> 00:00:15.740
So there's going to be a short workflow note.

00:00:16.619 --> 00:00:19.460
I work as a researcher,

00:00:19.940 --> 00:00:23.380
So there are 3 main components to my work,

00:00:23.680 --> 00:00:26.000
I guess. First, I think,

00:00:26.000 --> 00:00:28.140
so I try to come up with a new ideas that

00:00:28.140 --> 00:00:31.580
usually results in some collection of notes I

00:00:31.580 --> 00:00:33.760
have. Second, I try things out.

00:00:33.760 --> 00:00:36.180
So it usually means that I write code.

00:00:36.820 --> 00:00:38.540
And third, I communicate.

00:00:38.739 --> 00:00:40.739
So I prepare papers, presentations,

00:00:41.260 --> 00:00:43.160
memos, and so on and so forth.

NOTE The problem

00:00:44.120 --> 00:00:47.940
The workflow problem I had is

00:00:49.160 --> 00:00:53.000
sometimes all this does not really fit into a

00:00:53.000 --> 00:00:56.180
concept of a single repository per project.

00:00:56.200 --> 00:00:57.540
So I might want to have,

00:00:58.180 --> 00:01:01.160
for example, a source code in one repository

00:01:01.320 --> 00:01:03.480
and then I would like to have a paper in

00:01:03.480 --> 00:01:05.200
another one, and then I want to have a

00:01:05.200 --> 00:01:08.620
collection of notes somewhere unrelated to

00:01:08.620 --> 00:01:12.500
those two. Emacs is pretty good at supporting

00:01:12.500 --> 00:01:15.840
your workflows and I figured I should share

00:01:16.240 --> 00:01:18.100
what I used and what works for me.

00:01:20.560 --> 00:01:24.900
From the technical perspective,

00:01:26.479 --> 00:01:27.940
things are pretty easy.

00:01:27.940 --> 00:01:30.720
I use a collection of pretty standard

00:01:30.720 --> 00:01:33.240
components of Emacs. So it's projectile, org

00:01:33.240 --> 00:01:35.360
mode with this capture templates, and other

00:01:35.360 --> 00:01:38.100
things. Then I sustained a collection of

00:01:38.100 --> 00:01:40.360
nodes in something that is called org-roam,

00:01:40.680 --> 00:01:43.520
which is essentially it's a glorified

00:01:43.580 --> 00:01:45.580
collection of org mode files.

00:01:46.100 --> 00:01:48.160
Then I used directory-local variables,

00:01:48.260 --> 00:01:51.140
maybe a ctags to jump through the source

00:01:51.140 --> 00:01:54.920
code and very, very little elisp glue to

00:01:54.920 --> 00:01:57.620
make this all work, but that's not really

00:01:58.620 --> 00:02:00.400
rocket science. So that's the workflow I

00:02:00.400 --> 00:02:02.180
would like to talk about today.

NOTE Jumping around

00:02:04.860 --> 00:02:07.120
So what I mean by all that,

00:02:07.960 --> 00:02:10.280
it's pretty straightforward to make Emacs,

00:02:10.680 --> 00:02:12.720
to make it easy to jump around a single

00:02:12.720 --> 00:02:14.980
repository in Emacs. So if I...

00:02:15.060 --> 00:02:16.640
Now I have Doom Emacs,

00:02:16.640 --> 00:02:18.740
but that's not really specific to a Doom

00:02:19.120 --> 00:02:23.160
that'll work in any Emacs configuration.

00:02:23.400 --> 00:02:27.720
Well, key bindings might be different,

00:02:27.720 --> 00:02:28.820
but that's not the point,

00:02:28.820 --> 00:02:29.940
I guess, for the workflow.

00:02:30.060 --> 00:02:31.960
So if I hit space 2 times,

00:02:31.960 --> 00:02:34.640
I have all the list of files within my

00:02:34.640 --> 00:02:38.200
project, right? So if I create a couple of

00:02:38.200 --> 00:02:42.780
custom shortcuts, so if I press a magic

00:02:42.780 --> 00:02:45.280
button, Hyper+o p... don't worry about

00:02:45.280 --> 00:02:47.460
hyper-key. So I want it to have a modifier

00:02:47.560 --> 00:02:50.140
key all to myself, so that would,

00:02:50.320 --> 00:02:53.200
no program on my computer would use that

00:02:53.200 --> 00:02:55.680
except Emacs. Emacs would use that only when

00:02:55.680 --> 00:02:57.540
I tell it to, so I have a hyper key instead

00:02:57.540 --> 00:03:00.720
of caps lock. That's pretty easy to do in GNU

00:03:00.720 --> 00:03:04.940
Linux system. So when I press this magic

00:03:04.940 --> 00:03:07.400
keys, I have a menu that's a normal key

00:03:07.400 --> 00:03:09.940
binding. Yeah, essentially an Emacs.

00:03:10.240 --> 00:03:12.260
And if I hit, for example,

00:03:12.540 --> 00:03:15.200
r, I end up in a README file within this

00:03:15.200 --> 00:03:17.320
specific repository I was sitting in,

00:03:17.320 --> 00:03:19.000
right? So if I want to document something

00:03:19.000 --> 00:03:21.420
real quick, I go to the README file.

00:03:21.680 --> 00:03:25.280
Then I could go to a change log file,

NOTE Capturing

00:03:25.280 --> 00:03:27.440
right? So I have a list of changes and the

00:03:27.440 --> 00:03:29.480
way it works usually, for example,

00:03:29.480 --> 00:03:31.140
if I'm working in some code,

00:03:32.220 --> 00:03:34.280
I created a couple of dummy files in there,

00:03:34.280 --> 00:03:36.560
so I'm working in some code and then I

00:03:36.560 --> 00:03:41.780
implemented something and I can just use the

00:03:42.020 --> 00:03:46.860
org mode capture mechanisms to keep track of

00:03:46.860 --> 00:03:48.880
what I want to discuss with colleagues next

00:03:48.880 --> 00:03:52.160
time. For example, I could just hit capture

00:03:52.440 --> 00:03:56.200
repo specific changelog entry and I

00:03:56.200 --> 00:04:02.620
implemented a feature and I can continue

00:04:02.620 --> 00:04:04.340
working without this context switching.

00:04:04.340 --> 00:04:06.500
And then if I want to go to the change log,

00:04:06.880 --> 00:04:11.320
well, it is there. And next time I talk to

00:04:11.320 --> 00:04:12.720
the colleagues about the source code,

00:04:12.720 --> 00:04:14.340
I can open the change log and go through

00:04:14.340 --> 00:04:16.800
entries 1 by 1 and discuss what I haven't

00:04:16.800 --> 00:04:18.980
implemented last time.

00:04:19.540 --> 00:04:22.580
I could go to project-specific,

00:04:24.100 --> 00:04:26.320
sorry, to repo-specific to-do list.

00:04:26.320 --> 00:04:29.020
And I have list of to-dos that would leave

00:04:29.020 --> 00:04:31.320
within a repository. And for example,

00:04:31.320 --> 00:04:34.020
I could have a high level structure here,

00:04:34.640 --> 00:04:36.460
work distribution between team members and

00:04:36.460 --> 00:04:39.380
other things that sort of face outer world,

00:04:39.380 --> 00:04:41.260
so to speak. And of course,

00:04:42.840 --> 00:04:45.400
there are very many ways to jump through the

00:04:45.400 --> 00:04:46.420
source code conveniently.

NOTE Ctags

00:04:46.560 --> 00:04:49.960
I ended up not using language servers. I use a

00:04:49.960 --> 00:04:53.320
special program called ctags and so the way

00:04:53.320 --> 00:04:56.420
it works is just I call projectile regenerate

00:04:56.680 --> 00:05:00.460
tags and it creates the special tags file

00:05:00.460 --> 00:05:05.260
within the repository and then I can again

00:05:06.240 --> 00:05:11.260
run it I usually just hit a single keystroke

00:05:11.520 --> 00:05:14.060
and here is all the symbols that are there in

00:05:14.060 --> 00:05:17.160
my source code, regardless of the language,

00:05:17.160 --> 00:05:19.540
right? So I can jump to the main function and

00:05:19.540 --> 00:05:21.020
that'll be a C++ file.

00:05:21.020 --> 00:05:22.740
Or I could go to the super function,

00:05:22.740 --> 00:05:25.340
which I had in my Python file.

00:05:25.380 --> 00:05:27.120
And this comes in pretty convenient if I have

00:05:27.120 --> 00:05:28.220
a mixture of languages.

00:05:28.360 --> 00:05:30.800
Sometimes I can have some algorithm specific

00:05:30.800 --> 00:05:33.000
code in Julia, and then I can have some

00:05:33.280 --> 00:05:35.380
Python glue within the same source code

00:05:35.380 --> 00:05:37.940
repository, it makes it really convenient to

00:05:39.720 --> 00:05:41.780
jump between all of those.

NOTE Org Roam

00:05:43.080 --> 00:05:46.980
But I have a few problems here.

00:05:47.360 --> 00:05:49.800
So just to give you a little bit of context,

00:05:49.860 --> 00:05:53.100
for example, here is a real project that

00:05:53.100 --> 00:05:54.440
corresponds to real paper.

00:05:55.840 --> 00:05:59.060
I have a single note about that project where

00:05:59.060 --> 00:06:01.780
I keep all the things related to that project

00:06:01.780 --> 00:06:03.260
here, but that's a private note.

00:06:03.260 --> 00:06:04.860
So for example, again,

00:06:04.860 --> 00:06:08.040
I hit a special key that invokes my org-roam

00:06:08.640 --> 00:06:12.680
function that gives me a menu of my notes.

00:06:13.080 --> 00:06:15.200
And so here is the paper,

00:06:15.200 --> 00:06:17.500
essentially. And I can have a paper timeline,

00:06:17.900 --> 00:06:21.180
and I can have a list of all the dates what

00:06:21.180 --> 00:06:23.940
happened to the paper with links to my email,

00:06:24.060 --> 00:06:27.700
right? So for example if I hit this link that

00:06:27.700 --> 00:06:30.160
will open a specific email and that doesn't

00:06:30.160 --> 00:06:31.280
work outside of my computer,

00:06:31.280 --> 00:06:33.140
doesn't make any sense to keep it in the

00:06:33.340 --> 00:06:35.500
outer world facing repository,

00:06:35.500 --> 00:06:37.360
for example. So that's something to myself,

00:06:37.360 --> 00:06:41.420
right? Sometimes I want to have like this

00:06:41.480 --> 00:06:43.940
list of working notes,

00:06:43.940 --> 00:06:45.780
right, that contain like,

00:06:45.780 --> 00:06:49.200
for example, yeah, I might produce this kind

00:06:49.200 --> 00:06:50.620
of things for internal discussion,

00:06:50.640 --> 00:06:52.500
right? It has some marks,

00:06:52.500 --> 00:06:54.620
it has some margin notes and things like

00:06:54.620 --> 00:06:57.620
that. Maybe again, health-based ideas that

00:06:57.620 --> 00:07:00.300
may or may not end up in a repository,

00:07:01.020 --> 00:07:03.220
in the final paper or in a source code,

00:07:03.220 --> 00:07:05.880
but still I want to have it somewhere.

00:07:07.120 --> 00:07:08.600
And well, long story short,

00:07:08.800 --> 00:07:11.680
I need a project folder that would be

00:07:11.680 --> 00:07:16.120
unrelated to the source code or to the source

00:07:16.120 --> 00:07:19.440
code repository or to the paper itself or a

00:07:19.440 --> 00:07:22.780
final report, right? And 1 way,

00:07:22.960 --> 00:07:24.720
as usual, there are multiple ways to achieve

00:07:24.720 --> 00:07:27.660
that, I suppose. And 1 way to do that is,

00:07:29.040 --> 00:07:33.160
so I create a special folder within my

00:07:33.160 --> 00:07:38.100
org-roam storage. So it's a special folder

00:07:38.240 --> 00:07:40.940
outside of any repositories that got backed up

00:07:40.940 --> 00:07:43.940
to my hard drive with certain redundancy,

00:07:44.080 --> 00:07:46.720
but I don't really need version control,

00:07:46.720 --> 00:07:48.280
full blown version control for that.

00:07:48.280 --> 00:07:49.760
I'm okay with just having a couple of

00:07:49.760 --> 00:07:52.900
backups, right? So this is the folder you see

00:07:52.900 --> 00:07:55.320
here. So PKB stands for personal knowledge

00:07:55.320 --> 00:07:58.020
base, and I have a folder project notes in

00:07:58.020 --> 00:07:59.339
there, right?

NOTE How does it work?

00:07:59.340 --> 00:08:01.520
How does it work?

00:08:01.680 --> 00:08:04.940
So I have a folder per project in there,

00:08:05.020 --> 00:08:07.900
essentially. And here I can have all the

00:08:07.900 --> 00:08:11.480
stuff that kind of belongs to me and I do not

00:08:11.480 --> 00:08:14.180
publish it anywhere. And then,

00:08:15.420 --> 00:08:20.280
For example, a source code repository knows

00:08:20.460 --> 00:08:23.240
about that folder and a paper repository

00:08:23.460 --> 00:08:25.120
knows about that folder.

00:08:25.120 --> 00:08:26.820
And anything else that might leave in

00:08:26.820 --> 00:08:28.820
separate places all over my system can know

00:08:28.820 --> 00:08:30.800
about that folder. How do I achieve that?

00:08:30.940 --> 00:08:33.539
Well, essentially this is 1 of the use cases

00:08:34.400 --> 00:08:35.940
for the directory local variables,

00:08:36.360 --> 00:08:39.100
right? So for example,

00:08:39.520 --> 00:08:41.539
how does it work from the user perspective?

00:08:41.580 --> 00:08:43.760
So if I hit a special key,

00:08:44.380 --> 00:08:46.900
oh, sorry, if I hit a special key,

00:08:48.280 --> 00:08:51.060
that would be open project.

00:08:51.680 --> 00:08:55.920
And then for example, org mode file,

00:08:55.920 --> 00:08:58.260
right? So this is my personal notes about

00:08:58.260 --> 00:09:01.260
EmacsConf, not specifically about this very

00:09:01.260 --> 00:09:02.580
talk, but I can have, you know,

00:09:02.580 --> 00:09:04.580
the house baked ideas here again,

00:09:04.760 --> 00:09:06.680
presentation tools and things like that.

00:09:07.440 --> 00:09:09.860
And how does that happen?

00:09:09.940 --> 00:09:13.080
If we try to like look at the code,

00:09:13.080 --> 00:09:14.660
the elisp magic here,

00:09:15.040 --> 00:09:17.560
what is happening is it's just a couple of

00:09:17.560 --> 00:09:18.720
lines of code, in fact,

00:09:18.720 --> 00:09:21.100
so let me just press Control,

00:09:22.540 --> 00:09:28.140
help key. And so the key I was pressing is

00:09:28.140 --> 00:09:30.220
open project or my file.

00:09:30.480 --> 00:09:32.220
And so what we see here,

00:09:32.220 --> 00:09:34.760
there is a single, so it's just a call to a

00:09:34.760 --> 00:09:37.200
find file function. So I opened that file and

00:09:37.200 --> 00:09:40.580
there is a special function that figures out

00:09:40.580 --> 00:09:44.620
what is the like umbrella project nose file

00:09:44.620 --> 00:09:46.600
and that's, again, that's very easy.

00:09:47.380 --> 00:09:51.420
So essentially if a variable describing this,

00:09:51.820 --> 00:09:54.860
the name for that project is defined,

00:09:54.860 --> 00:09:57.440
then I use that as my project folder name.

00:09:57.440 --> 00:09:59.700
If not, I take the project name from the

00:10:00.480 --> 00:10:03.340
project tile. Well, that's pretty much it.

00:10:03.340 --> 00:10:08.800
And how do I define this variable?

00:10:09.280 --> 00:10:12.500
Is essentially there is this magical file in

00:10:12.500 --> 00:10:17.380
a folder called .dir-locals.el. And I just put it there.

00:10:17.440 --> 00:10:20.380
And then whenever I go into that folder or

00:10:20.380 --> 00:10:22.300
any of its children folders,

00:10:22.300 --> 00:10:23.860
I get this variable defined.

00:10:24.840 --> 00:10:26.260
And that's pretty much it.

00:10:26.280 --> 00:10:28.880
That's how it works for me.

NOTE Time tracking

00:10:31.860 --> 00:10:34.620
I guess 1 thing that I wanted to emphasize

00:10:35.380 --> 00:10:37.360
specifically about that is of course,

00:10:37.940 --> 00:10:39.720
it is a time tracking,

00:10:39.720 --> 00:10:42.260
right? So what is I find especially important

00:10:42.260 --> 00:10:44.280
when I work in something and I want to clock

00:10:44.340 --> 00:10:47.620
time, I usually do not want this information

00:10:47.800 --> 00:10:50.340
to be in a source code repository or in a

00:10:50.340 --> 00:10:52.600
paper repository because other people I work

00:10:52.600 --> 00:10:54.840
with will not be particularly happy about

00:10:54.840 --> 00:10:57.540
that, especially if most of them do not use

00:10:57.540 --> 00:11:00.720
Emacs and they'll see this long list of org

00:11:00.720 --> 00:11:03.820
clocked data and that doesn't look nice in a

00:11:03.820 --> 00:11:07.540
plain text format. So what I usually do if I

00:11:07.540 --> 00:11:10.240
want to clock in some time and then later

00:11:10.240 --> 00:11:12.560
analyze what I've been spending time on,

00:11:12.560 --> 00:11:16.880
so I go to my org mode file and I go to the,

00:11:16.880 --> 00:11:21.820
my current project to-dos and I clock in

00:11:21.820 --> 00:11:23.940
there. And that's how it works.

00:11:23.940 --> 00:11:28.860
So again, what comes in handy,

00:11:28.860 --> 00:11:31.500
if I hit C-o, I just go back to the

00:11:31.500 --> 00:11:34.240
file I jumped in into and that's I jumped

00:11:34.240 --> 00:11:35.900
from so that's also pretty handy.

00:11:36.220 --> 00:11:38.800
So again no no rocket science in there.

00:11:40.380 --> 00:11:42.660
So I create a directory local variable that

00:11:42.660 --> 00:11:46.100
helps me to figure out what umbrella project

00:11:46.620 --> 00:11:49.720
does this particular folder belongs to.

00:11:49.940 --> 00:11:53.260
And this way I make Emacs aware of,

00:11:53.260 --> 00:11:54.480
for example, facts like,

00:11:54.480 --> 00:11:56.740
so this source code belongs to that project.

00:11:56.740 --> 00:11:59.080
And this paper, this repository with a paper

00:11:59.180 --> 00:12:00.640
also belongs to that project.

00:12:01.060 --> 00:12:04.040
And I can have capture templates that would

00:12:04.060 --> 00:12:07.580
save my notes into the my private notes file

00:12:07.800 --> 00:12:10.460
and my to-dos and go to my private note files

00:12:10.920 --> 00:12:12.260
and so on and so forth.

00:12:12.260 --> 00:12:15.520
So I find it pretty simple but that really

00:12:15.520 --> 00:12:19.540
helps to reduce this context switching.

00:12:19.600 --> 00:12:22.040
And I don't believe it allows me to save

00:12:22.040 --> 00:12:26.260
time, but that probably helps me to stay

00:12:26.260 --> 00:12:28.420
focused. And this is what is really

00:12:28.420 --> 00:12:31.400
important, I believe. So thank you very much.

00:12:31.400 --> 00:12:33.220
And if you have any comments or suggestions

00:12:33.320 --> 00:12:35.940
to that, please do jump into the discussion.

00:12:37.120 --> 00:12:38.900
Yeah, after the talk, thank you.