emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: contact management in emacs


From: Jean Louis
Subject: Re: contact management in emacs
Date: Mon, 8 Mar 2021 01:13:01 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Alan Schmitt <alan.schmitt@polytechnique.org> [2021-02-27 14:09]:
> Hello,
> 
> This may be slightly off-topic for the list, but as I’m considering
> org-contacts for my question, I hope it will be of interest here.
> 
> I would like to migrate my contact management to emacs, as I’m already
> using it for email. My requirements are the following ones:
> - address completion in emacs email clients (I currently use
> notmuch)

Your question I consider very important.

I am using heavily contact management with Emacs and PostgreSQL
database. Connection between Emacs and the database is provided by the
module `emacs-libpq`: https://github.com/anse1/emacs-libpq Currently I
manage over 220,000 contacts and more than 10,000 groups that I have
named "accounts" in the database, following the long term CRM
conventions.

Address completion is simple, I press the key and query for contacts,
insert name with email address nicely formatted.

> - support for multiple email addresses and custom fields

I have made for myself such a system that I may designate Cc: Bcc:
fields or tell that all email addresses of certain person will be
used. That header format is automatically created on the fly when
composing emails. Some email attachments are sent by using external
program `mutt` on the command line. And I am using multiple
identities. Contact may have single identity or may be under account
that has assigned identity or under multiple accounts with assigned
identities. 

> - creation of org links to contacts

As there is display of a contact or profile, and I keep also Org
profiles of a contact, thus I can also create simple link to the
contact. Link creation is also easy, query for contact, insert link. 

> - export to vcard format for synchronization to my mobile phone (using
> vdirsyncer)

I have made my own exporter to vcards, so all contacts are managed by
using PostgreSQL database through Emacs. By pressing `A` I am entering
the contact into the address book. Program is meant to have multiple
address books, for example private address book could be for device
nr. 1 and business address book for device nr. 2. This way all my
devices are synchronized from my central computer. No need for remote
insecure cloud databases.

> - keep the data under version control

Any editing may be under the database backed version control. For
example in this function here below:

(defun hlink-change-type ()
  (interactive)
  (let ((id (tabulated-list-get-id)))
    (when id
      (let ((new-type (hlink-types)))
        (when new-type
          ;; version control begins here
          (hyperscope-vc "hlinks" "hlinks_hlinktypes" id) 
          (rcd-db-update-entry "hlinks" "hlinks_hlinktypes" "integer" id 
new-type *hs*)
          (hyperscope-refresh id))))))

Simple function `hyperscope-vc` keeps care of the version control.

(defun hyperscope-vc (table column id &optional description)
  "Simple version system."
  (let* ((value (rcd-db-get-entry table column id *hs*))
         (value (format "%s" value))
         (value (sql-escape-string value))
         (description (if description (sql-escape-string description) "NULL"))
         (sql (format "INSERT into vc (vc_table, 
                                      vc_column, 
                                      vc_tableid, 
                                      vc_value, 
                                      vc_description) values ('%s', '%s', %s, 
%s, %s)
                         RETURNING vc_id"
                      table column id value description))
         (id (rcd-sql sql *hs*)))
    (if id id nil)))

Version control is thus not automatic, it has to be chosen by myself
which databases or which editing would be under version control. The
above function first obtains all values from the database and then
inserts them into the table `vc` in the database. I could then browse
the table and return back the values if I wish so. Once in the
function, I do not think about it any more.

> Do you manage your contacts in emacs? And if so, what tools or workflow
> do you recommend?

I am recommending that you start using PostgreSQL database. I can
guide you. My software is not so finished for public, but I can guide
you personally and you will get stable system that lasts for years.

First thing would be to setup the PostgreSQL module for Emacs from
sources. If you are able to do that, I can guide you to get the rest
of functionality.

Jean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]