dotfiles/.config/zsh/functions.zsh

30 lines
556 B
Bash
Raw Normal View History

2022-03-18 14:34:27 +01:00
#!/bin/zsh
# Various functions, to be sourced.
# Get backtrace from gdb.
function gdb_get_backtrace()
{
local exe=$1
local core=$2
gdb ${exe} \
--core ${core} \
--batch \
--quiet \
-ex "thread apply all bt full" \
-ex "quit"
}
# Export variable to Emacs.
function export-emacs
{
if [[ "$(emacsclient -e t)" != 't' ]]; then
return 1
fi
for name in "${@}"; do
value=$(eval echo \"\$${name}\")
emacsclient -e "(setenv \"${name}\" \"${value}\")" >/dev/null
done
}