Created
July 19, 2023 14:22
-
-
Save cdegroot/04b75c5fac2f9bcd886d26402139df9c to your computer and use it in GitHub Desktop.
StumpWM + spatial groups + Emacs-per-group-z-index = bliss.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; | |
;;; We run a server per z-index. | |
;;; | |
(defparameter *xdg-runtime-dir* (getenv "XDG_RUNTIME_DIR")) | |
(defparameter *emacs-socket-dir* (concatenate 'string *xdg-runtime-dir* "/emacs/")) | |
(defun cur-z () | |
(third (split-string (group-name (current-group)) ","))) | |
(defun cur-socket () | |
(concatenate 'string *emacs-socket-dir* (cur-z))) | |
(defun maybe-start-emacs-server () | |
(unless (probe-file (cur-socket)) | |
(run-shell-command (concatenate 'string "emacs --bg-daemon=" (cur-z))) | |
(echo "Started Emacs server, sleeping a bit before starting client...") | |
(sleep 10) | |
(echo "Starting client"))) | |
(defcommand emacs () () | |
"Start Emacs client with a z-index specific server" | |
(maybe-start-emacs-server) | |
(run-shell-command (concatenate 'string "emacsclient -c -s " (cur-socket)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment