WEBVTT captioned by bala NOTE Before we begin 00:00:00.000 --> 00:00:01.759 Hello everyone. 00:00:01.760 --> 00:00:03.439 My name is Bala Ramadurai. 00:00:03.440 --> 00:00:07.839 Today I'm going to be talking about org-gmail. 00:00:07.840 --> 00:00:10.039 That's something that I put together. 00:00:10.040 --> 00:00:12.719 This is what I call gmail meets org mode. 00:00:12.720 --> 00:00:15.119 And they get along too. 00:00:15.120 --> 00:00:16.519 Let's talk about email 00:00:16.520 --> 00:00:19.839 and how to manage email via org mode. NOTE The 4-year overnight success 00:00:19.840 --> 00:00:23.919 This project is a four year overnight success. 00:00:23.920 --> 00:00:26.039 It was in 2021. 00:00:26.040 --> 00:00:27.279 I said, Hey, wait a second. 00:00:27.280 --> 00:00:30.519 It'll be so cool if we can integrate Gmail with org. 00:00:30.520 --> 00:00:32.959 So I started trying out new things. 00:00:32.960 --> 00:00:34.399 And immediately I realized 00:00:34.400 --> 00:00:36.799 this is a much larger project than I thought. 00:00:36.800 --> 00:00:40.599 So it lived in someday maybe.org 00:00:40.600 --> 00:00:42.599 for about three years. 00:00:42.600 --> 00:00:48.759 Enter 2024 AI arrives and in 2025 I had a working 00:00:48.760 --> 00:00:50.919 prototype in 24 hours flat. 00:00:50.920 --> 00:00:55.759 So three years and 364 days, nothing much happened 00:00:55.760 --> 00:00:58.159 and one day it actually got it working. 00:00:58.160 --> 00:01:00.919 Sometimes procrastination is just waiting for the 00:01:00.920 --> 00:01:02.799 right tools. NOTE The real title 00:01:02.800 --> 00:01:05.519 The real title should have been org mail for 00:01:05.520 --> 00:01:08.479 people who like org mode more than email. 00:01:08.480 --> 00:01:12.799 The Gmail monster that has always been attacking us. 00:01:12.800 --> 00:01:15.599 Okay, but we still have to deal with email. NOTE Why not gnus/mu4e/notmuch? 00:01:15.600 --> 00:01:18.599 One of the most common questions that I've got so far. 00:01:18.600 --> 00:01:24.639 Why not gnus or mu4e or notmuch, or other tools. 00:01:24.640 --> 00:01:26.359 They are amazing. 00:01:26.360 --> 00:01:29.239 Use them if it works for you, absolutely. 00:01:29.240 --> 00:01:30.319 Just go right ahead. 00:01:30.320 --> 00:01:32.239 If it works for you, don't change anything 00:01:32.240 --> 00:01:34.279 because this looks cool. NOTE The honest answer 00:01:34.280 --> 00:01:36.599 Well, the honest answer for me is that 00:01:36.600 --> 00:01:39.399 they want to be your email client. 00:01:39.400 --> 00:01:40.879 That's not what I am after. 00:01:40.880 --> 00:01:42.959 I don't want an email client. 00:01:42.960 --> 00:01:45.039 I have enough email clients already. 00:01:45.040 --> 00:01:46.239 I don't want one more. 00:01:46.240 --> 00:01:49.359 And they require 500 lines of config. 00:01:49.360 --> 00:01:50.679 I've tried it. 00:01:50.680 --> 00:01:53.039 It's a lot of maintenance for myself, 00:01:53.040 --> 00:01:54.359 I still have those somewhere. 00:01:54.360 --> 00:01:57.319 The mu4e config or the gnus config. 00:01:57.320 --> 00:01:59.439 They struggle with Gmail's labels, 00:01:59.440 --> 00:02:01.839 threading, messages and deletion. 00:02:01.840 --> 00:02:05.439 I find it tough, and it's either 00:02:05.440 --> 00:02:07.079 all in emacs or nothing. 00:02:07.080 --> 00:02:10.079 It cannot be a combinatorial approach, 00:02:10.080 --> 00:02:11.159 is what I realized. 00:02:11.160 --> 00:02:13.519 So I said, why can't we have both? 00:02:13.520 --> 00:02:15.959 I want the org mode's focus 00:02:15.960 --> 00:02:17.919 and Gmail's flexibility. NOTE The org-gmail philosophy 00:02:17.920 --> 00:02:20.559 Org-gmail philosophy is very simple. 00:02:20.560 --> 00:02:22.199 You triage in Gmail. 00:02:22.200 --> 00:02:26.279 Use the fast web UI for the easy stuff 00:02:26.280 --> 00:02:27.879 and process in org mode. 00:02:27.880 --> 00:02:30.639 Pull important threads where you do real work. 00:02:30.640 --> 00:02:33.719 And of course, a two way sync is possible. 00:02:33.720 --> 00:02:36.639 Changes flow both directions. 00:02:36.640 --> 00:02:39.479 Big inspiration has been org-gcal. 00:02:39.480 --> 00:02:42.319 I named it org-gmail because I saw org-gcal. 00:02:42.320 --> 00:02:43.159 It was so cool. 00:02:43.160 --> 00:02:44.759 I really wanted it. 00:02:44.760 --> 00:02:47.719 Think of it like an org capture for email, but 00:02:47.720 --> 00:02:49.439 just bidirectional. NOTE Architecture (the boring but important slide) 00:02:49.440 --> 00:02:52.999 Alright, the architecture (boring, but important 00:02:53.000 --> 00:02:56.679 slide) is that Gmail interacts with Python via an 00:02:56.680 --> 00:02:59.439 API and interacts with Emacs Lisp. 00:02:59.440 --> 00:03:02.519 User commands, org formatting, all that magic is 00:03:02.520 --> 00:03:04.279 done on the Emacs side with Lisp. 00:03:04.280 --> 00:03:09.140 Python side handles the Gmail API, OAuth, 00:03:09.141 --> 00:03:12.407 json wrangling and Gmail API handles 00:03:12.408 --> 00:03:13.959 the actual email data. 00:03:13.960 --> 00:03:17.679 You can do pip install, add to the load path, and 00:03:17.680 --> 00:03:21.199 10 minute OAuth setup, you are all set. NOTE Demo 1: From gmail to org 00:03:21.200 --> 00:03:27.079 We'll switch over to demo from gmail to org. 00:03:27.080 --> 00:03:29.039 How do you go about doing that? 00:03:29.040 --> 00:03:32.879 I will start off with a demo folder that I have. 00:03:32.880 --> 00:03:35.119 It has this tree structure. 00:03:35.120 --> 00:03:36.559 Ignore the tilde files. 00:03:36.560 --> 00:03:37.919 So this is what it contains. 00:03:37.920 --> 00:03:41.639 An org folder with all the working directory, the 00:03:41.640 --> 00:03:44.639 actual where the life of org mode is. 00:03:44.640 --> 00:03:48.239 And I have a credentials.json, this is for logging 00:03:48.240 --> 00:03:49.119 into Gmail. 00:03:49.120 --> 00:03:50.799 This is a file that you can download. 00:03:50.800 --> 00:03:53.319 The instructions are in my README in the 00:03:53.320 --> 00:03:54.159 repository. 00:03:54.160 --> 00:03:56.119 You can find out how to get yourself a 00:03:56.120 --> 00:03:57.719 credentials.json. 00:03:57.720 --> 00:03:59.159 It's not very difficult. 00:03:59.160 --> 00:04:01.479 Once you have these, you're all set. 00:04:01.480 --> 00:04:05.359 All you need to do is if you have straight or any 00:04:05.360 --> 00:04:08.539 of the other VC packages ready, that you can take 00:04:08.540 --> 00:04:11.500 a Git repository and have that in your folder, you 00:04:11.501 --> 00:04:13.399 can do that, or you can do it like this. 00:04:13.400 --> 00:04:15.159 Have a Git clone. 00:04:15.160 --> 00:04:16.479 Like I'm doing it right now. 00:04:16.480 --> 00:04:19.239 Just clone it, keep it in. 00:04:19.240 --> 00:04:20.874 And now you'll see 00:04:20.875 --> 00:04:23.199 that the Gmail is already there. 00:04:23.200 --> 00:04:25.199 There are two files that are really ultra 00:04:25.200 --> 00:04:28.039 important, which is, gmail_label_manager.py and 00:04:28.040 --> 00:04:30.479 org-gmail.el. 00:04:30.480 --> 00:04:31.899 These are the two files that do the email 00:04:31.900 --> 00:04:33.199 processing. 00:04:33.200 --> 00:04:35.199 I have a plain vanilla Emacs 00:04:35.200 --> 00:04:37.479 that I'm going to use for the demo. NOTE Settings 00:04:37.480 --> 00:04:39.439 These are a few settings 00:04:39.440 --> 00:04:42.159 that you will need in order to get going. 00:04:42.160 --> 00:04:45.959 So one is the Gmail itself, the elisp, and the 00:04:45.960 --> 00:04:47.039 Python script. 00:04:47.040 --> 00:04:49.399 You'll need to require the package. 00:04:49.400 --> 00:04:52.399 The org agenda files need to be set. 00:04:52.400 --> 00:04:54.839 If they're already there, then yes, it needs to 00:04:54.840 --> 00:04:55.879 include the org files. 00:04:55.880 --> 00:04:59.279 Main settings are, you need an org file in order 00:04:59.280 --> 00:05:02.239 to download all the emails from Gmail. 00:05:02.240 --> 00:05:03.879 You need the credentials path. 00:05:03.880 --> 00:05:05.519 You need the Python script, 00:05:05.520 --> 00:05:07.439 wherever it is pointed to that. 00:05:07.440 --> 00:05:10.039 The date drawer, you can customize it 00:05:10.040 --> 00:05:11.319 to whatever you want. 00:05:11.320 --> 00:05:12.159 I call it org-gmail. 00:05:12.160 --> 00:05:14.639 You can set it to ignore certain labels, 00:05:14.640 --> 00:05:15.799 not to download it. 00:05:15.800 --> 00:05:17.359 You're not interested in certain labels 00:05:17.360 --> 00:05:18.479 being downloaded. 00:05:18.480 --> 00:05:19.599 You can set that 00:05:19.600 --> 00:05:21.959 and process time out of 300 seconds. 00:05:21.960 --> 00:05:25.359 These are some things to keep life sane in this 00:05:25.360 --> 00:05:27.819 plain vanilla emacs. 00:05:27.820 --> 00:05:30.799 So I have this refile targets and stuff. 00:05:30.800 --> 00:05:33.579 That's the main org-gmail settings are all here. 00:05:33.580 --> 00:05:37.879 I'm going to eval this buffer so that we have all 00:05:37.880 --> 00:05:40.039 of it and we are all set. 00:05:40.040 --> 00:05:43.039 So we have org-gmail ready to work right now. NOTE Downloading 00:05:43.040 --> 00:05:44.959 The first thing I'm going to show you is 00:05:44.960 --> 00:05:48.079 org-gmail-download-by-label. 00:05:48.080 --> 00:05:50.599 This is the demo Gmail that I have. 00:05:50.600 --> 00:05:53.619 They all have some kind of test emails and I'm 00:05:53.620 --> 00:05:56.199 going to label them. 00:05:56.200 --> 00:06:00.719 I've created this hierarchy of labels here based 00:06:00.720 --> 00:06:04.119 on Tiago Forte's PARA - Project, Area, Resources, 00:06:04.120 --> 00:06:06.079 Archives structure. 00:06:06.080 --> 00:06:09.439 1Projects, DemoProject1, 2Areas, DemoArea, 00:06:09.440 --> 00:06:12.119 4Archives, 2025, OldProject. 00:06:12.120 --> 00:06:14.959 I've labeled them inside my Gmail. 00:06:14.960 --> 00:06:20.759 Okay, now let's go to Emacs and we will now 00:06:20.760 --> 00:06:23.719 download these things, but before downloading 00:06:23.720 --> 00:06:26.919 them, you will need to authenticate. 00:06:26.920 --> 00:06:28.800 So for that, you can start 00:06:28.801 --> 00:06:30.900 with any org-gmail command. 00:06:30.901 --> 00:06:35.079 So I'm going to take org-gmail-download-by-label. 00:06:35.080 --> 00:06:38.839 When I press that, it immediately opens a session 00:06:38.840 --> 00:06:39.999 in my browser. 00:06:40.000 --> 00:06:40.659 Okay? 00:06:40.660 --> 00:06:45.799 What you can't see is a list of my Gmail accounts 00:06:45.800 --> 00:06:46.759 that I'm going to select. 00:06:46.760 --> 00:06:50.039 I'm going to select my one Gmail account, and I'm 00:06:50.040 --> 00:06:53.199 going to show you the next screen. 00:06:53.200 --> 00:06:56.999 So in this screen, you'll have to continue and 00:06:57.000 --> 00:06:59.119 select, and the authentication is completed. 00:06:59.120 --> 00:07:02.679 So once it's, this is done, you can close this. 00:07:02.680 --> 00:07:08.999 Come back to Emacs and you will have Select Gmail. 00:07:09.000 --> 00:07:10.439 So it has tab support. 00:07:10.440 --> 00:07:11.719 If you click tab, it will tell you 00:07:11.720 --> 00:07:13.919 what all labels are available. 00:07:13.920 --> 00:07:16.319 I can pick anyone. 00:07:16.320 --> 00:07:21.839 1Projects/DemoProject1, and let's see what happens. 00:07:21.840 --> 00:07:26.479 It starts downloading and it downloads. 00:07:26.480 --> 00:07:28.799 And all three messages, four messages, 00:07:28.800 --> 00:07:29.719 five messages. 00:07:29.720 --> 00:07:30.759 Six, seven. 00:07:30.760 --> 00:07:33.319 There are 11 messages in total, 00:07:33.320 --> 00:07:36.039 and it's downloading all of them. 00:07:36.040 --> 00:07:40.319 ~/demo/org/0Inbox. 00:07:40.320 --> 00:07:42.079 That's where I have it. 00:07:42.080 --> 00:07:44.399 And here are the emails. 00:07:44.400 --> 00:07:46.439 They're all in org mode, format. 00:07:46.440 --> 00:07:48.399 All the emails are in here. 00:07:48.400 --> 00:07:49.719 Since it's org mode, 00:07:49.720 --> 00:07:52.679 it can fold them all and you will see those emails. 00:07:52.680 --> 00:07:54.279 So these are five emails 00:07:54.280 --> 00:07:56.879 that are present for the DemoProject1. NOTE Replying 00:07:56.880 --> 00:07:59.279 The next one I wanted to show you was 00:07:59.280 --> 00:08:01.039 reply without leaving emacs. 00:08:01.040 --> 00:08:04.919 Let's go back to emacs. 00:08:04.920 --> 00:08:06.479 How am I going to reply? 00:08:06.480 --> 00:08:09.319 org-gmail-reply-at-point. 00:08:09.320 --> 00:08:11.379 That's how I'm going to reply. 00:08:11.380 --> 00:08:13.119 Reply all or reply. 00:08:13.120 --> 00:08:13.759 Okay. 00:08:13.760 --> 00:08:16.199 Let's first find out what is the email all about. 00:08:16.200 --> 00:08:16.719 Okay. 00:08:16.720 --> 00:08:19.319 There's just one sender with just one recipient. 00:08:19.320 --> 00:08:21.399 So the reply all or reply 00:08:21.400 --> 00:08:23.020 doesn't make a difference. 00:08:23.021 --> 00:08:23.700 Okay? 00:08:23.701 --> 00:08:28.339 So we will reply at point and if it's Reply All, 00:08:28.340 --> 00:08:30.999 it includes my own email as well. 00:08:31.000 --> 00:08:34.399 In this, my email is .mx. 00:08:34.400 --> 00:08:35.159 Okay. 00:08:35.160 --> 00:08:39.279 Cc, I can cc anybody I want and I won't do that. 00:08:39.280 --> 00:08:42.039 I have a Gmail reply window. 00:08:42.040 --> 00:08:43.439 Split window here. 00:08:43.440 --> 00:08:47.159 C-c C-c is what will send the reply. 00:08:47.160 --> 00:08:50.479 C-c C-k is what will cancel the reply. 00:08:50.480 --> 00:08:51.919 I want to reply. 00:08:51.920 --> 00:08:57.779 So let's say test reply from within emacs 00:08:57.780 --> 00:09:00.559 and bala@balaramadurai.net 00:09:00.560 --> 00:09:01.719 should receive this email. 00:09:01.720 --> 00:09:02.999 Okay. 00:09:03.000 --> 00:09:07.599 Initial successfully reply sent for this email id. 00:09:07.600 --> 00:09:08.599 Okay. 00:09:08.600 --> 00:09:11.959 A feature request I can already imagine is 00:09:11.960 --> 00:09:15.439 the reply also appearing at the bottom of this. 00:09:15.440 --> 00:09:16.759 It's not yet there. 00:09:16.760 --> 00:09:18.279 In the next version I will have that. 00:09:18.280 --> 00:09:22.319 Let's check if I've have sent that email. 00:09:22.320 --> 00:09:25.319 Let's check in the sent box. 00:09:25.320 --> 00:09:29.119 I just checked in the sent and yes, 00:09:29.120 --> 00:09:31.959 a test reply from within emacs, does show up. 00:09:31.960 --> 00:09:33.039 Okay, great. 00:09:33.040 --> 00:09:33.679 That works. NOTE Label management 00:09:33.680 --> 00:09:36.959 The third demo is going to be on label management. 00:09:36.960 --> 00:09:38.439 How do I manage labels? 00:09:38.440 --> 00:09:39.359 Let's see. 00:09:39.360 --> 00:09:40.399 Let's go back to emacs. 00:09:40.400 --> 00:09:46.599 Suppose, I am not keen on this DemoProject1 for this. 00:09:46.600 --> 00:09:50.839 It should belong to DemoArea, okay? 00:09:50.840 --> 00:09:52.919 For this thread itself doesn't belong to this. 00:09:52.920 --> 00:09:57.879 Let's do org-gmail-edit-label-at-point. 00:09:57.880 --> 00:10:00.879 Well, I don't want one project at all. 00:10:00.880 --> 00:10:05.899 It should be under 2Areas/DemoArea. 00:10:05.900 --> 00:10:08.559 I don't think it, it's not tab supported. 00:10:08.560 --> 00:10:09.519 You should know this. 00:10:09.520 --> 00:10:09.999 I will. 00:10:10.000 --> 00:10:11.439 That's another feature request. 00:10:11.440 --> 00:10:14.599 2Areas/DemoArea. 00:10:14.600 --> 00:10:17.679 And when I say this, it should update it. 00:10:17.680 --> 00:10:19.039 Yes, it has updated it. 00:10:19.040 --> 00:10:21.039 So you can see that it has updated 00:10:21.040 --> 00:10:22.159 the label here as well. 00:10:22.160 --> 00:10:26.159 We can go check if it has indeed changed it 00:10:26.160 --> 00:10:29.399 in our... what is the name of the email? 00:10:29.400 --> 00:10:31.439 It's a test mail for one project demo 00:10:31.440 --> 00:10:33.459 and the date is at 3 12. 00:10:33.460 --> 00:10:36.839 Let's check if DemoArea has it. 00:10:36.840 --> 00:10:39.559 It's not refreshed, but there are two, 00:10:39.560 --> 00:10:42.279 two emails now under DemoArea. 00:10:42.280 --> 00:10:43.639 It's obviously done the job well. 00:10:43.640 --> 00:10:46.119 It's happening as expected. 00:10:46.120 --> 00:10:49.159 I just turned this back from DemoArea to 00:10:49.160 --> 00:10:50.159 DemoProject1. 00:10:50.160 --> 00:10:53.759 If you decide that I want to move all of 00:10:53.760 --> 00:10:56.559 DemoProject1 to archive, I'm done with the 00:10:56.560 --> 00:10:57.159 project. NOTE Refiling 00:10:57.160 --> 00:10:58.319 Oh, by the way, you could... 00:10:58.320 --> 00:10:59.599 that's the whole point 00:10:59.600 --> 00:11:00.919 of this is to have 00:11:00.920 --> 00:11:05.199 all of this refiled into your project, 00:11:05.200 --> 00:11:06.719 you can do that. 00:11:06.720 --> 00:11:08.919 I don't know if I have that. 00:11:08.920 --> 00:11:11.639 Yes, I have demo project one 00:11:11.640 --> 00:11:17.519 and I could have emails and I created a node 00:11:17.520 --> 00:11:20.439 and I moved everything there to that folder 00:11:20.440 --> 00:11:24.799 so that when I want to look at the demo project. 00:11:24.800 --> 00:11:25.959 Let me look at this. 00:11:25.960 --> 00:11:29.559 In that context, in the project context and email, 00:11:29.560 --> 00:11:33.959 I have notes, let's say, and one of the emails is 00:11:33.960 --> 00:11:34.839 a note. 00:11:34.840 --> 00:11:38.359 And I want to be able to keep it that way. 00:11:38.360 --> 00:11:41.719 I could refile it and put it under notes as well, 00:11:41.720 --> 00:11:44.439 saying that this has some password, it has some 00:11:44.440 --> 00:11:46.559 reference that I need to have it there. 00:11:46.560 --> 00:11:48.199 I can have it under notes as well. 00:11:48.200 --> 00:11:49.919 So that's the advantage. 00:11:49.920 --> 00:11:52.879 Once it's inside the org mode system, you can do 00:11:52.880 --> 00:11:55.239 many things that are usually org-modesy. 00:11:55.240 --> 00:11:57.599 So you can do all of that within your org mode 00:11:57.600 --> 00:12:00.199 with emails, manipulate them, see it under a 00:12:00.200 --> 00:12:01.359 context, reply to that. 00:12:01.360 --> 00:12:02.574 All of that can happen 00:12:02.575 --> 00:12:04.119 right within your project context. NOTE Archiving 00:12:04.120 --> 00:12:05.439 You're done with this project. 00:12:05.440 --> 00:12:06.999 You want to move to archive. 00:12:07.000 --> 00:12:09.479 So what you need to do is you don't have to be 00:12:09.480 --> 00:12:11.839 here, you can do it this from anywhere. 00:12:11.840 --> 00:12:15.199 Bulk movement of labels, you can do it. 00:12:15.200 --> 00:12:19.679 If you had consult, embark, ivy, or helm, this will 00:12:19.680 --> 00:12:22.439 show up as a dropdown and it looks neater. 00:12:22.440 --> 00:12:24.399 This, I'm using a vanilla emacs, so this is what 00:12:24.400 --> 00:12:26.279 you would see, but it has tab support. 00:12:26.280 --> 00:12:27.519 You can use that. 00:12:27.520 --> 00:12:32.319 So I want to transfer 1Projects/DemoArea1, I want 00:12:32.320 --> 00:12:32.999 to move it to archive. 00:12:33.000 --> 00:12:36.719 So let's say 4Archives is the folder. 00:12:36.720 --> 00:12:41.759 So 4Archives/2025 already set this up. 00:12:41.760 --> 00:12:46.739 I have not created this label in Gmail. 00:12:46.740 --> 00:12:48.680 So do I need to go back to Gmail and create that? 00:12:48.681 --> 00:12:49.839 No, not at all. 00:12:49.840 --> 00:12:52.159 You can do this from the comfort of your org mode. 00:12:52.160 --> 00:12:54.679 Go in here and enter this. 00:12:54.680 --> 00:12:55.639 Let's see what happens. 00:12:55.640 --> 00:12:57.759 So it found that it is not there. 00:12:57.760 --> 00:13:01.439 So it created a new label and it's now moving all 00:13:01.440 --> 00:13:04.799 of the emails, all of those threads into archives 00:13:04.800 --> 00:13:07.079 without deleting 1Projects/DemoProject1. 00:13:07.080 --> 00:13:09.639 So it still has 1Projects/DemoProject1 and it also 00:13:09.640 --> 00:13:10.639 updated the labels here. 00:13:10.640 --> 00:13:12.239 So the project has been moved. 00:13:12.240 --> 00:13:14.999 If you want to move it to archive this entire... 00:13:15.000 --> 00:13:16.479 You can do that too. 00:13:16.480 --> 00:13:19.079 Let's see if it has archives. 00:13:19.080 --> 00:13:21.959 Yes, it has archives and I have it... 00:13:21.960 --> 00:13:24.519 have a heading called 2025. 00:13:24.520 --> 00:13:26.274 My demo project can be moved there 00:13:26.275 --> 00:13:27.279 and I'm done here. 00:13:27.280 --> 00:13:28.399 My project was done. 00:13:28.400 --> 00:13:30.079 All the emails are moved to archive. 00:13:30.080 --> 00:13:32.479 So is this project from my project folder. 00:13:32.480 --> 00:13:34.919 You can integrate it into your workflow, your org 00:13:34.920 --> 00:13:37.139 mode workflow. NOTE Action commands 00:13:37.140 --> 00:13:39.039 Next, we have action commands. 00:13:39.040 --> 00:13:41.399 What all can you do with singular emails? 00:13:41.400 --> 00:13:44.999 You can do four things with single emails. 00:13:45.000 --> 00:13:49.659 Delegate, defer, act on it or trash at point. 00:13:49.660 --> 00:13:50.399 Defer. 00:13:50.400 --> 00:13:52.519 Doesn't seem to work yet. 00:13:52.520 --> 00:13:53.599 That is a snooze part. 00:13:53.600 --> 00:13:54.759 Doesn't seem to work yet. 00:13:54.760 --> 00:13:55.719 That's another bug. 00:13:55.720 --> 00:13:58.239 That's the second bug I have in my package. 00:13:58.240 --> 00:13:59.599 But the rest of them work. 00:13:59.600 --> 00:14:02.519 Delegate is to move it to somebody so they can do 00:14:02.520 --> 00:14:03.119 the job. 00:14:03.120 --> 00:14:06.399 Act is you will do it with a context with a to-do 00:14:06.400 --> 00:14:08.119 which will show up in your agenda. 00:14:08.120 --> 00:14:10.839 Trash the email from your Gmail, and you are done. 00:14:10.840 --> 00:14:12.079 Okay, let's do that. 00:14:12.080 --> 00:14:13.879 Let's go back to emacs. 00:14:13.880 --> 00:14:18.079 I just moved everything back to DemoProject1. 00:14:18.080 --> 00:14:20.919 I moved everything back so that I can demonstrate 00:14:20.920 --> 00:14:22.679 the four actions that I'm showing. 00:14:22.680 --> 00:14:23.519 At least three actions. 00:14:23.520 --> 00:14:25.039 One of them doesn't work yet. 00:14:25.040 --> 00:14:30.179 So if I want to delegate it to somebody in this 00:14:30.180 --> 00:14:31.607 case myself, but I can delegate it 00:14:31.608 --> 00:14:32.839 to anybody I want. 00:14:32.840 --> 00:14:36.159 So how do I do that so I can delegate this, or 00:14:36.160 --> 00:14:38.959 delegate is org-gmail-delegate-at-point. 00:14:38.960 --> 00:14:42.279 Move the cursor to the email, delegate it to this 00:14:42.280 --> 00:14:44.919 guy balaramadurai.net. 00:14:44.920 --> 00:14:46.607 You can add a note saying, 00:14:46.608 --> 00:14:50.799 Hey, act on task quickly. 00:14:50.800 --> 00:14:53.399 Boss is watching. 00:14:53.400 --> 00:14:54.919 Okay? 00:14:54.920 --> 00:14:59.519 So you can say yes, and this thread gets forwarded 00:14:59.520 --> 00:15:01.440 to your colleague 00:15:01.441 --> 00:15:03.559 and so that they can take this up. 00:15:03.560 --> 00:15:05.819 It has indeed arrived here. 00:15:05.820 --> 00:15:07.039 You can see. 00:15:07.040 --> 00:15:08.839 Boss is watching. 00:15:08.840 --> 00:15:11.399 The test reply was also arrived here. 00:15:11.400 --> 00:15:13.079 You can also see that email. 00:15:13.080 --> 00:15:15.359 So that was delegate. 00:15:15.360 --> 00:15:18.519 So how do we set up actions? 00:15:18.520 --> 00:15:21.199 So let's not mess this email. 00:15:21.200 --> 00:15:22.599 This is the second email. 00:15:22.600 --> 00:15:23.919 How do you act 00:15:23.920 --> 00:15:24.919 on it? 00:15:24.920 --> 00:15:27.159 That's an action you set for yourself is add 00:15:27.160 --> 00:15:31.000 action at point, and you do that. 00:15:31.001 --> 00:15:32.940 What action can you set for yourself? 00:15:32.941 --> 00:15:38.619 Write a long report using an LLM. 00:15:38.620 --> 00:15:42.279 Okay, so it's changed the status to a to-do task. 00:15:42.280 --> 00:15:44.959 And the to-do is right here. 00:15:44.960 --> 00:15:47.833 Now, here you can schedule it 00:15:47.834 --> 00:15:50.700 to say tomorrow 9:00 AM. 00:15:50.701 --> 00:15:51.800 So there you go. 00:15:51.801 --> 00:15:53.679 At 9:00 AM I'll be looking at this. NOTE Org Agenda 00:15:53.680 --> 00:15:55.119 Now here's the cool part. 00:15:55.120 --> 00:15:58.933 You can actually find the whole thing 00:15:58.934 --> 00:16:00.559 in org agenda. 00:16:00.560 --> 00:16:03.267 So my entire email threads 00:16:03.268 --> 00:16:05.959 are all in the org agenda. 00:16:05.960 --> 00:16:09.679 They're all present here and my task associated is 00:16:09.680 --> 00:16:11.319 also here in the agenda. 00:16:11.320 --> 00:16:12.767 This is marked TODO, 00:16:12.768 --> 00:16:14.919 means I haven't acted on that email. 00:16:14.920 --> 00:16:16.159 It's still pending. 00:16:16.160 --> 00:16:19.119 And what do I have to do is right here within 00:16:19.120 --> 00:16:21.559 here, which is the action that I have to carry on 00:16:21.560 --> 00:16:22.719 in the DemoProject1. 00:16:22.720 --> 00:16:24.533 You can see that demo project one 00:16:24.534 --> 00:16:25.739 is showing up in the bottom. 00:16:25.740 --> 00:16:28.279 Okay. It's cool way you can also see it in the agenda. NOTE Trash 00:16:28.280 --> 00:16:31.599 I am not interested in this email at all. 00:16:31.600 --> 00:16:33.199 Let's say I, I want to delete it. 00:16:33.200 --> 00:16:33.719 Let's see. 00:16:33.720 --> 00:16:35.319 Yes, I finished the task. 00:16:35.320 --> 00:16:37.599 Now the task is finished. 00:16:37.600 --> 00:16:40.039 I really don't want to see this email, this 00:16:40.040 --> 00:16:40.919 message alone. 00:16:40.920 --> 00:16:42.159 Alright. 00:16:42.160 --> 00:16:42.599 Easy peasy. 00:16:42.600 --> 00:16:46.679 Let's do Gmail Trash at point. 00:16:46.680 --> 00:16:48.020 And you say, message, 00:16:48.021 --> 00:16:49.901 I don't want to delete the entire thread. 00:16:49.880 --> 00:16:50.399 Yes. 00:16:50.400 --> 00:16:51.959 Delete it. 00:16:51.960 --> 00:16:53.239 Delete the message alone. 00:16:53.240 --> 00:16:54.239 And it's gone. 00:16:54.240 --> 00:16:56.039 But it's not gone. 00:16:56.040 --> 00:16:57.159 It's gone to the trash. 00:16:57.160 --> 00:16:59.733 The entire subtree was deleted 00:16:59.734 --> 00:17:01.880 and we have a clean flow here. 00:17:01.881 --> 00:17:04.479 I have archived, it is still in the archive, but 00:17:04.480 --> 00:17:07.439 it's still active according to my Gmail folder. NOTE Real workflow: GTD 00:17:07.440 --> 00:17:09.574 Next I'm going to show you is 00:17:09.575 --> 00:17:12.039 real workflow capture. 00:17:12.040 --> 00:17:15.799 You can use label in email with ToProcess 00:17:15.800 --> 00:17:19.359 downloaded to the inbox.org, and do one of these 00:17:19.360 --> 00:17:20.599 you've already seen. 00:17:20.600 --> 00:17:22.519 Later still doesn't work. 00:17:22.520 --> 00:17:25.639 I will get it to work, but hopefully by the time 00:17:25.640 --> 00:17:28.759 the conference is up, you will have the feature up 00:17:28.760 --> 00:17:29.399 and ready. 00:17:29.400 --> 00:17:32.679 Rest of the stuff works, delegate works, trash 00:17:32.680 --> 00:17:34.039 works, and add action works. 00:17:34.040 --> 00:17:37.479 We are in weekly review can have an email context, 00:17:37.480 --> 00:17:40.559 not just links to an external URL. NOTE Real Workflow: P.A.R.A. 00:17:40.560 --> 00:17:46.519 In the P.A.R.A Our Project, Areas, Resources and 00:17:46.520 --> 00:17:50.039 Archives structure, you can have Gmail labels 00:17:50.040 --> 00:17:51.199 mirror your PARA structure. 00:17:51.200 --> 00:17:53.879 You can have that within your org mode structure, 00:17:53.880 --> 00:17:56.239 and you can mimic that very well. 00:17:56.240 --> 00:17:59.419 All the emails embedded in your own structure and 00:17:59.420 --> 00:18:02.067 you can download it by label 00:18:02.068 --> 00:18:03.520 in the place you want. 00:18:03.521 --> 00:18:05.439 I'm still working on that feature where you can 00:18:05.440 --> 00:18:08.559 have it inside the project structure itself rather 00:18:08.560 --> 00:18:09.839 than an index.org. 00:18:09.840 --> 00:18:11.719 It'll take some time, but I will do it. 00:18:11.720 --> 00:18:14.839 But right now you can refile it once it's in the 00:18:14.840 --> 00:18:17.459 index.org or any other file you choose, and then 00:18:17.460 --> 00:18:21.039 you can bulk move labels to archive and move that 00:18:21.040 --> 00:18:23.319 entire project repository to 00:18:23.320 --> 00:18:26.319 your archive also. That works very well. 00:18:26.320 --> 00:18:29.919 And your org files and Gmail stay in sync 00:18:29.920 --> 00:18:33.039 effortlessly, and the whole email part of it 00:18:33.040 --> 00:18:35.239 becomes part of your knowledge management system. 00:18:35.240 --> 00:18:35.959 Okay. NOTE What this is NOT 00:18:35.960 --> 00:18:37.639 We have reached the end of the demo. 00:18:37.640 --> 00:18:39.667 Hopefully you understood 00:18:39.668 --> 00:18:41.799 what org-gmail was all about. 00:18:41.800 --> 00:18:44.639 If you have any questions, let me know, but some 00:18:44.640 --> 00:18:47.519 bits of warning, I wanted to give you what this 00:18:47.520 --> 00:18:50.239 package is not, it's not a full fledged email 00:18:50.240 --> 00:18:50.959 client. 00:18:50.960 --> 00:18:55.319 It's meant for label management and importing some 00:18:55.320 --> 00:18:58.739 emails that you wanted or you're interested in to 00:18:58.740 --> 00:19:02.079 the context of your projects or areas or your GTD 00:19:02.080 --> 00:19:02.679 context. 00:19:02.680 --> 00:19:07.159 It is not a replacement for gnus, mu4e or notmuch. 00:19:07.160 --> 00:19:10.479 It is not a way to read all your emails in emacs. 00:19:10.480 --> 00:19:13.439 It cannot handle a large server load for sure. 00:19:13.440 --> 00:19:15.679 It is not offline capable. 00:19:15.680 --> 00:19:17.359 It needs API access. 00:19:17.360 --> 00:19:19.479 So bear that in mind. 00:19:19.480 --> 00:19:22.159 What it is, is a bridge between 00:19:22.160 --> 00:19:23.879 gmail and org mode. 00:19:23.880 --> 00:19:27.359 It's a way to manage important email threads. 00:19:27.360 --> 00:19:29.559 So you can keep updating threads. 00:19:29.560 --> 00:19:32.039 Whenever there's a reply, you keep downloading it 00:19:32.040 --> 00:19:32.919 to that thread. 00:19:32.920 --> 00:19:35.279 If you want to keep track of what's going on, what 00:19:35.280 --> 00:19:37.079 is the logical way you can all see it. 00:19:37.080 --> 00:19:40.599 You can even use ellama or one of those to make 00:19:40.600 --> 00:19:41.999 sense of the conversation. 00:19:42.000 --> 00:19:45.279 If it's a long longish thread, it's a power tool 00:19:45.280 --> 00:19:49.079 for the getting things done or Tiago Forte's PARA 00:19:49.080 --> 00:19:49.839 method. 00:19:49.840 --> 00:19:52.119 I've used PARA for a long time now. 00:19:52.120 --> 00:19:54.839 I'm a power user of PARA, so to speak, so I find 00:19:54.840 --> 00:19:56.319 this extremely useful myself. 00:19:56.320 --> 00:19:59.067 It's about 800 lines of Python 00:19:59.068 --> 00:20:02.479 and about 300 to 500 lines of elisp. 00:20:02.480 --> 00:20:06.999 It's usable in 10 minutes, but can remain powerful 00:20:07.000 --> 00:20:07.679 for years. NOTE Technical decisions 00:20:07.680 --> 00:20:10.599 So some technical decisions that I took. 00:20:10.600 --> 00:20:13.419 Why Python plus Gmail, API. 00:20:13.420 --> 00:20:17.959 Gmail API is better at handling than an imap with 00:20:17.960 --> 00:20:19.359 all the other metadata. 00:20:19.360 --> 00:20:20.199 I found it easier. 00:20:20.200 --> 00:20:22.679 Python has excellent Google API libraries. 00:20:22.680 --> 00:20:25.479 Email calls Python via the call-process. 00:20:25.480 --> 00:20:27.559 json is the interchange format. 00:20:27.560 --> 00:20:29.879 Why not pure elisp? 00:20:29.880 --> 00:20:33.799 For one, OAuth 2.0 flow is a bit complex. 00:20:33.800 --> 00:20:35.719 I found it a bit complex to meander on. 00:20:35.720 --> 00:20:38.139 That's probably why it took me three years, 364 00:20:38.140 --> 00:20:40.319 days to get over it. 00:20:40.320 --> 00:20:43.839 Gmail API Client libraries are mature, easier to 00:20:43.840 --> 00:20:48.459 test/debug separately and lets emacs do what it 00:20:48.460 --> 00:20:50.159 does best, which is text editing. 00:20:50.160 --> 00:20:54.759 Pragmatism over purity, the emacs way since 1976. NOTE Roadmap 00:20:54.760 --> 00:20:57.159 Okay, some roadmap here. 00:20:57.160 --> 00:21:00.239 But near term I want better error messages. 00:21:00.240 --> 00:21:02.759 It still gives me python error messages. 00:21:02.760 --> 00:21:05.039 There are some asynchronous operations there's no 00:21:05.040 --> 00:21:06.319 blocking going on. 00:21:06.320 --> 00:21:08.879 It needs a search integration soon. 00:21:08.880 --> 00:21:11.119 Attachment I have not yet touched. 00:21:11.120 --> 00:21:13.879 That's a big big if, I don't know how to integrate 00:21:13.880 --> 00:21:15.879 with org-attach, I'm still wondering how to do 00:21:15.880 --> 00:21:16.439 that. 00:21:16.440 --> 00:21:19.519 Perhaps I should be able to interact with Outlook 00:21:19.520 --> 00:21:21.919 also, fast mail, proton mail. 00:21:21.920 --> 00:21:24.759 I don't know AI summaries of thread. 00:21:24.760 --> 00:21:27.759 I'm thinking ellama could do it, but I'm not very 00:21:27.760 --> 00:21:28.319 sure. 00:21:28.320 --> 00:21:32.079 Calendar integration is a nice idea, but org-gcal 00:21:32.080 --> 00:21:33.319 and org gmail... 00:21:33.320 --> 00:21:34.279 How will they interact? 00:21:34.280 --> 00:21:35.839 How will that work? 00:21:35.840 --> 00:21:37.759 I'm still not sure. I use them separately. 00:21:37.760 --> 00:21:40.599 And any other feature requests that you may have, 00:21:40.600 --> 00:21:41.439 just let me know. NOTE Contributing 00:21:41.440 --> 00:21:44.919 What I may need help with if you have the time and 00:21:44.920 --> 00:21:47.439 you're interested in this project, is to test it 00:21:47.440 --> 00:21:49.079 on macOS and Windows. 00:21:49.080 --> 00:21:50.159 I use Linux. 00:21:50.160 --> 00:21:51.759 I use it on Debian. 00:21:51.760 --> 00:21:52.719 It works fine. 00:21:52.720 --> 00:21:54.359 OAuth edge cases. 00:21:54.360 --> 00:21:55.719 I'm not sure how it works. 00:21:55.720 --> 00:21:57.519 It shows me some error or the other 00:21:57.520 --> 00:21:58.119 here and there. 00:21:58.120 --> 00:22:00.919 Definitely documentation needs improvements. 00:22:00.920 --> 00:22:04.239 Other email provider expertise will be welcome. 00:22:04.240 --> 00:22:07.359 What's ready is, GitHub repo with issues. 00:22:07.360 --> 00:22:10.239 You can start with that could be great if you can 00:22:10.240 --> 00:22:11.879 tell me some issues with that. 00:22:11.880 --> 00:22:13.879 Some kind of development guide. 00:22:13.880 --> 00:22:15.479 I am not a programmer. 00:22:15.480 --> 00:22:18.079 I vibe-coded most of it. 00:22:18.080 --> 00:22:20.919 So a development guide, a true blood developer, 00:22:20.920 --> 00:22:22.479 if they can come and tell me, 00:22:22.480 --> 00:22:23.999 here is what you should be doing, 00:22:24.000 --> 00:22:26.239 I'm more than happy to listen to that. 00:22:26.240 --> 00:22:27.959 And probably a test suite. 00:22:27.960 --> 00:22:28.959 I do that manually. 00:22:28.960 --> 00:22:31.239 All of this, some kind of help with that 00:22:31.240 --> 00:22:32.939 will also work. NOTE The big picture 00:22:32.940 --> 00:22:36.559 The big picture is org-mode and Gmail 00:22:36.560 --> 00:22:37.679 can be friends. 00:22:37.680 --> 00:22:41.119 They can bond over a cup of coffee. NOTE Let's connect 00:22:41.120 --> 00:22:41.959 Let's connect. 00:22:41.960 --> 00:22:47.659 Here are my details and I am all game to listen to 00:22:47.660 --> 00:22:48.679 your question and answers. 00:22:48.680 --> 00:22:51.279 I'm happy to give you any answer or responses that 00:22:51.280 --> 00:22:51.999 I find. 00:22:52.000 --> 00:22:54.439 Please do connect with me on LinkedIn. I have my 00:22:54.440 --> 00:22:58.359 website here, and please do fork or install 00:22:58.360 --> 00:23:00.519 org-gmail and let me know what you think. 00:23:00.520 --> 00:23:02.759 Let's talk about taming email. 00:23:02.760 --> 00:23:04.400 Thank you very much.