[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: contact management in org-mode?
From: |
Russell Adams |
Subject: |
Re: [Orgmode] Re: contact management in org-mode? |
Date: |
Fri, 20 Nov 2009 08:32:35 -0600 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Fri, Oct 30, 2009 at 10:26:07PM -0500, Russell Adams wrote:
> Looking into this some more, export is really easy. I can just use a
> dynamic block to store column view in whatever format I choose, and
> export then search & replace ',' for '|'. That is minimal effort!
>
> Sparse searches in column view, hierarchy organization, etc. I'm
> trying to find a problem here.
I've just converted all my contacts into an Org file, and will
document below how it is organized.
First is Contacts.org:
--------------------------------------------------------
#+COLUMNS: %20ITEM %15Company %10Title %WorkEmail %WorkPhone %WorkMobile
%WorkFax %10WorkStreet %WorkCity %WorkState %WorkPostal %HomeEmail %HomePhone
%HomeMobile %10HomeStreet %HomeCity %HomeState %HomePostal
* Contacts
** Adams, Russell
:PROPERTIES:
:Company: Adams Information Services LLC
:Title: Principal Consultant
:WorkEmail: address@hidden
:WorkPhone:
:WorkMobile:
:WorkFax:
:WorkStreet:
:WorkCity:
:WorkState:
:WorkPostal:
:HomeEmail:
:HomePhone:
:HomeMobile:
:HomeStreet:
:HomeCity:
:HomeState:
:HomePostal:
:END:
What a super guy!
--------------------------------------------------------
I could have multiple top level headings for organization. Making a
contact a subheading also lets me use C-c / (spare tree searchs) to
limit the list of contacts.
With the column view modeline, I can edit contacts in long format, or
change fields in column view.
Next I needed a way to lookup addresses for Mutt. Lbdb is very
effective, but given I don't use BBDB anymore I required an
alternative.
I still like lbdb's inmail filter, so I continue to use that. I wrote
a quick lbdb module to find contacts in Contacts.org.
~/.lbdb/lbdbrc:
--------------------------------------------------------
MODULES_PATH="/usr/lib/lbdb /home/rladams/.lbdb/modules"
METHODS="m_inmail m_gpg m_orgcontact"
--------------------------------------------------------
~/.lbdb/modules/m_orgcontact:
--------------------------------------------------------
#! /bin/sh
m_orgcontact_query()
{
/home/rladams/.lbdb/modules/orgcontact.pl $1
}
--------------------------------------------------------
~/.lbdb/modules/orgcontact.pl: (note the hardcoded Contacts.org file)
--------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
# Read org headers are records
$/="\n*";
open(MYFILE,"/home/rladams/doc/OrgFiles/Contacts.org");
my @rawcontacts = <MYFILE>;
close(MYFILE);
$/="\n";
foreach (@rawcontacts) {
if ( $_ =~ m/$ARGV[0]/i ){
my $name;
foreach (split("\n",$_)) {
# The first line is the name
unless (defined $name) {
$name = $_;
$name =~ s/^\s*\**\s*//;
$name =~ s/\s*$//;
}
if (m/^\s+:.*email.*:/i) {
my $email = $_;
$email =~ s/^\s+:\S+:\s+(\S+)/$1/g;
$email =~ s/\s*$//;
printf("%s\t%s\t((Org))\n", $email, $name);
}
}
}
}
--------------------------------------------------------
Given I still use lbdbq in Mutt for address lookups, now it returns
one row per email property using the name from the headline.
Next, to make data entry faster, I've defined a yasnippet which
contains all the properties in a tab list.
~/.emacs/snippets/text-mode/org-mode/contact:
--------------------------------------------------------
#contact : Add a contact w/ PROPERTY drawer
# --
** $1
:PROPERTIES:
:Company: $2
:Title: $3
:WorkEmail: $4
:WorkPhone: $5
:WorkMobile: $7
:WorkFax: $8
:WorkStreet: $9
:WorkCity: $10
:WorkState: $11
:WorkPostal: $12
:HomeEmail: $13
:HomePhone: $14
:HomeMobile: $15
:HomeStreet: $16
:HomeCity: $17
:HomeState: $18
:HomePostal: $19
:END:
$0
--------------------------------------------------------
This also helps keep the property list consistent.
I hope this helps someone else.
Thanks.
------------------------------------------------------------------
Russell Adams address@hidden
PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/
Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3