From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell Adams Subject: Re: Re: contact management in org-mode? Date: Fri, 20 Nov 2009 08:32:35 -0600 Message-ID: <20091120143235.GB3439@thinkpad.adamsinfoserv.com> References: <87iqerzvm2.fsf@gollum.intra.norang.ca> <20091025023410.GK2357@thinkpad.adamsinfoserv.com> <87pr86tywd.wl%ucecesf@ucl.ac.uk> <87zl7arynb.fsf@dynapse.com> <20091029173640.GM28398@thinkpad.adamsinfoserv.com> <7bef1f890910291300o2e063d58h9d620278a6472032@mail.gmail.com> <20091031031059.GF23167@thinkpad.adamsinfoserv.com> <20091031032607.GG23167@thinkpad.adamsinfoserv.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NBUXW-0005W9-0h for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 09:32:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NBUXU-0005VD-S1 for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 09:32:45 -0500 Received: from [199.232.76.173] (port=36382 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBUXU-0005V9-Lj for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 09:32:44 -0500 Received: from squirtle.drak.net ([72.52.144.201]:35326) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NBUXU-0007jG-57 for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 09:32:44 -0500 Received: from 206.180.154.148.adsl.hal-pc.org ([206.180.154.148] helo=localhost) by squirtle.drak.net with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1NBUXN-0003dV-1J for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 08:32:37 -0600 Content-Disposition: inline In-Reply-To: <20091031032607.GG23167@thinkpad.adamsinfoserv.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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: rladams@adamsinfoserv.com :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 = ; 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 RLAdams@AdamsInfoServ.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3