mu4e sync and make EDITOR work again.

This commit is contained in:
Ivan Malison 2014-12-11 15:31:39 -08:00
parent 7cb2140686
commit c7c9fc6069
3 changed files with 32 additions and 1 deletions

3
dotfiles/lib/mu4e_sync.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env zsh
refresh_config
update_mail

View File

@ -77,7 +77,7 @@ function time_emacs {
}
# Make emacs the default editor.
export EDITOR='emacs_open'
export EDITOR="e() { zsh -c 'emacs_open '"'"$@"; return 0; }; e'
export VISUAL="$EDITOR"
# This is ugly as sin but I can't figure out how else to do it.
export GIT_EDITOR="zsh -c 'emacs_open '"'"$@"; return 0'

View File

@ -0,0 +1,28 @@
MAILDIR="$HOME/Mail"
DBUS_COOKIE="$HOME/.sauron-dbus"
function sauron_msg {
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
echo "DBUS session not found."
if test -e $DBUS_COOKIE; then
export DBUS_SESSION_BUS_ADDRESS="`cat $DBUS_COOKIE`"
else
echo "DBUS cookie not found, unable to send message"
fi
fi
if test -n "$DBUS_SESSION_BUS_ADDRESS"; then
dbus-send --session \
--dest="org.gnu.Emacs" \
--type=method_call \
"/org/gnu/Emacs/Sauron" \
"org.gnu.Emacs.Sauron.AddMsgEvent" \
string:"$1" uint32:3 string:"$2"
fi
}
function update_mail {
offlineimap
for f in `find "$MAILDIR/INBOX/" -mmin -5 -a -type f`; do
sauron_msg "Gmail" "$(mu view $f | grep -B 10 Date)"
done
}