Back to the schedule
Previous: Perso-Arabic Input Methods And Making More Emacs Apps BIDI Aware
Next: Imaginary Programming

Emacs Application Framework: A 2021 Update

Matthew Zeng

Q&A: IRC or Etherpad
Duration: 9:15

If you have questions and the speaker has not indicated public contact information on this page, please feel free to e-mail us at emacsconf-submit@gnu.org and we'll forward your question to the speaker.

00:03 Introduction 00:38 EAF Overview 02:05 New logo 02:23 EAF Supports Windows, macOS, and many Linux distros 03:15 Multi-language scripting 03:56 VueJS extension 05:45 EAF core-app separation 07:09 Other notable updates Popweb

Description

Emacs Application Framework (EAF) is a customizable and extensible GUI application framework that extends Emacs graphical capabilities using PyQt5. There are many new but important updates since EmacsConf2020 last year, this talk will briefly go over them.

Feedback

Pad:

  • Q1: is there any additions that you have to add to emacs for using non-English/latin characters or does it work mostly out of the box? 
    • A: [Prot] :  I only set the default-input-method to "greek". Then switch to it with C- (toggle-input-method)
  • Q1: Any plans for supporting other languages? It'd be great to use EAF to offload processing to Common Lisp, for example.
    • A: You're able to use Python & JavaScrpt/Vue to extend on top of Elisp, it is so far enough (Python for Qt apps and JS for web apps). Currently I don't see a clear advantage of using Common Lisp as well, but there could definitely be a support in theory.
  • Q2: is there an eaf-app that's not a bootstrapping nightmare? (having Vue as a dependency, eg)
    • A: I don't fully understand what you mean by "bootstrapping nightmare", all these dependencies are system dependencies that you install like any other system dependency, it doesn't slow the Emacs startup nor the system startup. But if you're asking for an app suggestion with lightweight dependencies without JS or Vue dependencies, the popular EAF Browser and EAF PDF Viewer are cool app options.
  • Q3: Are there security implications to having a browser in emacs?
    • A [opalvaults]: With how Emacs deals with things like GPG/pass/etc. I feel like it's probably as secure as you make it?
    • A: [matthewzmd] the browser application is independent from emacs itself, you're using a browser in emacs, but the browser is not actually in emacs. The browser is QtWebEngine, a modified Chromium without Google stuff, it is as safe as a Chromium can be.
  • Q4: maybe i misunderstood, but is every eaf app essentially embedded QT?
    • A: yes, it's built upon qt-webengine
    • A: Yes, it uses PyQt5 and it's essentially painting the Qt frame on top of emacs, simulating a buffer. EPC is used for Elisp <-> Python <-> JS communication so that you can extend Emacs in various langauges
    • Q: I guess/hope this is using qtwebengine, not qtwebkit?
      • A: right, qtwebengine. If you wanna dig more into the internals of EAF, I suggest you to read this part of the Wiki (https://github.com/emacs-eaf/emacs-application-framework/wiki/Hacking) or my talk from last year (https://emacsconf.org/2020/talks/34/)
  • Q5: Can the EAF dependencies be made into dynamically loadable modules for Emacs, so there will be no need to rebuilt Emacs?
    • A: There is no need to rebuilt Emacs, they're simply dependencies that you can install using the system package managers (pacman, apt, etc), npm install and pip install

IRC nick: matthewzmd

  • Q1: Any plans for supporting other languages?  It'd be great to use EAF to offload processing to Common Lisp, for example.
    • A: You're able to use Python & JavaScrpt/Vue to extend on top of Elisp, it is so far enough (Python for Qt apps and JS for web apps). Currently I don't see a clear advantage of using Common Lisp as well, but there could definitely be a support in theory.
  • Q2: is there an eaf-app that's not a bootstrapping nightmare? (having Vue as a dependency, eg)
    • A: I don't fully understand what you mean by "bootstrapping nightmare", all these dependencies are system dependencies that you install like any other system dependency, it doesn't slow the Emacs startup nor the system startup. But if you're asking for an app suggestion with lightweight dependencies without JS or Vue dependencies, the popular EAF Browser and EAF PDF Viewer are cool app options.
  • Q3: Are there security implications to having a browser in emacs?
    • A [opalvaults]: With how Emacs deals with things like GPG/pass/etc. I feel like it's probably as secure as you make it?
    • A: [matthewzmd] the browser application is independent from emacs itself, you're using a browser in emacs, but the browser is not actually in emacs. The browser is QtWebEngine, a modified Chromium without Google stuff, it is as safe as a Chromium can be.
  • Q4: maybe i misunderstood, but is every eaf app essentially embedded QT?
    • A: yes, it's built upon qt-webengine 
    • A: Yes, it uses PyQt5 and it's essentially painting the Qt frame on top of emacs, simulating a buffer. EPC is used for Elisp <-> Python <-> JS communication so that you can extend Emacs in various langauges
  • Q5: Can the EAF dependencies be made into dynamically loadable modules for Emacs, so there will be no need to rebuilt Emacs?

    • A: There is no need to rebuilt Emacs, they're simply dependencies that you can install using the system package managers (pacman, apt, etc), npm install and pip install
  • One thing I never tried watching all this is viewing PDF files within emacs.

  • is there an eaf-app that's not a bootstrapping nightmare? I suppose having Vue as dependency makes that not so for a large number
  • This is pretty cool, from a security standpoint, I'm not sure I'd want a web browser in emacs all that much.
    • With how Emacs deals with things like GPG/pass/etc. I feel like it's probably as secure as you make it?
    • matthewzmd: TDT the browser application is independent from emacs itself, you're using a browser in emacs, but the browser is not actually in emacs
    • If it can be secured under something like firejail, that may be better, as long as there's some segmenting with any communication between the two. Then again, I generally run any browser in dedicated VMs.
  • ok now this is something i need
  • maybe i misunderstood, but is every eaf app essentially embedded QT?
    • matthewzmd: Yes, it uses PyQt5 and it's essentially painting the Qt frame on top of emacs, simulating a buffer. EPC is used for Elisp <-> Python <-> JS communication
    • I guess/hope this is using qtwebengine, not qtwebkit? ('cos qtwebkit is unmaintained and by now massively insecure)
    • matthewzmd: if you wanna dig more into the internals of EAF, I suggest you to read this part of the Wiki (https://github.com/emacs-eaf/emacs-application-framework/wiki/Hacking) or my talk from last year (https://emacsconf.org/2020/talks/34/)

Links and other notes:

Transcript

[00:00:03.040] Hi, my name is Matthew Zeng, aka MT or Mingde. I am one of the maintainers I was also here last year during EmacsConf2020 and did a 20 minute presentation as well as a small demo. A lot of things had changed since 2020, and that's why today I'm here to present: Emacs Application Framework, A 2021 Update.

[00:00:38.046] So we all know Emacs, and we definitely know that Emacs is not just a text editor, but a text-centric work environment, We all want that, right? Therefore the EAF project wants to solve this problem while also retaining the rich Emacs ecosystem and its customizability and extensibility. The solution is to outsource the hard part to Python and NodeJS by bridging Elisp with them so that Python and JavaScript can do the hard work and minimize the Elisp workload, Do note that Python and JavaScript already have a very mature ecosystem that provides a foundation to Python and JavaScript ecosystems, modern multimedia apps too. As we're on a tight schedule today, I can't go into every detail about how EAF achieves this. I did go through a lot of things during last year's presentation, to check out that presentation, Today we're focusing on what changed.

[00:02:05.726] Now the first change that you'll definitely notice This logo uses gearwheels to web and multimedia applications

[00:02:23.286] Since last year, EAF has replaced the DBus communication technology with the cross-platform EPC, This and some other changes enable EAF to support Windows, Windows 10 and Windows Subsystem for Linux, as well as all distros that support pacman, apt, dnf, pkg, zypper package installer commands, which includes Arch-based, Debian, or Ubuntu-based, Fedora, etc. However, do note that the maOS support works with some known issues. Have a look if you want to try out.

[00:03:15.360] Previously, EAF was able to make Elisp communicate with Python, as well as Python to communicate with JavaScript, meaning that Elisp can call Python functions and vice versa, and Python can call JavaScript functions and vice versa, but if you want Elisp to communicate with JavaScript, you have to go through Python, which is rather troublesome. Now, thanks to the EPC, Elisp can communicate with JavaScript directly using =eval_js= function and =eval_emacs_function= in Elisp and Python respectively. This greatly simplifies the code that will be needed to write a web app in EAF.

[00:03:56.959] Speaking of web applications, VueJS is a web framework that's been gaining a lot of popularity in recent years for its simplicity and functionality. In the past, you were only able to write simple JavaScript and HTML web apps for EAF. It was quite some work to create a full-featured web application. Now you can write new apps using EAF that work seamlessly with Emacs and Elisp. There are a few existing EAF apps written with Vue already to demonstrate the possibilities of Vue-based extensions in Emacs. The first one is the EAF File Manager, written by ManateeLazycat himself, as an alternative option to dired, as he found dired's performance to lag considerably when there are way too many files. It supports wdired and fd functionality, and let me demonstrate that to you. See? And this is the app. Go back here. Another one is the EAF RSS Reader, written by our Summer of Code 2021 student ShaoChenHeng. It is a fast RSS reader that uses the EAF browser for previews, and let me demo that to you as well. Pragmatic Emacs. And you can view every site in the EAF Browser.

[00:05:45.360] To ease the process of creating a new EAF application, we've separated the EAF core and its apps, so that EAF apps now have their individual repositories. You can find them under the emacs-eaf GitHub organization. Because of the number of EAF apps and their dependencies that vary from system to system, we've also introduced a new =M-x eaf-install-and-update= command which is a wrapper around the new install-eaf python script dedicated to installing, updating, and maintaining EAF apps and their dependencies for the end user. Now it is very easy to create a new EAF app. You just need to do it. You can just do it in your own repository, such as in GitHub, GitLab, or wherever. The first thing to do is to fork the eaf-demo or the eaf-vue-demo as a starting template, then update the dependencies.json file to list the new dependencies you introduced on various systems. Afterwards, once your app is finished, you simply need to submit a PR to the EAF core that modifies the applications.json list to include your new app. And that's it. Come try it out and write your own EAF extensions today!

[00:07:09.599] There are many other new updates. To list a few: we reached more than 60 contributors, hooray! And also, you can now use the familiar Control s and Control r isearch for real-time search, functioning very similar to the Emacs isearch, in the EAF Browser, PDF Viewer, and many other applications. Additionally, you can also create EAF PDF annotations either inline or as a pop-up, etc. etc. etc. Finally, let's talk about Popweb. Popweb is a very, very new project that started like exactly two weeks ago, that focuses particularly on the multimedia pop-up functionality in Emacs. Pop is considered to be a sister project and lightweight version of EAF. They both share a very similar design and some code, and they are maintained by the same people, which is me and ManateeLazycat. Here's a quick demo to see the responsiveness of its preview. Here we go. On the right, see... Oh, here we go. Yes. And these are the LaTeX preview. I can quickly show the next one. So this is the end of my presentation. Feel free to post questions on the collaborative pad, IRC, or directly send me an email. I'll be around all this, at all these places, and if you found any issue, please submit an issue to the EAF official issues, and don't forget to check out the wiki. Thank you and enjoy the rest of EmacsConf 2021. captions by sachac

Back to the schedule
Previous: Perso-Arabic Input Methods And Making More Emacs Apps BIDI Aware
Next: Imaginary Programming