-
-
Save kunalb/3cb853bc4af2eb4a3cf370356f2f97ad to your computer and use it in GitHub Desktop.
Wrapper scripts & functions to launch emacs with a custom directory
This file contains hidden or 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
| #!/bin/bash | |
| INIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aiemacs" | |
| SOCKET_DIR="${XDG_RUNTIME_DIR:-/tmp}/emacs-aiemacs" | |
| EMACS_SOCKET_NAME="$SOCKET_DIR/server" | |
| export EMACS_SOCKET_NAME | |
| # Ensure socket directory exists with secure permissions | |
| mkdir -p "$SOCKET_DIR" && chmod 700 "$SOCKET_DIR" | |
| # Ensure init directory has secure permissions | |
| chmod 700 "$INIT_DIR" 2>/dev/null | |
| # Start server if not running | |
| if ! emacsclient -s "$EMACS_SOCKET_NAME" -e nil &>/dev/null; then | |
| emacs --init-directory="$INIT_DIR" --daemon="$EMACS_SOCKET_NAME" | |
| fi | |
| exec emacsclient -t -s "$EMACS_SOCKET_NAME" "$@" |
This file contains hidden or 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
| function aen { | |
| emacs -nw --init-directory=$XDG_CONFIG_HOME/aiemacs "$@" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment