Mutt: Abook support.

Scripts: csv2abook (Google Contacts to Abook)
Homeinit: abook contacts.
master
Pierre Neidhardt 2013-04-30 14:17:22 +02:00
parent e18ded2468
commit 53e015ff77
5 changed files with 73 additions and 6 deletions

View File

@ -3,8 +3,8 @@
(setq mc/cmds-to-run-for-all
'(
c-electric-colon
c-electric-delete-forward
yas-expand
))
(setq mc/cmds-to-run-once

14
.muttrc
View File

@ -121,10 +121,16 @@ macro pager b '<enter-command>toggle sidebar_visible<enter><redraw-screen>'
## Aliases
##------------------------------------------------------------------------------
set alias_file = "~/.mutt/aliases"
set sort_alias = alias
set reverse_alias = yes
source $alias_file
## Mutt native support
# set alias_file = "~/.mutt/aliases"
# set sort_alias = alias
# set reverse_alias = yes
# source $alias_file
## Abook
set query_command= "abook --mutt-query '%s'"
macro index,pager a "<pipe-message>abook --add-email-quiet<return>" "Add this sender to Abook"
bind editor <Tab> complete-query
##------------------------------------------------------------------------------
## Keys

56
.scripts/csv2abook.awk Normal file
View File

@ -0,0 +1,56 @@
## Google Contacts CSV to Abook.
## WARNING: this script will NOT work for entries that have a comma between double quotes.
BEGIN {
FS=","
ind=1
}
## Some fields are surrounded by unwanted double quotes.
function remove_quotes(s)
{
gsub(/^"+|"+$/, "", s)
return s
}
function capitalize(s)
{
result = ""
while(match(s,/[ -]/))
{
word = substr(s,1,RSTART-1)
result = result toupper(substr(word,1,1)) tolower(substr(word,2))
if(index(s,"-"))
result = result "-"
else
result = result " "
s = substr(s,RSTART+1)
}
result = result toupper(substr(s,1,1)) tolower(substr(s,2))
return result
}
## Let's skip the first line which is supposed to contain the CSV header.
FNR==1 {
next
}
{
print "[" ind "]"
print "name=" capitalize(remove_quotes($2)) " " capitalize(remove_quotes($4))
printf "email=" tolower(remove_quotes($29))
if ($31 != "")
printf "," remove_quotes($31)
if ($33 != "")
printf "," remove_quotes($33)
printf "\n"
print "birthday=" remove_quotes($15)
print "mobile=" remove_quotes($35)
print "phone=" remove_quotes($37)
print "address=" remove_quotes($39)
print ""
ind++
}

View File

@ -10,13 +10,17 @@ SOURCEDIR="${HOME}/personal/dataperso"
## Emacsclient launcher. Required for best emacsclient integration. For a fully
## functional daemon, you should write a file like this and set 'EDITOR=em'.
if [ -f /bin/em ]; then
if [ ! -f /bin/em ]; then
echo "==> Emacs (press Ctrl-D to skip)"
sudo sh -c "echo '#!/bin/sh
emacsclient -a \"\" -t \"\$@\"' > '/bin/em'; chmod 755 /bin/em"
echo
fi
echo "==> Abook"
ln -snf "$(realpath ${SOURCEDIR}/contacts)" "${HOME}/.abook"
echo
echo "==> Mutt"
ln -snf "$(realpath ${SOURCEDIR}/mails)" "${HOME}/.mutt"
mkdir -p "${HOME}/.mutt.d/hcache"

1
README
View File

@ -230,6 +230,7 @@ Noteworthy apps
***************
aalib
abook
aircrack-ng
antiword
apvlv