mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
Add new emacs-gui-server and emacs-gui-client commands
The idea behind these commands is to easily launch a Emacs server which runs in the background, but with font/theme/etc settings as if it was launched like a normal GUI. I used to just launch Emacs.app directly, but, now I use these binaries to open a full GUI frame by executing `emacs-gui-client -c &`. After starting the GUI server with `emacs-gui-server start` of course. The main difference between calling `emacs --daemon` and `emacs-gui-server start` is that the latter uses a custom socket as to not interfere with any console-base Emacs server, and it also sets the `EMACS_GUI_SERVER` environment variable to `1`, letting my Emacs config figure out which theme/fonts/etc to load.
This commit is contained in:
15
bin/emacs-gui-client
Executable file
15
bin/emacs-gui-client
Executable file
@@ -0,0 +1,15 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Defaults
|
||||
SOCKET_DIR="$TMPDIR/emacs-gui-server$(id -u)"
|
||||
SOCKET_FILE="$SOCKET_DIR/server"
|
||||
EMACSCLIENT="emacsclient"
|
||||
ALTERNATE_EDITOR="nano"
|
||||
|
||||
# Set to binary bundled in Emacs.app if it exists
|
||||
if [ -f "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" ]; then
|
||||
EMACSCLIENT="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient"
|
||||
fi
|
||||
|
||||
# Execute emacsclient
|
||||
exec $EMACSCLIENT -s "$SOCKET_FILE" --alternate-editor=$ALTERNATE_EDITOR "$@"
|
||||
Reference in New Issue
Block a user