17 lines
406 B
Bash
Executable File
17 lines
406 B
Bash
Executable File
#!/usr/bin/env zsh
|
|
# Export variable to Emacs.
|
|
|
|
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
|
|
|
|
autoload -U die
|
|
|
|
[[ ARGC -eq 0 ]] && die 1 "Usage: ${0} <variable> …"
|
|
|
|
# Fail if we can't communicate with the daemon
|
|
[[ "$(emacsclient -e t)" == 't' ]] || return 1
|
|
|
|
for name in "${@}"; do
|
|
local value=$(eval print \"\$${name}\")
|
|
emacsclient -e "(setenv \"${name}\" \"${value}\")" >/dev/null
|
|
done
|