pinoaffe / org-vcard

Export and import vCards from within GNU Emacs' Org mode.
61 stars 7 forks source link

Missing high-level functions #23

Open DamienCassou opened 8 years ago

DamienCassou commented 8 years ago

I want to facilitate navigation and modification of vdir repositories. I though org-vcard could help me. But I miss some high-level functions such as org-vcard-fullname which would return the fullname of a contact (as returned by vcard-org-import-parse).

flexibeast commented 8 years ago

Firstly, sorry for the long delay in replying! i've had personal matters i've needed to attend to.

org-vcard is designed to be a library for transferring data between vCards and Org specifically; it's not intended as a general vCard-parsing library. Also, i'd rather not provide a distinct function for every possible vCard property (e.g. org-vcard-landline-home-number org-vcard-landline-work-number, org-vcard-mobile1-work-number, org-vcard-mobile2-work-number, etc.). i might be open to a more generic function (e.g. org-vcard-get-property-value, which would take a vCard property as one of its argument), but i'd want a non-theoretical example of how such a function would be used for working with the data in Org-mode format. So i'm wondering if your interface to vdir repos is Org-based?

Having said that, org-vcard could, of course, certainly be refactored into two libraries: a general vCard-parsing library, and an Org-specific library built on top of that. However, my initial thought is that there would be quite some work involved in that, and i'm not sure the net work involved would be less than you simply writing your own functions that work with the data structure returned by org-vcard-import-parse. Alternatively, if you were to do such a refactoring yourself and submit it as a PR, i'd strongly consider merging it. :-)

DamienCassou commented 8 years ago

I want my library to facilitate editing files in vdir repositories. org-vcard seems very useful here. But I also need to present contact lists to the user so the user can select the contact he wants to edit. I need a vcard parser as well. Look at the code I wrote at https://github.com/DamienCassou/vdirel.

I already implemented an equivalent to what you call org-vcard-get-property-value under the name vdirel--contact-property: look at https://github.com/DamienCassou/vdirel/blob/master/vdirel.el#L63 and the following functions. Some would better be in org-vcard than in vdirel. This code is tested in https://github.com/DamienCassou/vdirel/blob/master/test/vdirel-test.el#L31.

flexibeast commented 8 years ago

Okay, the more i think about this, the more i'd like to split up org-vcard into the two separate libraries i described above, with the functionality you're after going into the vCard-parsing library. However, i'm not likely to be able to start working on that for at least the next couple of weeks ....

DamienCassou commented 8 years ago

I also have too much on my plate. So, I will keep using org-vcard as it is and write my own high-level functions.

flexibeast commented 8 years ago

Thanks. :-) i'll thus leave this issue open for now.

flexibeast commented 6 years ago

An update: i've started working on a vcard-parser library for org-vcard to use. For more details, see this comment.