19 lines
439 B
Plaintext
19 lines
439 B
Plaintext
|
# -*- mode: shell-script; -*-
|
||
|
|
||
|
# Export variable to Emacs.
|
||
|
function export-emacs
|
||
|
{
|
||
|
if [[ ARGC -eq 0 ]]; then
|
||
|
print -u 2 "Usage: ${0} <variable> …"
|
||
|
return 1
|
||
|
fi
|
||
|
|
||
|
# Fail if we can't communicate with the daemon
|
||
|
[[ "$(emacsclient -e t)" == 't' ]] || return 1
|
||
|
|
||
|
for name in "${@}"; do
|
||
|
value=$(eval print \"\$${name}\")
|
||
|
emacsclient -e "(setenv \"${name}\" \"${value}\")" >/dev/null
|
||
|
done
|
||
|
}
|