WEBVTT 00:00:03.600 --> 00:00:04.560 Hello. 00:00:04.560 --> 00:00:06.720 Hopefully everyone is staying safe and 00:00:06.720 --> 00:00:08.000 staying home, 00:00:08.000 --> 00:00:10.000 I feel very grateful to live in a world 00:00:10.000 --> 00:00:12.000 today that technology and free software 00:00:12.000 --> 00:00:13.759 can be leveraged to connect people in 00:00:13.759 --> 00:00:16.080 such disconnected and difficult times, 00:00:16.080 --> 00:00:17.840 and to have an online conference like 00:00:17.840 --> 00:00:19.920 this. Hopefully you've all 00:00:19.920 --> 00:00:22.960 enjoyed this year's EmacsConf so far. 00:00:22.960 --> 00:00:24.720 Many thanks to all the people that made 00:00:24.720 --> 00:00:26.880 this possible. 00:00:26.880 --> 00:00:30.000 Anyways, welcome to my talk "Extend Emacs 00:00:30.000 --> 00:00:30.960 to Modern GUI 00:00:30.960 --> 00:00:34.079 Applications with EAF, the Emacs 00:00:34.079 --> 00:00:35.920 Application Framework". 00:00:35.920 --> 00:00:38.320 This will be my first ever talk, so 00:00:38.320 --> 00:00:39.840 apologies for my 00:00:39.840 --> 00:00:43.280 inexperience, let us begin. 00:00:43.280 --> 00:00:46.559 About me: my name is Matthew Zeng, you can 00:00:46.559 --> 00:00:47.840 also call me MT 00:00:47.840 --> 00:00:50.640 or Mingde. I'm a Chinese Canadian living 00:00:50.640 --> 00:00:51.440 in Toronto, 00:00:51.440 --> 00:00:54.239 Ontario. Offline: I'm an undergrad 00:00:54.239 --> 00:00:56.079 studying mathematics at the University 00:00:56.079 --> 00:00:57.760 of Waterloo. 00:00:57.760 --> 00:01:00.480 Online: I'm one of the admins of the 00:01:00.480 --> 00:01:03.039 Emacs China 00:01:03.039 --> 00:01:06.320 — the largest Emacs forum in China. So, 00:01:06.320 --> 00:01:08.080 to all Chinese listening to my talk right 00:01:08.080 --> 00:01:10.960 now, feel free to check it out. 00:01:10.960 --> 00:01:14.320 And this is a link to my GitHub profile, 00:01:14.320 --> 00:01:16.206 (and) to my projects I'm involved in. 00:01:16.206 --> 00:01:18.240 One's M-EMACS which is 00:01:18.240 --> 00:01:20.159 I'm the author of — a user-friendly 00:01:20.159 --> 00:01:21.840 full-featured Emacs configuration 00:01:21.840 --> 00:01:22.799 distribution, 00:01:22.799 --> 00:01:25.040 it is what I'm using right now, as well 00:01:25.040 --> 00:01:26.880 as the Emacs Application Framework 00:01:26.880 --> 00:01:29.119 which I help to maintain along with the 00:01:29.119 --> 00:01:30.400 other author 00:01:30.400 --> 00:01:33.040 lazycat, which of course, is today's 00:01:33.040 --> 00:01:35.759 topic. 00:01:35.759 --> 00:01:38.720 So, as you all might have already 00:01:38.720 --> 00:01:40.960 noticed I'm currently using Emacs 00:01:40.960 --> 00:01:43.600 and opening navigating closing 00:01:43.600 --> 00:01:45.360 all these websites that are rendered 00:01:45.360 --> 00:01:46.159 properly 00:01:46.159 --> 00:01:49.200 all within Emacs, it's all thanks to the 00:01:49.200 --> 00:01:51.840 EAF project. 00:01:51.840 --> 00:01:54.000 So, we're living in a society that's 00:01:54.000 --> 00:01:55.920 heavily dependent on the internet 00:01:55.920 --> 00:01:59.520 and multimedia, it is unavoidable to run 00:01:59.520 --> 00:02:01.200 to some occasion that you need to 00:02:01.200 --> 00:02:02.880 open a fancy website that uses 00:02:02.880 --> 00:02:04.799 JavaScript and CSS, 00:02:04.799 --> 00:02:08.239 or you need to watch some videos. However, 00:02:08.239 --> 00:02:11.120 due to the nature and history of Emacs, 00:02:11.120 --> 00:02:11.840 it cannot 00:02:11.840 --> 00:02:13.840 render all these modern graphics 00:02:13.840 --> 00:02:16.400 effectively and efficiently. 00:02:16.400 --> 00:02:19.360 Emacs is solely a text-based editing 00:02:19.360 --> 00:02:20.400 environment, 00:02:20.400 --> 00:02:23.520 and I argue that this is not a bad thing, 00:02:23.520 --> 00:02:25.680 in fact, it is one of the reasons that me 00:02:25.680 --> 00:02:27.760 and I believe many of you as well 00:02:27.760 --> 00:02:29.760 are attracted to Emacs in the first 00:02:29.760 --> 00:02:30.879 place. 00:02:30.879 --> 00:02:33.760 Unfortunately, this results in us having 00:02:33.760 --> 00:02:35.680 to open a dedicated web browser to 00:02:35.680 --> 00:02:37.040 browse the internet, 00:02:37.040 --> 00:02:38.879 open a dedicated video player to watch 00:02:38.879 --> 00:02:41.440 some videos, or a PDF renderer to read some 00:02:41.440 --> 00:02:42.640 documents. 00:02:42.640 --> 00:02:45.200 So far Emacs cannot do all these tasks on 00:02:45.200 --> 00:02:46.000 its own 00:02:46.000 --> 00:02:48.080 but can only be achieved using other 00:02:48.080 --> 00:02:51.519 external applications. 00:02:51.519 --> 00:02:55.840 So, the other author manateelazycat, 00:02:55.840 --> 00:02:58.640 or lazycat in short, didn't want to use 00:02:58.640 --> 00:03:00.560 all these external applications, 00:03:00.560 --> 00:03:03.120 he wanted to have an uninterrupted Emacs 00:03:03.120 --> 00:03:04.159 experience, 00:03:04.159 --> 00:03:07.280 he wanted to truly live in Emacs. 00:03:07.280 --> 00:03:10.080 However, it would be a lot of work to 00:03:10.080 --> 00:03:11.040 build this 00:03:11.040 --> 00:03:13.519 modern application from scratch, there's 00:03:13.519 --> 00:03:16.239 simply no time or research to do that. 00:03:16.239 --> 00:03:18.800 So, lazycat thought of utilizing existing 00:03:18.800 --> 00:03:20.400 applications 00:03:20.400 --> 00:03:22.319 and to try to make it collaborate with 00:03:22.319 --> 00:03:24.959 Emacs, there are many solutions available, 00:03:24.959 --> 00:03:26.000 one of it 00:03:26.000 --> 00:03:28.560 is the Emacs X Windows Manager, and I'm 00:03:28.560 --> 00:03:30.159 sure a lot of you already know that — 00:03:30.159 --> 00:03:33.360 the EXWM. However, it didn't work for him, 00:03:33.360 --> 00:03:35.200 because although EXWM opens the 00:03:35.200 --> 00:03:37.440 door to use other applications within 00:03:37.440 --> 00:03:38.239 Emacs, 00:03:38.239 --> 00:03:40.879 it as a fine window manager cannot 00:03:40.879 --> 00:03:41.519 modify, 00:03:41.519 --> 00:03:43.920 customize, or extend other software from 00:03:43.920 --> 00:03:45.040 Emacs. 00:03:45.040 --> 00:03:46.799 For example, it cannot modify the 00:03:46.799 --> 00:03:48.480 behavior when you press a key in 00:03:48.480 --> 00:03:49.599 Chromium or 00:03:49.599 --> 00:03:52.159 PDF viewer, therefore it cannot utilize 00:03:52.159 --> 00:03:54.000 the rich Emacs ecosystem that's been 00:03:54.000 --> 00:03:57.360 growing for almost 40 years. 00:03:57.360 --> 00:04:00.720 On the other hand, in the EAF browser, so, 00:04:00.720 --> 00:04:06.206 if you M-x eaf-open-browser-with-history, 00:04:06.206 --> 00:04:07.200 you can see 00:04:07.200 --> 00:04:09.840 on the lower half of my screen — a list of 00:04:09.840 --> 00:04:11.920 histories sorted by my personal 00:04:11.920 --> 00:04:14.560 most visited sites, and you can search 00:04:14.560 --> 00:04:16.560 for a site that you've been 00:04:16.560 --> 00:04:19.440 to or search for some keyword in a 00:04:19.440 --> 00:04:21.840 search engine. 00:04:21.840 --> 00:04:24.240 So, this is all achieved by utilizing the 00:04:24.240 --> 00:04:25.919 popular completion framework in the 00:04:25.919 --> 00:04:29.280 Emacs ecosystem — ivy. 00:04:29.280 --> 00:04:31.120 So, lazycat decided to develop a 00:04:31.120 --> 00:04:33.680 solution of his own in 2018, 00:04:33.680 --> 00:04:36.960 namely the EAF project, so, I joined the 00:04:36.960 --> 00:04:42.756 development last year, 2019. 00:04:42.756 --> 00:04:44.000 EAF is 00:04:44.000 --> 00:04:47.880 a highly customizable and extensible 00:04:47.880 --> 00:04:49.759 GUI application framework that extends 00:04:49.759 --> 00:04:52.056 Emacs to graphical capabilities using 00:04:52.056 --> 00:04:57.840 PyQt5, and it is not a window manager. 00:04:57.840 --> 00:05:02.479 Alright. So, in the README, you can see a 00:05:02.479 --> 00:05:03.440 list of GIFs 00:05:03.440 --> 00:05:05.600 showcasing all the available EAF 00:05:05.600 --> 00:05:06.720 applications, 00:05:06.720 --> 00:05:09.520 a browser, a markdown previewer, a video 00:05:09.520 --> 00:05:12.789 player, a PDF viewer, and more. 00:05:12.789 --> 00:05:14.240 Today I don't have 00:05:14.240 --> 00:05:16.160 enough time to demonstrate each one of 00:05:16.160 --> 00:05:16.560 them, 00:05:16.560 --> 00:05:18.720 but I will select a couple applications 00:05:18.720 --> 00:05:21.120 to show you. 00:05:21.120 --> 00:05:24.240 So, since we are already using EAF browser, 00:05:24.240 --> 00:05:27.840 we'll start with this. Besides using the 00:05:27.840 --> 00:05:29.600 classic Control n (C-n), Control p (C-p) 00:05:29.600 --> 00:05:32.000 you can also use the Vim style hjkl to 00:05:32.000 --> 00:05:33.840 move up or down. 00:05:33.840 --> 00:05:36.320 Also, Meta Shift comma (M-<) or g (moves) to the 00:05:36.320 --> 00:05:37.280 beginning of page, 00:05:37.280 --> 00:05:39.120 Meta Shift period (M->) or capital g (moves) to 00:05:39.120 --> 00:05:41.199 the end of page. 00:05:41.199 --> 00:05:45.306 Vimium and Surfingkeys 00:05:45.306 --> 00:05:46.479 are popular keyboard-based 00:05:46.479 --> 00:05:48.400 browsing techniques in Chrome, 00:05:48.400 --> 00:05:50.479 and they've imported here as well. You 00:05:50.479 --> 00:05:52.720 can press f to toggle markers pointing 00:05:52.720 --> 00:05:53.039 to 00:05:53.039 --> 00:05:55.280 all the links in the current page, say, I 00:05:55.280 --> 00:05:56.960 want to visit the wiki — 00:05:56.960 --> 00:05:59.680 which comes very very handy when you 00:05:59.680 --> 00:06:02.400 want to configure EAF to your liking, 00:06:02.400 --> 00:06:04.720 so you see the marker on top of wiki is 00:06:04.720 --> 00:06:05.440 dd, 00:06:05.440 --> 00:06:08.479 press dd and Enter (RET), and now 00:06:08.479 --> 00:06:10.240 you are navigated to this link, so you 00:06:10.240 --> 00:06:13.840 don't need to use your mouse at all. 00:06:13.840 --> 00:06:16.560 So, a full list of key bindings can be 00:06:16.560 --> 00:06:17.680 found when you (press) 00:06:17.680 --> 00:06:20.560 Control h m (C-h m), just as any other Emacs major 00:06:20.560 --> 00:06:21.199 mode, 00:06:21.199 --> 00:06:22.960 so you don't have to remember everything… 00:06:22.960 --> 00:06:25.600 all the key bindings I said to you. 00:06:25.600 --> 00:06:28.560 So, this is a global binding application 00:06:28.560 --> 00:06:30.960 to every other EAF application as well. 00:06:30.960 --> 00:06:36.720 You can find it under the wiki in the 00:06:36.720 --> 00:06:37.600 keybindings 00:06:37.600 --> 00:06:40.639 section, so press f again and use 00:06:40.639 --> 00:06:44.240 ns, press Enter (RET), now you're in the 00:06:44.240 --> 00:06:45.600 keybindings web page. 00:06:45.600 --> 00:06:47.520 You can see all of the keybindings 00:06:47.520 --> 00:06:49.280 available in every 00:06:49.280 --> 00:06:53.919 EAF application, and you can try them out, 00:06:53.919 --> 00:06:56.479 and you can customize your key bindings 00:06:56.479 --> 00:06:57.956 using eaf-bind-key, 00:06:57.956 --> 00:07:00.240 you can customize Control n (C-n) as 00:07:00.240 --> 00:07:02.960 in the web page 00:07:02.960 --> 00:07:05.759 to scroll up in the EAF PDF viewer, or you 00:07:05.759 --> 00:07:06.639 can unbind 00:07:06.639 --> 00:07:08.806 an existing binding using 00:07:08.806 --> 00:07:10.000 eaf-bind-key, 00:07:10.000 --> 00:07:14.840 bind it to nil, so it doesn't bind to 00:07:14.840 --> 00:07:16.160 anything. 00:07:16.160 --> 00:07:20.319 Okay, so, here comes the important part, 00:07:20.319 --> 00:07:22.479 if you want to customize EAF, you should 00:07:22.479 --> 00:07:25.440 visit the customization page in the wiki. 00:07:25.440 --> 00:07:28.840 Now, I press Meta b to go back in 00:07:28.840 --> 00:07:30.240 history, and 00:07:30.240 --> 00:07:32.960 go to the customization page, press f, 00:07:32.960 --> 00:07:34.080 press ad, 00:07:34.080 --> 00:07:36.639 Enter, and now we're in the customization 00:07:36.639 --> 00:07:37.360 page. 00:07:37.360 --> 00:07:39.280 So, the first customization option you 00:07:39.280 --> 00:07:42.639 see is dark mode, 00:07:42.639 --> 00:07:44.479 let's say, if you want to turn on the dark 00:07:44.479 --> 00:07:46.720 mode for EAF browser, 00:07:46.720 --> 00:07:48.479 and you don't want to use your mouse to 00:07:48.479 --> 00:07:49.919 do all this stuff. 00:07:49.919 --> 00:07:53.360 You press c, and you can select 00:07:53.360 --> 00:07:55.840 c to toggle the caret browsing, you can 00:07:55.840 --> 00:07:58.240 see a lot of markers available, 00:07:58.240 --> 00:08:01.280 poped up again, but they're not 00:08:01.280 --> 00:08:02.720 on top of links but instead of 00:08:02.720 --> 00:08:03.599 paragraphs. 00:08:03.599 --> 00:08:05.360 You select the paragraph of your choice, 00:08:05.360 --> 00:08:06.639 in this case you want 00:08:06.639 --> 00:08:10.240 ls which comes here, 00:08:10.240 --> 00:08:12.720 and then you just move the 00:08:12.720 --> 00:08:15.120 cursor like what you always do 00:08:15.120 --> 00:08:18.800 in Emacs, and now you select everything 00:08:18.800 --> 00:08:26.479 and use Meta w (M-w) to copy the text. 00:08:26.479 --> 00:08:29.199 Now, we (run) Meta Shift colon (M-:) to evaluate 00:08:29.199 --> 00:08:30.960 what we just copied, 00:08:30.960 --> 00:08:35.120 and set that to true, and 00:08:35.120 --> 00:08:38.320 press r or F5 to refresh the page, 00:08:38.320 --> 00:08:42.159 voilà we have the dark mode enabled. 00:08:42.159 --> 00:08:44.880 So, there are…, well, let's toggle 00:08:44.880 --> 00:08:46.160 it back off for now. 00:08:46.160 --> 00:08:49.360 Now, we (run) Meta Shift colon (M-:) again, 00:08:49.360 --> 00:08:51.600 and we find the one we just used, and 00:08:51.600 --> 00:08:53.519 change it back to false, 00:08:53.519 --> 00:08:56.880 and refresh the page, back in the light 00:08:56.880 --> 00:08:59.360 mode. 00:08:59.360 --> 00:09:02.160 So, there are many other customization 00:09:02.160 --> 00:09:03.680 options available, you can either 00:09:03.680 --> 00:09:05.920 evaluate like what we just did or add it 00:09:05.920 --> 00:09:08.000 to your Emacs configuration file. 00:09:08.000 --> 00:09:11.680 So, in this wiki…, 00:09:11.680 --> 00:09:14.399 you can make the EAF browser to 00:09:14.399 --> 00:09:16.320 continue where you left off 00:09:16.320 --> 00:09:20.160 similar to the Chromium setting. 00:09:20.160 --> 00:09:22.800 You can make EAF the default browser 00:09:22.800 --> 00:09:23.839 (in) Emacs by 00:09:23.839 --> 00:09:26.720 aliasing browse-web to 00:09:26.720 --> 00:09:27.680 eaf-open-browser, 00:09:27.680 --> 00:09:31.200 or set the browse-url-browser-function to 00:09:31.200 --> 00:09:33.519 eaf-open-browser, there's just some tricks. 00:09:33.519 --> 00:09:34.480 And there (is) also 00:09:34.480 --> 00:09:37.920 an experimental adblocker currently 00:09:37.920 --> 00:09:41.680 in place, therefore it can 00:09:41.680 --> 00:09:44.720 block some elements but not all, so 00:09:44.720 --> 00:09:47.279 we really encourage people to help us 00:09:47.279 --> 00:09:48.240 test out and 00:09:48.240 --> 00:09:51.440 add more conditions in. 00:09:51.440 --> 00:09:54.560 So, you can…, the EAF Browser is able to 00:09:54.560 --> 00:09:55.760 download 00:09:55.760 --> 00:09:57.680 any files from the internet, and it will 00:09:57.680 --> 00:10:04.000 be downloaded using Aria2. 00:10:04.000 --> 00:10:05.339 You can also customize 00:10:05.339 --> 00:10:07.200 the eaf-browser-download-path 00:10:07.200 --> 00:10:11.120 using eaf-setq, it's a function that we 00:10:11.120 --> 00:10:13.623 defined similar to setq, 00:10:13.623 --> 00:10:15.040 the normal setq we know. 00:10:15.040 --> 00:10:16.480 So, by default the download file is 00:10:16.480 --> 00:10:18.160 stored in your home directory slash 00:10:18.160 --> 00:10:19.600 downloads, 00:10:19.600 --> 00:10:20.800 and you can change that whenever you 00:10:20.800 --> 00:10:22.720 want. You can also disable 00:10:22.720 --> 00:10:26.079 saving browsing history, so, remember 00:10:26.079 --> 00:10:27.089 when I press…, 00:10:27.089 --> 00:10:28.959 when I use M-x eaf-open-browser's 00:10:28.959 --> 00:10:30.480 history, I see all the 00:10:30.480 --> 00:10:32.079 histories here, but if you want more 00:10:32.079 --> 00:10:33.680 privacy, you don't want that to be 00:10:33.680 --> 00:10:35.360 available at all. You can turn it off 00:10:35.360 --> 00:10:37.356 easily with eaf-setq, 00:10:37.356 --> 00:10:40.640 and set that remember-history to false. 00:10:40.640 --> 00:10:42.399 You can also set your default search 00:10:42.399 --> 00:10:43.839 engine. 00:10:43.839 --> 00:10:47.200 Right now we have Google, although 00:10:47.200 --> 00:10:50.480 not really good but… Google and also 00:10:50.480 --> 00:10:53.600 DuckDuckGo which is a better search engine, 00:10:53.600 --> 00:10:57.360 well, yeah, ethically better search 00:10:57.360 --> 00:10:59.360 engine. 00:10:59.360 --> 00:11:02.560 So, you can also configure 00:11:02.560 --> 00:11:05.040 the zoom. The default zoom of your 00:11:05.040 --> 00:11:07.600 browser is 1.0, you can convert 00:11:07.600 --> 00:11:10.000 default-zoom to 1.25, so when 00:11:10.000 --> 00:11:11.920 you open any web page, it will be 00:11:11.920 --> 00:11:17.360 zoomed by default. You can 00:11:17.360 --> 00:11:20.399 also disable JavaScript, although I 00:11:20.399 --> 00:11:22.240 personally don't really suggest you to 00:11:22.240 --> 00:11:23.440 do, because it will 00:11:23.440 --> 00:11:26.240 basically break a lot of our features, 00:11:26.240 --> 00:11:28.480 because a lot of the browser 00:11:28.480 --> 00:11:29.519 related features 00:11:29.519 --> 00:11:33.760 must be implemented using JavaScript, 00:11:33.760 --> 00:11:35.440 but yeah, you can do it if you really 00:11:35.440 --> 00:11:37.920 want to. And there's also some 00:11:37.920 --> 00:11:41.519 customization on EAF Camera 00:11:41.519 --> 00:11:47.760 you can do as well. 00:11:47.760 --> 00:11:52.399 Let's move on to EAF PDF Viewer. 00:11:52.399 --> 00:11:56.079 Now, let's open 00:11:56.079 --> 00:11:59.440 the PDF file using EAF. 00:11:59.440 --> 00:12:01.519 So, that's one something already here, but 00:12:01.519 --> 00:12:02.720 let's open it here. 00:12:02.720 --> 00:12:06.079 So, eaf-open, and 00:12:06.079 --> 00:12:08.160 select "Introduction to Programming in 00:12:08.160 --> 00:12:11.440 Emacs Lisp". 00:12:11.440 --> 00:12:13.760 I have it already open, but it's okay. 00:12:13.760 --> 00:12:17.040 So, you have the file, 00:12:17.040 --> 00:12:20.160 you have other files displayed… 00:12:20.160 --> 00:12:22.800 you have all the pages display, sorry. 00:12:23.200 --> 00:12:27.040 There are 273 pages in total, but notice 00:12:27.040 --> 00:12:29.279 how fast it is to browse 00:12:29.279 --> 00:12:31.440 all the pages, it is blazingly fast, 00:12:31.440 --> 00:12:33.519 that's all thanks to Python and 00:12:33.519 --> 00:12:37.040 MuPDF which you don't really get from 00:12:37.040 --> 00:12:40.880 Emacs Lisp. 00:12:40.880 --> 00:12:43.600 So, let's say if I want to jump to page 00:12:43.600 --> 00:12:48.639 50. We press p and Enter 50. 00:12:48.639 --> 00:12:53.279 And here we are, we are at page 50. 00:12:53.279 --> 00:12:55.440 You can look at the lower right to 00:12:55.440 --> 00:12:58.880 verify the page you're on. 00:12:58.880 --> 00:13:05.120 You can use i to toggle dark mode 00:13:05.120 --> 00:13:07.839 as expected. Let's say you want to 00:13:07.839 --> 00:13:08.240 find 00:13:08.240 --> 00:13:11.519 table of contents, so use Control s — 00:13:11.519 --> 00:13:15.680 the Emacs default binding for I-search, 00:13:15.680 --> 00:13:19.360 and search for a "table of contents", 00:13:19.360 --> 00:13:21.680 here we are, it is highlighted for you, 00:13:21.680 --> 00:13:23.120 and you can Control s for more but 00:13:23.120 --> 00:13:26.006 there's only one match, 00:13:26.006 --> 00:13:27.200 you (press) Control g (C-g) to 00:13:27.200 --> 00:13:28.800 disable the highlight, 00:13:28.800 --> 00:13:30.880 and you see a lot of options for you to 00:13:30.880 --> 00:13:32.320 go. 00:13:32.320 --> 00:13:35.040 Okay. Let's say, if you want to go to the 00:13:35.040 --> 00:13:36.240 preface. 00:13:36.240 --> 00:13:39.519 That is, you press f which is 00:13:39.519 --> 00:13:40.639 also similar to 00:13:40.639 --> 00:13:44.240 EAF browser, you press f for Vimium, 00:13:44.240 --> 00:13:47.760 and you see the marker, now change to wn, 00:13:47.760 --> 00:13:50.160 press wn, and then you can go to the 00:13:50.160 --> 00:13:51.279 preface. 00:13:51.279 --> 00:13:54.320 Now, we are at the preface. 00:13:54.320 --> 00:13:56.480 So, now you finish reading, you want to 00:13:56.480 --> 00:13:57.600 save your progress? 00:13:57.600 --> 00:13:59.440 No worries, it is already saved for you 00:13:59.440 --> 00:14:01.199 by EAF. You can safely 00:14:01.199 --> 00:14:04.240 close the document using x, 00:14:04.240 --> 00:14:07.519 and opening again, eaf-open, 00:14:07.519 --> 00:14:10.560 and the file…, see you are at 00:14:10.560 --> 00:14:14.000 preface again. You're right at where 00:14:14.000 --> 00:14:16.560 you left of. 00:14:16.560 --> 00:14:19.440 You can also use M-x org-store-link, or 00:14:19.440 --> 00:14:20.480 Control c l (C-c l) — 00:14:20.480 --> 00:14:23.279 which I prefer, if you want to save a 00:14:23.279 --> 00:14:24.480 particular page in 00:14:24.480 --> 00:14:28.240 a Org mode file. Now, 00:14:28.240 --> 00:14:30.320 I go back to my presentation doc, I don't 00:14:30.320 --> 00:14:31.760 need this anymore. 00:14:31.760 --> 00:14:35.600 So, you just (press) Control c Control l (C-c C-l), 00:14:35.600 --> 00:14:39.120 or I think M-x org-insert-link. 00:14:39.120 --> 00:14:41.040 You can find the file right here, and 00:14:41.040 --> 00:14:42.399 you press Enter (RET), 00:14:42.399 --> 00:14:44.320 and you press Enter (RET) for the description 00:14:44.320 --> 00:14:46.480 again, and now it's right here, 00:14:46.480 --> 00:14:50.720 and Control c Control o (C-c C-o) to open it. Voilà! 00:14:50.720 --> 00:14:54.000 You're back. 00:14:54.000 --> 00:14:57.120 Let's now demonstrate the EAF Video 00:14:57.120 --> 00:14:58.880 Player. 00:14:58.880 --> 00:15:02.639 So, M-x eaf-open, you use eaf-open whenever 00:15:02.639 --> 00:15:03.279 you want to 00:15:03.279 --> 00:15:06.079 open some file. You use eaf-open-browser 00:15:06.079 --> 00:15:07.279 if you want to use some 00:15:07.279 --> 00:15:09.920 actual application that's not really 00:15:09.920 --> 00:15:11.199 related to a file. 00:15:11.199 --> 00:15:14.800 So, eaf-open, and select the video 00:15:14.800 --> 00:15:15.600 you want, so, 00:15:15.600 --> 00:15:18.320 video-demo, I already have a video 00:15:18.320 --> 00:15:19.040 demo 00:15:19.040 --> 00:15:21.839 ready, because I recorded a video of 00:15:21.839 --> 00:15:22.720 the demo 00:15:22.720 --> 00:15:26.000 of the EAF Camera, have a look. 00:15:26.000 --> 00:15:28.079 Let's move to the beginning, "Hello people 00:15:28.079 --> 00:15:29.279 from the future! 00:15:29.279 --> 00:15:32.399 This is a demo of the EAF Video Player 00:15:32.399 --> 00:15:35.199 that demos the EAF Camera feature, 00:15:35.199 --> 00:15:37.440 so, as you can see on the screen of me 00:15:37.440 --> 00:15:38.639 inside my camera, 00:15:38.639 --> 00:15:40.959 and the screen is actually with all 00:15:40.959 --> 00:15:42.880 within Emacs. 00:15:42.880 --> 00:15:45.273 (Right, the video itself is as well, haha.) 00:15:45.273 --> 00:15:46.079 You can open this 00:15:46.079 --> 00:15:49.839 using eaf-open-camera 00:15:49.839 --> 00:15:53.040 which I'm already into, and you can 00:15:53.040 --> 00:15:53.600 press 00:15:53.600 --> 00:15:56.720 p to capture a photo, 00:15:56.720 --> 00:15:59.680 so, the photo is by default stored at 00:15:59.680 --> 00:16:02.773 your $HOME/Downloads directory, 00:16:02.773 --> 00:16:04.320 and you can modify it 00:16:04.320 --> 00:16:07.839 freely. If you go here, and you can see 00:16:07.839 --> 00:16:09.519 the camera stored 00:16:09.519 --> 00:16:13.759 right here." 00:16:13.759 --> 00:16:16.240 So, you press Space (SPC) to pause, what I used 00:16:16.240 --> 00:16:17.120 here is 00:16:17.120 --> 00:16:20.320 the eaf-open-this-from-dired. 00:16:20.320 --> 00:16:22.959 Basically, in dired 00:16:22.959 --> 00:16:23.839 you select 00:16:23.839 --> 00:16:26.959 the file that should be opened by 00:16:26.959 --> 00:16:30.320 EAF, and I used that. It detects that 00:16:30.320 --> 00:16:32.720 it wants to use the EAF Image Viewer, so 00:16:32.720 --> 00:16:35.839 I accidentally tested EAF Image Viewer 00:16:35.839 --> 00:16:40.240 before I noticed. That gives the 00:16:40.240 --> 00:16:43.680 image of the photo I just took 00:16:43.680 --> 00:16:47.040 using EAF Camera. As you can see, you 00:16:47.040 --> 00:16:47.360 can 00:16:47.360 --> 00:16:50.720 use hl — the Vim binding to navigate 00:16:50.720 --> 00:16:53.256 in the timestamp in the video, 00:16:53.256 --> 00:16:55.920 and I can use 00:16:55.920 --> 00:17:02.320 jk to change the volumes of the video. 00:17:02.320 --> 00:17:05.520 Alright. Now, you've seen all the basic 00:17:05.520 --> 00:17:06.160 usages 00:17:06.160 --> 00:17:08.720 of the EAF project, it comes the question 00:17:08.720 --> 00:17:11.600 of what is the magic behind it. 00:17:11.600 --> 00:17:14.559 All right. Let's open the hacking page in 00:17:14.559 --> 00:17:15.919 the wiki, 00:17:15.919 --> 00:17:20.400 the design is laid out in a diagram here. 00:17:20.400 --> 00:17:25.120 Let's put it 00:17:25.120 --> 00:17:27.839 side by side along with my text, so 00:17:27.839 --> 00:17:32.320 we can follow through. 00:17:32.320 --> 00:17:36.080 Right, okay. Let me…, 00:17:36.080 --> 00:17:42.320 sorry, let me drink some water. 00:17:42.320 --> 00:17:46.000 This page in the wiki went into a lot 00:17:46.000 --> 00:17:48.160 of detail, 00:17:48.160 --> 00:17:49.520 due to the time constraint I will just 00:17:49.520 --> 00:17:51.679 rephrase some of the ideas here, so for 00:17:51.679 --> 00:17:53.520 anyone interested, please have a look at 00:17:53.520 --> 00:17:55.600 the wiki yourself. 00:17:55.600 --> 00:17:58.160 The easiest way to think about EAF is 00:17:58.160 --> 00:17:58.720 that 00:17:58.720 --> 00:18:01.679 the actual GUI application is started in 00:18:01.679 --> 00:18:02.960 the background, 00:18:02.960 --> 00:18:04.960 then the frame of the application is 00:18:04.960 --> 00:18:07.120 attached to the appropriate location on 00:18:07.120 --> 00:18:07.679 the 00:18:07.679 --> 00:18:10.720 Emacs window. So, 00:18:10.720 --> 00:18:13.440 EAF linked Qt5 with Emacs using 00:18:13.440 --> 00:18:14.960 Elisp and Python. 00:18:14.960 --> 00:18:17.120 On the Python side which is colored 00:18:17.120 --> 00:18:18.640 yellow in the image, 00:18:18.640 --> 00:18:20.439 we have QGraphicsView and 00:18:20.439 --> 00:18:22.960 QGraphicsScene objects. 00:18:22.960 --> 00:18:25.039 These are used to simulate the Emacs 00:18:25.039 --> 00:18:26.640 window buffer design 00:18:26.640 --> 00:18:28.640 where QGraphicsScene is similar to 00:18:28.640 --> 00:18:29.840 buffers in Emacs, 00:18:29.840 --> 00:18:31.840 it controls the state and the content 00:18:31.840 --> 00:18:34.240 details of the application 00:18:34.240 --> 00:18:41.200 where QGraphicsView is similar to Emacs 00:18:41.200 --> 00:18:43.200 window. It populates the buffer 00:18:43.200 --> 00:18:45.919 (QGraphicsScene) to the foreground at 00:18:45.919 --> 00:18:46.960 the appropriate 00:18:46.960 --> 00:18:48.573 position. 00:18:48.573 --> 00:18:50.320 Whenever an EAF mode buffer 00:18:50.320 --> 00:18:57.679 brings to a background…. 00:18:57.679 --> 00:18:59.679 Whenever an EAF mode buffer brings to the 00:18:59.679 --> 00:19:00.880 foreground, sorry, 00:19:00.880 --> 00:19:02.559 a QGraphicsView instance is 00:19:02.559 --> 00:19:05.120 created, and whenever the buffer goes to 00:19:05.120 --> 00:19:06.080 the background 00:19:06.080 --> 00:19:08.000 the QGraphicsView instance is then 00:19:08.000 --> 00:19:09.120 deleted, 00:19:09.120 --> 00:19:10.960 while QGraphicsScene — the actual 00:19:10.960 --> 00:19:12.480 process — remains running in the 00:19:12.480 --> 00:19:14.480 background until the EAF mode buffer is 00:19:14.480 --> 00:19:16.000 killed. 00:19:16.000 --> 00:19:18.320 GPU compositing is used to ensure that 00:19:18.320 --> 00:19:19.440 QGraphicsView and 00:19:19.440 --> 00:19:21.840 QGraphicsScene is synchronized real time. 00:19:21.840 --> 00:19:24.000 Using QWindow::setParent function 00:19:24.000 --> 00:19:25.679 the QGraphicsView is attached to the 00:19:25.679 --> 00:19:27.840 appropriate location on the Emacs frame, 00:19:27.840 --> 00:19:30.640 so that although GUI applications are 00:19:30.640 --> 00:19:32.400 not running within Emacs, 00:19:32.400 --> 00:19:36.160 they look as if they were. 00:19:36.160 --> 00:19:39.039 When user types on the keyboard it is 00:19:39.039 --> 00:19:41.039 first received by the Emacs 00:19:41.039 --> 00:19:43.520 EAF mode buffer, and then Elisp sends 00:19:43.520 --> 00:19:45.360 the event to QGraphicsScene using 00:19:45.360 --> 00:19:46.240 D-Bus. 00:19:46.240 --> 00:19:48.720 When user clicks on the GUI application 00:19:48.720 --> 00:19:50.799 it is received by the QGraphicsView 00:19:50.799 --> 00:19:53.280 and processed in Python. Elisp can 00:19:53.280 --> 00:19:55.200 communicate with Python through D-Bus, 00:19:55.200 --> 00:19:59.200 in other words you can 00:19:59.200 --> 00:20:01.360 customize and extend Emacs not just 00:20:01.360 --> 00:20:01.760 using 00:20:01.760 --> 00:20:04.480 Elisp, and now you can use Python, this way 00:20:04.480 --> 00:20:05.360 one can leverage 00:20:05.360 --> 00:20:07.039 all the Python properties like 00:20:07.039 --> 00:20:09.600 multi-threading or some other stuff, 00:20:09.600 --> 00:20:11.679 the entire Python ecosystem can be 00:20:11.679 --> 00:20:13.520 utilized as well, 00:20:13.520 --> 00:20:16.159 such as the Qt web engine that is the 00:20:16.159 --> 00:20:16.960 basis for 00:20:16.960 --> 00:20:20.640 our EAF Browser, and PyMuPDF is the 00:20:20.640 --> 00:20:23.360 basis for the EAF PDF Viewer. 00:20:23.360 --> 00:20:25.840 This really opens the window to many 00:20:25.840 --> 00:20:28.240 many new possibilities to extend Emacs 00:20:28.240 --> 00:20:32.720 using EAF. 00:20:32.720 --> 00:20:36.080 All right, back here. We are always 00:20:36.080 --> 00:20:37.760 looking for people to join the 00:20:37.760 --> 00:20:39.679 development, there are many many 00:20:39.679 --> 00:20:42.720 more work that needs to be done, 00:20:42.720 --> 00:20:44.640 such as testing and debug EAF on 00:20:44.640 --> 00:20:46.640 more Linux distros and window managers 00:20:46.640 --> 00:20:47.760 such as i3 00:20:47.760 --> 00:20:51.200 and stuff, you can also add new EAF 00:20:51.200 --> 00:20:52.080 applications, 00:20:52.080 --> 00:20:54.240 or debug and enhance existing EAF 00:20:54.240 --> 00:20:55.440 applications, 00:20:55.440 --> 00:20:58.000 or you can port EAF to native Wayland 00:20:58.000 --> 00:21:00.240 which I just discussed with 00:21:00.240 --> 00:21:03.840 the emacs-webkit author 00:21:03.840 --> 00:21:07.919 Akira Kyle, and he told me that 00:21:07.919 --> 00:21:11.200 EAF doesn't really work on 00:21:11.200 --> 00:21:14.320 native Wayland, because it uses 00:21:14.320 --> 00:21:16.799 XWayland, so it doesn't work on the pgtk 00:21:16.799 --> 00:21:18.159 port of Emacs. 00:21:18.159 --> 00:21:20.559 And we also need people to port EAF to 00:21:20.559 --> 00:21:22.080 non-free operating systems 00:21:22.080 --> 00:21:25.600 including Windows and macOS, 00:21:25.600 --> 00:21:28.480 and that's because, like, D-Bus is a Linux 00:21:28.480 --> 00:21:30.080 specific feature, so it doesn't really 00:21:30.080 --> 00:21:31.360 work on other platform. 00:21:31.360 --> 00:21:33.039 We need to check, replace it with some 00:21:33.039 --> 00:21:34.640 alternative, and 00:21:34.640 --> 00:21:36.720 QGraphicsScene somehow doesn't really 00:21:36.720 --> 00:21:38.640 work on macOS, 00:21:38.640 --> 00:21:40.320 and there are many other to-do lists 00:21:40.320 --> 00:21:42.880 available, so please have a look 00:21:42.880 --> 00:21:45.039 and see if there is anything you want to 00:21:45.039 --> 00:21:46.640 work on. 00:21:46.640 --> 00:21:49.039 All right. So, since this is a 00:21:49.039 --> 00:21:51.120 pre-recorded talk I won't be able to do 00:21:51.120 --> 00:21:53.520 the Q & A real time in the video. 00:21:53.520 --> 00:21:56.080 However, I will be around on the 00:21:56.080 --> 00:21:57.200 collaborative pad 00:21:57.200 --> 00:22:00.239 and the IRC #emacsconf, 00:22:00.239 --> 00:22:01.360 #emacsconf-questions 00:22:01.360 --> 00:22:04.139 to answer any questions when it pops up, 00:22:04.139 --> 00:22:05.760 and you can also submit an issue 00:22:05.760 --> 00:22:09.120 on the repo, and you can check the wiki 00:22:09.120 --> 00:22:12.640 for some other guides and tricks. 00:22:12.640 --> 00:22:15.039 All right. Thank you guys, and hopefully 00:22:15.039 --> 00:22:16.000 you find 00:22:16.000 --> 00:22:18.320 this EAF project very interesting, and 00:22:18.320 --> 00:22:24.320 enjoy the rest of EmacsConf 2020.