Web Browser in Emacs

There is a built in emacs web browser (eww) but it’s text-based. There are a few options for getting an actual browser in emacs.

Setting up eaf using straight

The EAF (emacs-application-framework) package integrates a number of apps into emacs. The browser is a full webkit browser that is overlayed onto a buffer.

It works but it’s really janky. If you move the emacs window around the browser window might not move. It doesn’t work in fullscreen.

Installing using straight.el and use-package:

(use-package eaf :straight (eaf :type git :host github :repo “emacs-eaf/emacs-application-framework” :files (”.el” “.py” “core” “app” “*.json”) :includes (eaf-browser) ; Straight won’t try to search for these packages when we make further use-package invocations for them :pre-build ((“python3” “install-eaf.py” “–install” “browser” “–ignore-sys-deps”) (“npm” “i” “-g” “mac-app-frontmost”))))

(use-package eaf-browser :custom (eaf-browser-continue-where-left-off t) (eaf-browser-enable-adblocker t))

Using xwidget-webkit

You can compile emacs to include xwidget and use xwidget-webkit-browse-url.

I found this to be significantly better than EAF. It works with buffers the way you expect. You can even get to the console by right clicking and selecting ‘Inspect element’.

The railwaycat homebrew formula for emacs is the best way to get xwidget support on a Mac.

brew install emacs-mac --with-natural-title-bar --with-native-comp --with-xwidgets

So far the only downside I can find is that you can’t open more than one browser and it crashes somewhat regularly.