Closed gour closed 9 years ago
Here is output from debugger:
Debugger entered--Lisp error: (args-out-of-range " /addressbooks/atmarama/contacts/a6f91204-771c-4585-a047-20c06d7ac5bb.vcf" 24 75)
match-string(2 " /addressbooks/atmarama/contacts/a6f91204-771c-4585-a047-20c06d7ac5bb.vcf")
org-vcard-import-parse("buffer")
(let ((content "") (cards (org-vcard-import-parse source)) (import-buffer nil) (filename "") (heading "")) (if (not (member source (quote ("buffer" "file" "region")))) (error "Invalid source type")) (let ((flat-style-properties (or (cadr (assoc org-vcard-active-version (cadr ...))) (error "No mapping available for specified vCard version")))) (let ((--dolist-tail-- cards) card) (while --dolist-tail-- (setq card (car --dolist-tail--)) (if (assoc "VERSION" card) (setq org-vcard-active-version (cdr (assoc "VERSION" card))) (setq org-vcard-active-version org-vcard-default-version)) (setq heading (or (cdr (assoc org-vcard-default-property-for-heading card)) (replace-regexp-in-string "^;\\|;$" "" (cdr ...)))) (setq content (concat content "* " heading "\n" ":PROPERTIES:\n")) (let ((--dolist-tail-- card) entry) (while --dolist-tail-- (setq entry (car --dolist-tail--)) (if (not ...) (let* ... ... ...)) (setq --dolist-tail-- (cdr --dolist-tail--)))) (setq content (concat content ":END:\n")) (setq --dolist-tail-- (cdr --dolist-tail--))))) (org-vcard-transfer-write (quote import) content destination))
org-vcard-import-to-flat("buffer" "file")
org-vcard-transfer-helper("buffer" "file" "flat" "en" "4.0" import)
org-vcard-import(nil)
call-interactively(org-vcard-import record nil)
command-execute(org-vcard-import record)
execute-extended-command(nil "org-vcard-import")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
When I select vCard-3.0 I get:
org-vcard-import-parse: Args out of range: " /addressbooks/atmarama/contacts/a6f91204-771c-4585-a047-20c06d7ac5bb.vcf", 24, 75
@gour:
Firstly, no, there's no particular setup required to begin using org-vcard
- it should work "out of the box".
Secondly, thanks for reporting this issue! But just to double-check: i'm assuming you've exported from oC to a VCF file, and then want to import that file directly into an Emacs buffer in org-contacts format? Or are you opening the VCF file in Emacs, and then wanting to export the contents of the opened buffer to an org-contacts file?
Firstly, no, there's no particular setup required to begin using org-vcard - it should work "out of the box".
OK, I assumed that, but asked to be sure.
i'm assuming you've exported from oC to a VCF file,
Well, I've tried with both export from oC as well as from Evol.
and then want to import that file directly into an Emacs buffer in org-contacts format?
Is it possible to do that? org-vcard-import offers only {buffer,region,subtree} as options?
Or are you opening the VCF file in Emacs, and then wanting to export the contents of the opened buffer to an org-contacts file?
I'm trying that, iow. opening VCF in Emacs and then selecting 'buffer' as 'source' and trying to import into file as 'destination'.
org-vcard-import offers only {buffer,region,subtree} as options?
Oops! The options should in fact be {file,buffer,region} (which they actually are when doing an import via the Org-vCard menu). Sorry about that! i've now fixed this and pushed the change; can you please test importing from 'file' to 'buffer'? If that works, can you please again test importing from 'buffer' to 'file'?
can you please test importing from 'file' to 'buffer'?
I still get:
org-vcard-import-parse: Args out of range: " ma.net.vcf", 0, 23
and when I inspect my *.vcf file, I see things like:
PRODID:-//ownCloud//NONSGML Contacts 0.3.0.18//EN
X-EVOLUTION-WEBDAV-HREF:https://gour@oc.domain.tld/remote.php/carddav/add
ressbooks/gour/contacts/some-uuid%2540oc.atmara
ma.net.vcf
URL:
TITLE:
so it looks that vcf files produced by oC and/or Evo are not correct?
There are some formatting problems with my *.vcf file. I fixed most of them, but here is another one:
...
EMAIL:sjaniska@gmail.com
PHOTO;ENCODING=b;TYPE=jpeg:/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQEC
AgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2w
They are few of them having avatar(-like) image and import fails with:
org-vcard-import-parse: Wrong type argument: stringp, nil
What to do with them? Simply rm from VCARD entry?
After rm-ing them, file --> buffer import worked. :-)
If that works, can you please again test importing from 'buffer' to 'file'?
That worked as well. :-)
So, it seems the main problem is compatibility with oC and/or Evolution exported formats.
Any hint?
I wonder how it works for you?
Well, when i just tried exporting contacts from oC to a file, which i then import using org-vcard-import
, it "just works".
Looking at the examples you've provided which are causing issues, it seems to me that the issue might be multiline fields, such as:
X-EVOLUTION-WEBDAV-HREF:https://gour@oc.domain.tld/remote.php/carddav/add
ressbooks/gour/contacts/some-uuid%2540oc.atmara
ma.net.vcf
(which would explain the error message's reference to ' ma.net.vcf') and
PHOTO;ENCODING=b;TYPE=jpeg:/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQEC
AgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2w
Support for multiline fields is still on the TODO list.
To check if this is indeed the issue, could you please check what happens when you remove newlines and indentation from within vCard fields, e.g.:
X-EVOLUTION-WEBDAV-HREF:https://gour@oc.domain.tld/remote.php/carddav/addressbooks/gour/contacts/some-uuid%2540oc.atmarama.net.vcf
Looking at the examples you've provided which are causing issues, it seems to me that the issue might be multiline fields, such as:
Yes, fixing those, now I can import. :-)
Support for multiline fields is still on the TODO list.
That would be great!!
Btw, how to know which fields are allowed in VCARD entry?
Am I right that org-vcard can handle VCARD-4.0 format (although I probably had to do some reading in regard)?
Yes, fixing those, now I can import. :-)
Excellent. :-)
Support for multiline fields is still on the TODO list.
That would be great!!
:-) Well, now that you've helped discover that lack of multi-line support is what's causing the issues you've been having, i've started work on adding such support. i've already got the basics working, but will need to check the various vCard specs to check exactly how such fields are supposed to work. i'll leave this issue open until i push the changes and you've been able to confirm that they Work For You. :-)
Btw, how to know which fields are allowed in VCARD entry?
In theory, anything specified by the relevant version of the vCard spec (i.e. either 4.0, 3.0 or 2.1). In practice, each version of the spec isn't necessarily thoroughly supported at this point, so it's limited to the fields specified in the relevant locale mapping file.
Whether or not to import verbatim vCard fields that are currently 'unknown' to org-vcard
is specified by the org-vcard-include-import-unknowns
variable.
Whether or not to import verbatim vCard fields that are currently 'unknown' to org-vcard is specified by the org-vcard-include-import-unknowns variable.
Ahh, that's helpful to know to possibly make it to 'upgrade' in the future.
Okay, have pushed the changes - could you please test if importing now works for you?
Okay, have pushed the changes - could you please test if importing now works for you?
It works perfectly, even with org-vcard-include-import-unknowns
variable set. ;)
:-) Excellent! Closing issue.
Hello,
I did export my contacts from ownCloud and when I try to import them into org-vcard I get the following:
org-vcard-import-parse: Args out of range: " ma.net.vcf", 0, 23
I did select buffer as source and file as destination.
Any hint?
p.s. Forget to ask whether there is some setup required within Emacs to use org-vcard, iow. I just installed package from MELPA?