It’s every Emacs user’s dream: to use Emacs for writing any text anywhere, especially in places where you normally couldn’t, like text fields in your browser, the Discord chat box, or the Discourse editor—just about anywhere you can think of. Now, it is possible. Here are your options:
Emacs everywhere
Works on Linux and macOS.
This is an Emacs package which adds the autoloaded emacs-everywhere
function, which can be called via emacsclient
to spawn an Emacs frame to edit text in.
(This is included in Doom’s :app everywhere
module)
Dependencies
- Linux
- xclip
- xdotool
- xwininfo
- xprop
- macOS
- None!
Install
Simply enable Doom’s :app everywhere
module and bind a system keyboard shortcut to the following shell command:
emacsclient --eval "(emacs-everywhere)"
Done.
A daemon isn’t strictly needed (as Doom will start a server when starting Emacs), but you are free to set it up.
Configuration
-
When pandoc is installed,
org-mode
will be used by default. If you want to useorg-mode
to edit markdown without installing pandoc, you can set the initial major-mode with:(setq emacs-everywhere-major-mode-function #'org-mode)
-
Some users may try to set up rules for the emacs-everywhere window using their window manager (e.g. bspwm), but are unable to target it because of the complex title of the frame. You can change this with:
(setq emacs-everywhere-frame-name-format "emacs-everywhere")
In your browser
Works on any platform.
-
Install the alpha22jp/atomic-chrome package with the following in your config:
;;; add to $DOOMDIR/packages.el (package! atomic-chrome) ;;; add to $DOOMDIR/config.el (atomic-chrome-start-server)
If you want to be especially mindful of startup time, you can defer starting the server until the first time you un-focus Emacs (presumably to focus your browser):
-(atomic-chrome-start-server) +(add-transient-hook! 'focus-out-hook (atomic-chrome-start-server))
-
Run
$ doom sync
and restart Emacs. -
Install one of the supported browser extensions:
And you’re done! Click an the extension’s icon in your browser toolbar to edit the focused text area in Emacs.