forked from colonelpanic/dotfiles
emacs cocoa stuff, set-path launch agent, as_user function.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
alias emacs="emacsclient -t"
|
||||
alias xemacs="\emacs --daemon > /dev/null 2&> /dev/null; emacsclient -c &"
|
||||
alias emacs="emacsclient -c -n"
|
||||
alias temacs="emacsclient -t"
|
||||
alias cemacs="emacsclient -c -n"
|
||||
alias tmux="tmux -2"
|
||||
alias reload_tmux_conf="tmux source-file .tmux.conf"
|
||||
alias tmux_cb_to_remote_cb='tmux saveb - | linux_nc_paste_to_remote_clipboard'
|
||||
|
@@ -4,7 +4,7 @@ elif infocmp xterm-256color >/dev/null 2>&1; then
|
||||
export TERM=xterm-256color
|
||||
fi
|
||||
# Make emacs the default editor.
|
||||
export EDITOR="emacsclient"
|
||||
export EDITOR="emacsclient -cn"
|
||||
export ALTERNATE_EDITOR=""
|
||||
export VISUAL="emacsclient"
|
||||
|
||||
|
@@ -265,3 +265,31 @@ EOF
|
||||
function dirty_talk() {
|
||||
while true; do talk_dirty_to_me | tee >(cat) | say; done
|
||||
}
|
||||
|
||||
function as_user {
|
||||
local user="$1"
|
||||
local user_pid=$(ps -axj | awk "/^$user / {print \$2;exit}")
|
||||
local command="sudo /bin/launchctl bsexec $user_pid sudo -u '$user' $2"
|
||||
echo "Running:"
|
||||
echo "$command"
|
||||
eval $command
|
||||
}
|
||||
|
||||
function as_current_user {
|
||||
as_user "$(whoami)" "$*"
|
||||
}
|
||||
|
||||
function reload_user_agent {
|
||||
as_current_user /bin/launchctl unload "$1"
|
||||
as_current_user /bin/launchctl load "$1"
|
||||
}
|
||||
|
||||
|
||||
function reload_root_agent {
|
||||
as_user 'root' "/bin/launchctl unload '$1'"
|
||||
as_user 'root' "/bin/launchctl load '$1'"
|
||||
}
|
||||
|
||||
function ec {
|
||||
emacsclient -n $1 > /dev/null
|
||||
}
|
||||
|
Reference in New Issue
Block a user