6 ms·
Ask HN: How to tune Emacs config for portability: Linux, macOS and Windows?
I've been a GNU/Linux-only Emacs user for years, and most of my configuration has naturally evolved around that environment.
Now I may need to start using macOS and Windows as well, and I'm realizing that "Emacs is cross-platform" and "my Emacs configuration is cross-platform" are two rather different things.
I'm curious how people who maintain a substantial Emacs configuration approach this.
My config is fairly modular and tries to stay close to vanilla Emacs where possible, using things like Elpaca, Corfu, Vertico, Eglot, etc. The Linux setup is fast and works exactly the way I want, but I don't want to end up with a giant collection of OS-specific conditionals every time I move between machines.
This is my config by the way: https://codeberg.org/jjba23/heks-emacs
Some things I'm particularly wondering about:
- How do you handle filesystem paths and environment variables cleanly?
- Do you abstract OS-specific functionality, or simply use `system-type` / `executable-find` where necessary?
- How much do you rely on external Unix tools that aren't naturally available on Windows?
- What's the best strategy for subprocesses and shell integration?
- How do you handle fonts, GUI differences, clipboard behavior, notifications, and native window-system quirks?
- Are there packages that you deliberately avoid because they make portability painful?
- Do you maintain one config everywhere, or have a small portable core with platform-specific modules?
- For Windows specifically, do you target native Emacs, WSL, MSYS2, or something else?
- For macOS, are there particular pitfalls around GUI Emacs, Homebrew, PATH handling, or system services?
I'm especially interested in lessons from people who have been maintaining the same Emacs configuration across multiple operating systems for years.
What abstractions or conventions ended up being worth it? What things did you initially think would be portable but turned out to be surprisingly OS-specific?
I'd also be interested in seeing examples of configuration architecture that make this manageable.
The goal isn't necessarily "make every feature work identically everywhere." I'd rather have a portable core with sensible degradation than turn the config into an enormous pile of conditionals.
What does a battle-tested cross-platform Emacs setup look like?
- juxtapose 2mo agoIMHO you are worrying too much. As long as you stick to Emacs Lisp API and battle-tested libraries, the portability issue should be minimal. I've skimmed your config, and I think it can probably work out of the box on the other platforms. You would still need to configure the external environment, (e.g. installing MSYS2 on Windows,) and address platform-specific issues, (e.g. you need exec-path-from-shell on macOS, and/or adjust default coding systems on Windows). Generally, these problems are easy to solve.
- jjba23 2mo agoThanks for the comment