mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 07:26:41 +00:00
chore(emacs): improve shell setup
This commit is contained in:
@@ -4,11 +4,23 @@
|
|||||||
EMACSCLIENT="emacsclient"
|
EMACSCLIENT="emacsclient"
|
||||||
ALTERNATE_EDITOR="nano"
|
ALTERNATE_EDITOR="nano"
|
||||||
|
|
||||||
|
if [ -d "/opt/emacs/bin" ] && [[ ":${PATH}:" != *":/opt/emacs/bin:"* ]]; then
|
||||||
|
export PATH="/opt/emacs/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
# Set to binary bundled in Emacs.app if it exists
|
# Set to binary bundled in Emacs.app if it exists
|
||||||
if [ -f "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" ]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
EMACSCLIENT="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient"
|
if [ -f "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" ]; then
|
||||||
|
EMACSCLIENT="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v toe &> /dev/null && toe | grep '24bit' &> /dev/null; then
|
||||||
|
FULL_COLOR_TERM="$(toe | grep '24bit' | head -n1 | awk '{ print $1 }')"
|
||||||
|
if [ -n "$FULL_COLOR_TERM" ]; then
|
||||||
|
export TERM="$FULL_COLOR_TERM"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Execute emacsclient
|
# Execute emacsclient
|
||||||
exec env TERM=screen-24bit \
|
exec $EMACSCLIENT --alternate-editor=$ALTERNATE_EDITOR "$@"
|
||||||
$EMACSCLIENT --alternate-editor=$ALTERNATE_EDITOR "$@"
|
|
||||||
|
|||||||
@@ -2,23 +2,18 @@
|
|||||||
# Emacs
|
# Emacs
|
||||||
#
|
#
|
||||||
|
|
||||||
# macOS systems
|
# Depends on EMACS and EMACSCLIENT environment variables set in ~/.zshenv
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
if [ -f "/Applications/Emacs.app/Contents/MacOS/Emacs" ]; then
|
|
||||||
export EMACS="/Applications/Emacs.app/Contents/MacOS/Emacs"
|
|
||||||
alias emacsgui="env TERM=screen-24bit $EMACS"
|
|
||||||
alias emacs="env TERM=screen-24bit $EMACS -nw"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" ]; then
|
# Enforce 24-bit color mode if available
|
||||||
alias emacsclient="env TERM=screen-24bit /Applications/Emacs.app/Contents/MacOS/bin/emacsclient"
|
if command-exists toe && toe | grep '24bit' &> /dev/null; then
|
||||||
fi
|
FULL_COLOR_TERM="$(toe | grep '24bit' | head -n1 | awk '{ print $1 }')"
|
||||||
fi
|
alias emacsgui="env TERM=$FULL_COLOR_TERM $EMACS"
|
||||||
|
alias emacs="env TERM=$FULL_COLOR_TERM $EMACS -nw"
|
||||||
# Linux systems
|
alias emacsclient="env TERM=$FULL_COLOR_TERM $EMACSCLIENT"
|
||||||
if [[ "$OSTYPE" == "linux"* ]]; then
|
else
|
||||||
alias emacs="env TERM=screen-24bit emacs -nw"
|
alias emacsgui="$EMACS"
|
||||||
alias emacsclient="env TERM=screen-24bit emacsclient"
|
alias emacs="$EMACS -nw"
|
||||||
|
alias emacsclient="$EMACSCLIENT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add doom-emacs' bin directory to path if it exists
|
# add doom-emacs' bin directory to path if it exists
|
||||||
|
|||||||
14
zshenv
14
zshenv
@@ -146,6 +146,20 @@ export KUBECONFIG="$HOME/.kube/config:.kube/config"
|
|||||||
# Use custom emacs install if available
|
# Use custom emacs install if available
|
||||||
path_prepend "/opt/emacs/bin"
|
path_prepend "/opt/emacs/bin"
|
||||||
|
|
||||||
|
# Set Emacs-related environment variables
|
||||||
|
export EMACS="emacs"
|
||||||
|
export EMACSCLIENT="emacsclient"
|
||||||
|
|
||||||
|
# On macOS we want to use the Emacs.app application bundle
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
if [ -f "/Applications/Emacs.app/Contents/MacOS/Emacs" ]; then
|
||||||
|
export EMACS="/Applications/Emacs.app/Contents/MacOS/Emacs"
|
||||||
|
fi
|
||||||
|
if [ -f "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" ]; then
|
||||||
|
export EMACSCLIENT="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Use custom tmux install if available
|
# Use custom tmux install if available
|
||||||
path_prepend "/opt/tmux/bin"
|
path_prepend "/opt/tmux/bin"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user