emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: contact management in emacs
Date: Mon, 8 Mar 2021 01:13:01 +0300	[thread overview]
Message-ID: <YEVP7aCAHvHMEhjz@protected.rcdrun.com> (raw)
In-Reply-To: <87lfb9bwff.fsf@m4x.org>

* 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

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

> - 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 ()
  (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_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.


  parent reply	other threads:[~2021-03-07 22:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-27 11:08 contact management in emacs Alan Schmitt
2021-02-27 11:31 ` Martin Steffen
2021-02-27 13:20   ` andrés ramírez
2021-02-27 14:40     ` Eric S Fraga
2021-02-27 15:12       ` andrés ramírez
2021-02-28 10:21         ` Eric S Fraga
2021-02-27 15:14       ` Martin Steffen
2021-02-27 17:00   ` Dr. Arne Babenhauserheide
2021-02-27 16:53 ` Bob Newell
2021-02-28  9:06 ` Russell Adams
2021-02-28 11:09   ` Alan Schmitt
2021-03-03 14:40   ` TRS-80
2021-03-07 22:57   ` Jean Louis
2021-03-08 20:06     ` John Kitchin
2021-03-10  8:32       ` Jean Louis
2021-03-07 22:13 ` Jean Louis [this message]
2021-03-08  7:49   ` Alan Schmitt
2021-03-08  8:12     ` Jose E. Marchesi
2021-03-10  8:32       ` Jean Louis
2022-09-09 16:11 ` Sébastien Rey-Coyrehourcq
2022-09-10  5:46   ` Ihor Radchenko
2022-10-09 10:40   ` SQLite for contacts and relations to Org - " Jean Louis
2022-10-09 15:21     ` Quiliro Ordóñez
2022-10-09 16:59       ` Jean Louis
2022-10-09 19:09         ` Quiliro Ordóñez
2022-10-10  6:12           ` Jean Louis
2022-10-10 22:29             ` Robert Weiner
2022-10-10 23:32               ` Jean Louis
2022-10-11  3:20                 ` Robert Weiner
2022-10-11  5:54     ` Sébastien Rey-Coyrehourcq
2022-10-11 19:59       ` Jean Louis
     [not found] <mailman.47.1614445226.20994.emacs-orgmode@gnu.org>
2021-02-27 20:52 ` dalanicolai
2021-03-07 22:51   ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEVP7aCAHvHMEhjz@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).