Emacs Application Framework is a development framework, where developers can develop any PyQt program, and integrate it into Emacs.
This framework mainly implements three functions:
- Integrate PyQt program window into Emacs Frame using Xlib Reparent technology
- Listening to EAF buffer's keyboard event flow and controlling the keyboard input of PyQt program via DBus IPC
- Created a window compositer to make the PyQt program window adapt Emacs's Window/Buffer design
Using this framework, you can use PyQt to develop powerful GUI programs to extend Emacs.
Browser | Markdown Previewer |
---|---|
Image Viewer | Video Player |
---|---|
PDF Viewer | Camera |
---|---|
File Sender | File Receiver |
---|---|
Air Share | Org Previewer |
---|---|
Terminal Emulator |
---|
- Install python dependences:
sudo pip3 install dbus-python pymupdf grip qrcode python-xlib pyqt5 pyqtwebengine
sudo pacman -S qtermwidget-git
- Clone this repository and add below code in your ~/.emacs
(require 'eaf)
Debian Package | Package Repo | Use for |
---|---|---|
dbus-python | pip3 | DBus IPC for python and elisp |
pymupdf | pip3 | Render engine required for PDF Viewer |
grip | pip3 | Markdown render server for Markdown Previewer |
qrcode | pip3 | Render local file QR code |
python-xlib | pip3 | Stick app window into emacs frame |
pyqt5 | pip3 | GUI library required for application development |
pyqtwebengine | pip3 | QtWebEngine for browser application |
qtermwidget-git | pacman | QTermWidget is terminal emulator for PyQt5 |
If you prefer to run linux in a docker, you can read Run EAF with docker
There are mainly three obstacles:
- I can't make dbus/python-dbus works on MacOS High Sierra
- This framework need use X11 reparent to stick Qt5 window to emacs frame, but i don't know how to make X11 works on MacOS.
- Qt5 QGraphicsView/QGraphicsScene can't work MacOS, specify QGraphicsVideoItem can't work.
Application Name | Launch |
---|---|
Browser | Type 'eaf-browser' RET https://www.google.com |
PDF Viewer | Type 'eaf-open' RET pdf filepath |
Video Player | Type 'eaf-open' RET video filepath |
Image Viewer | Type 'eaf-open' RET image filepath |
Markdown previewer | Type 'eaf-open' RET markdown filepath |
Org file previewer | Type 'eaf-open' RET org filepath |
Camera | Type 'eaf-open-camera' |
Terminal | Type 'eaf-open-terminal' |
File Sender | Type 'eaf-file-sender-qrcode' |
Or use 'eaf-file-sender-qrcode-in-dired' | |
File Receiver | Type 'eaf-file-receiver-qrcode' |
Airshare | Type 'eaf-file-transfer-airshare' |
Demo | Type 'eaf-open-demo' |
Please check Key binding to check keybinding of application.
NOTE:
EAF use DBus' session bus, it must running in general user.
Please don't run EAF with root user, root user just can access DBus's system bus.
You can easily configure variables that EAF Python side uses with the Emacs Lisp function eaf-setq
. Check the full list of configurable variables with C-h v eaf-var-list
.
The default directory to store images taken by EAF Camera is ~/Downloads
. To change it, put the following in .emacs
(eaf-setq 'eaf-camera-save-path "~/Downloads")
If you can't access most awesome internet services like me, you perhaps need proxy settings like below:
(setq eaf-http-proxy-host "127.0.0.1")
(setq eaf-http-proxy-port "1080")
Then EAF browser is free! ;)
If you use markdown previewer, you need access to a Personal access token, fill something in "Token description" and click button "Generate token" to get your personal token, then set token with code:
(setq eaf-grip-token "yourtokencode")
Otherwise, github will popup "times limit" error because so many people use grip. ;)
EAF use X11 XReparent technology to stick Qt5 window on Emacs buffer area, Wayland not support XReparent.
I recommend you use KDE, it's stable enough and support X11 XReparent technology.
If you got "undefined symbol" error after start EAF, and you use Arch Linux, yes, it's a bug of Arch.
You need use pip install all dependences after you upgrade your Arch system, then undefine symbol error will fix.
If you have any problem with EAF, please use command "emacs -Q" to start Emacs without any customizations.
Then re-test your workflow. If "emacs -Q" works fine, it's must be something wrong with your emacs config file.
If the problem persists, please report bug here.
Do you want to make Emacs a real operating system?
Do you want to live in emacs more comfortably?
Want to create unparalleled plugins to extend emacs?
如果我的作品让你的生活充满快乐, 欢迎请我喝瓶啤酒, 哈哈哈哈