Emacs in Emacs: A triumph for EXWM

Table of Contents

Previously I’ve talked about the inability to refer to my code screens from within exwm if I’m on a video call in my browser; it shows the option fo other browser windows, and the option of the whole screen, but not an emacs buffer. The solution is simple and beautifully recursive: run emacs within your exwm emacs.

Do what?

Run emacs within your main exwm emacs session. M-S & emacs. Then, when your emacs starts, immediately press S-k to switch into exwm’s char-mode so that keystrokes go through directly, so I’ll never accidentally have my parent emacs keys used by the sub-emacs.

How it works

It’s this last part – using charmode the same way I use it to enable tab-killing in my browser – that I hadn’t thought of. And, when all is said and done, execute M-x kill-emacs and you’ll go back to your parent.

The reason that emacs windows don’t show up in my list of screens to share in my browser is that exwm considers its emacs process a super-process while any other exwm-hosted app, my browser or gimp or whatever, will be a sub-process that can be found in the browser list.

Other Uses

Whenever you are expecting to operate in ways that endanger your emacs thread-life you can use this emacs-in-emacs method. Overall, this is a very lisp-like recursive solution that exwm makes possible!

  • Changing emacs configuration or init.el stuff
  • Tramping around or taking other known operations that tend to threaten you with freezing

Resources

Tory Anderson avatar
Tory Anderson
Web App Engineer, Digital Humanist, Researcher, Computer Psychologist