Skip to content
ShaMaTeTuanZhang edited this page Jul 22, 2022 · 26 revisions

There are certain variables will be shared across Emacs Lisp and Python.

Check the full list of configurable variables with C-h v eaf-var-list

Find file

You can modify the Emacs file association way by the following code.

(defun adviser-find-file (orig-fn file &rest args)
  (let ((fn (if (commandp 'eaf-open) 'eaf-open orig-fn)))
    (pcase (file-name-extension file)
      ("pdf"  (apply fn file nil))
      ("epub" (apply fn file nil))
      (_      (apply orig-fn file args)))))
(advice-add #'find-file :around #'adviser-find-file)

Dark Mode

By default, a number of EAF apps will switch to dark mode if your current Emacs theme is dark. You can override the default by setting it to force, follow, or nil, which is unchanged.

(setq eaf-mindmap-dark-mode "follow") ; default option
(setq eaf-browser-dark-mode "force")
(setq eaf-terminal-dark-mode nil)
(setq eaf-pdf-dark-mode "ignore") ; see below

In EAF PDF Viewer, since you can interactively toggle inverted mode using i (default keybinding), it has an additional option to be more flexible:

When eaf-pdf-dark-mode is set to ignore, opening a PDF file for the first time will follow the current Emacs theme. Toggle inverted mode however you want, closing the buffer will record the final state of the dark mode. Next time the PDF file opens, it will restore the previous state. Therefore eaf-pdf-dark-mode will differ per file.

EAF Browser

Translate language

Default translate language is your system locale, you can customize your own language, example change translate language to ‘Spanish’ with below code:

(setq eaf-browser-translate-language "es")

Complete language code list, please visit https://gist.github.com/JT5D/a2fdfefa80124a06f5a9#file-gistfile1-txt-L231

Continue where you left off

Similar to Chromium’s Setting -> On start-up -> Continue where you left off. To enable, add following to the config:

(setq eaf-browser-continue-where-left-off t)

Then all active EAF Browser buffers will be noted down before Emacs is killed, and will be opened again when calling M-x eaf-browser-restore-buffers in a future Emacs session.

This will come very handy for folks who do all web browsing in EAF Browser instead of browsers outside of Emacs and have numerous tabs buffers opened all at once.

Make EAF the Default Browser in Emacs

You are welcomed to make EAF Browser your default browser within Emacs.

(setq browse-url-browser-function 'eaf-open-browser)
(defalias 'browse-web #'eaf-open-browser)

Enable Adblocker

(setq eaf-browser-enable-adblocker t)

You can always toggle adblocker using M-a (default keybinding).

Customize Download Path

Browser will download file under ~/Downloads, you can customize download path with below code:

(setq eaf-browser-download-path "other_path")

Customize Aria2 Proxy

Aria2 only support HTTP proxy, you can use below code set HTTP proxy for aria2c:

(setq eaf-browser-aria2-proxy-host "127.0.0.1")
(setq eaf-browser-aria2-proxy-port "9888")
sudo systemctl start privoxy

If local only have socks5 proxy, you perhaps need privoxy convert socks5 proxy to http proxy.

Disable Saving Browsing History

The browsing history is automatically saved, by default. It is helpful for users to find a previous opened page using M-x eaf-open-browser-with-history. You can turn that off by

(setq eaf-browser-remember-history nil)

Default Search Engine

You can search for any string using M-x eaf-open-browser, M-x eaf-open-browser-with-history or M-x eaf-search-it. The default search engine used by EAF Browser is Google, as specified in the eaf-browser-default-search-engine variable. You can change it by

(setq eaf-browser-default-search-engine "duckduckgo")

Default “Blank” Page

The default blank page is https://www.google.com, it is opened by (eaf-proxy-new_blank_page) by default.

You can configure it by

(setq eaf-browse-blank-page-url "https://duckduckgo.com")

Default Zoom

Default zoom of EAF Browser is 1.0, you can set the default zoom by

(setq eaf-webengine-default-zoom 1.25)

Disable JavaScript

For reasons, some people may prefer to disable JavaScript for the EAF Browser. The option has been provided.

(setq eaf-browser-enable-plugin nil)
(setq eaf-browser-enable-javascript nil)

We don’t recommend it, you will lose a lot of features that EAF Browser provided.

EAF Camera

The default directory to store images taken by EAF Camera is ~/Downloads. You can change it like this.

(setq eaf-camera-save-path "new/path/")

EAF Music

The default play order is list order, you can change play order with other value random and repeat

(setq eaf-music-play-order "random")