pinoaffe / org-vcard

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

wrong-type-argument stringp nil #40

Closed uwejochum closed 2 years ago

uwejochum commented 2 years ago

I have no idea what this is all about, but I get this error message (everything worked before one of the upgrades of org-vcard):

Debugger entered--Lisp error: (wrong-type-argument stringp nil) insert-file-contents(nil nil nil nil nil) insert-file-contents-literally(nil) org-vcard-import-parse("buffer") vdirel--parse-file-to-contact("/home/uwe/.pim/kontakte/privat/default/3E30766C-B060-19EC-ADE8-4C2E4D6EDFEC.vcf") mapcar(vdirel--parse-file-to-contact ("/home/uwe/.pim/kontakte/privat/default/3E30766C-B060-19EC-ADE8-4C2E4D6EDFEC.vcf" "/home/uwe/.pim/kontakte/privat/default/017938C0-0ECF-6521-39F0-EC525C0AFB00.vcf" "/home/uwe/.pim/kontakte/privat/default/999376df-078f-4b97-b765-68ff5c2a26cf.vcf" "/home/uwe/.pim/kontakte/privat/default/42BAF536-B9CC-C8BA-9635-D6E056768509.vcf" "/home/uwe/.pim/kontakte/privat/default/132F81D7-E2F1-654F-AA79-2F19FC36F02E.vcf" "/home/uwe/.pim/kontakte/privat/default/5DEB6420-2499-CB04-8AF5-E361F41B8B6F.vcf" "/home/uwe/.pim/kontakte/privat/default/3B133C4F-F752D612-5B07415E.vcf" "/home/uwe/.pim/kontakte/privat/default/77F8B1E6-D2E3-6974-DE82-33077EAF12F5.vcf" "/home/uwe/.pim/kontakte/privat/default/AB4619C9-3932-D468-2FF3-C85ACB108930.vcf" "/home/uwe/.pim/kontakte/privat/default/9D016725-AD38-302B-2AED-D820C0D58F5A.vcf" "/home/uwe/.pim/kontakte/privat/default/78fb19f0-283d-4a3d-88de-048e59279d82.vcf" "/home/uwe/.pim/kontakte/privat/default/D77DAD89-8DC0-E4A2-3864-B117C8632331.vcf" "/home/uwe/.pim/kontakte/privat/default/CCFF3227-7375-EF3F-5389-BFEA32A41CEC.vcf" "/home/uwe/.pim/kontakte/privat/default/pas-id-5AEDF8200000000A.vcf" "/home/uwe/.pim/kontakte/privat/default/86ea35d3-6440-4a97-970d-80b407ecbb9b.vcf" "/home/uwe/.pim/kontakte/privat/default/5e12a1bb-0af1-4434-9d5e-643e8fccd231.vcf" "/home/uwe/.pim/kontakte/privat/default/pas-id-5AEDF82000000003.vcf" "/home/uwe/.pim/kontakte/privat/default/c76fcb83-8616-4bcc-88bd-d798ae3045dc.vcf" "/home/uwe/.pim/kontakte/privat/default/6121D5A5-B100-A4CE-BB33-D6A622EAF75E.vcf" "/home/uwe/.pim/kontakte/privat/default/pas-id-5AEDF8200000000C.vcf" "/home/uwe/.pim/kontakte/privat/default/887519C0-F539-55D5-D87F-2C7F6A4BBD2F.vcf" "/home/uwe/.pim/kontakte/privat/default/BCEF9A3A-6F04-3AC6-3588-718A8BDB4615.vcf" "/home/uwe/.pim/kontakte/privat/default/41e71924-9dcf-44b5-a5f5-cbcb0513f866.vcf" "/home/uwe/.pim/kontakte/privat/default/pas-id-5AEDF8200000001A.vcf" "/home/uwe/.pim/kontakte/privat/default/e0c086ba-8414-4a1e-82ce-4d46ced5c0e8.vcf" "/home/uwe/.pim/kontakte/privat/default/AFE064A3-45B7-BFE2-595C-65DCF3E3F0BC.vcf" "/home/uwe/.pim/kontakte/privat/default/D663C197-9AC7-B53C-CE50-91348511F46B.vcf" "/home/uwe/.pim/kontakte/privat/default/B00F148F-0AF5-EA36-6C6F-860F8CBC2E7E.vcf" "/home/uwe/.pim/kontakte/privat/default/0d11c849-543f-43b6-86f9-c46cca179465.vcf" "/home/uwe/.pim/kontakte/privat/default/972EB2F2-F2CE-0614-CCDC-13B4E29EE970.vcf" "/home/uwe/.pim/kontakte/privat/default/78AA3CC5-0E58-416C-090F-5FD7393A1542.vcf" "/home/uwe/.pim/kontakte/privat/default/39104112-8A6B-F555-8C2E-37D39F887C36.vcf" "/home/uwe/.pim/kontakte/privat/default/179acd9c-9b17-4621-ab0e-7ff210c45391.vcf" "/home/uwe/.pim/kontakte/privat/default/CC2F5DCB-89E8-DF17-9F4C-C5F1E699CA93.vcf" "/home/uwe/.pim/kontakte/privat/default/624CA4EC-D48D-8067-7FF5-ECCDB3D7FF73.vcf" "/home/uwe/.pim/kontakte/privat/default/e383ae8f-e696-4749-93f4-8abf49515d24.vcf" "/home/uwe/.pim/kontakte/privat/default/E75DE7D6-7D15-FE5F-AF80-E025C5905867.vcf" "/home/uwe/.pim/kontakte/privat/default/3c1abb33-cefd-4fc8-a0ed-a1bed668566d.vcf" "/home/uwe/.pim/kontakte/privat/default/a96d4a4c-41e8-4ed7-a9dd-c3db3426ee89.vcf" "/home/uwe/.pim/kontakte/privat/default/5bbe0389-9547-4577-96ce-085c7cb91e47.vcf" "/home/uwe/.pim/kontakte/privat/default/6c61cc02-8af6-4f77-b88e-14e7afbab318.vcf" "/home/uwe/.pim/kontakte/privat/default/pas-id-5AED9AF000000008.vcf" "/home/uwe/.pim/kontakte/privat/default/pas-id-5AEDF8220000009F.vcf" "/home/uwe/.pim/kontakte/privat/default/EC844F62-26F8-72BE-4E10-9C7499A2BA76.vcf" "/home/uwe/.pim/kontakte/privat/default/b3aebf2b-24ba-4492-ab43-f8d84f82253d.vcf" "/home/uwe/.pim/kontakte/privat/default/50500b1971634c08782e9573150b798f44f4f423.vcf" "/home/uwe/.pim/kontakte/privat/default/pas-id-5AEDF82000000009.vcf" "/home/uwe/.pim/kontakte/privat/default/CBBBD98A-7946-F6DD-5899-10DD734A1331.vcf" "/home/uwe/.pim/kontakte/privat/default/202C2A9E-41BA-62DF-5FD4-E9A26D26ACA3.vcf" "/home/uwe/.pim/kontakte/privat/default/052657a7-a0cf-4333-b8be-31e17ccf782e.vcf" ...)) vdirel--build-contacts("/home/uwe/.pim/kontakte/privat/default") vdirel-refresh-cache("/home/uwe/.pim/kontakte/privat/default") vdirel-helm-select-email(nil "/home/uwe/.pim/kontakte/privat/default") funcall-interactively(vdirel-helm-select-email nil "/home/uwe/.pim/kontakte/privat/default") call-interactively(vdirel-helm-select-email record nil) command-execute(vdirel-helm-select-email record) execute-extended-command(nil "vdirel-helm-select-email" nil) funcall-interactively(execute-extended-command nil "vdirel-helm-select-email" nil) call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command) My Emacs is 26.3 on Linux Mint.

krisman commented 2 years ago

I suspect the bug was introduced by commit 2b14884e55ef ("org-vcard.el: Modify org-vcard-import-parse"), which seems to only handle the file case. It breaks for source==buffer, in which case filename is nil and org-vcard-import-parse should read from the current buffer, instead of opening a new temporary buffer. vdirel relies on that behavior.

The solution should be using with-temp-buffer only when the source== file. @flexibeast , I'm not proficient in lisp, so I don't think I could write a better fix than simply sending a PR for revert. Would you be ok with that, or do you prefer a different approach?

uwejochum commented 2 years ago

I am no programmer, so I cannot figure out what the best way would be. But anyway: I appreciate the work that is done on org-vcard and vdirel, so I am happy with any solution. Thank you very much for looking into this issue and for your suggestion. Of course I am o.k. with any step you take to fix the issue.

krisman commented 2 years ago

@uwejochum just fyi, according to the author of the package, vdirel is deprecated [1]. You might want to migrate your setup to khardel. I did it last night and I'm surprised how well it works.

[1] https://github.com/DamienCassou/vdirel/issues/19

uwejochum commented 2 years ago

@krisman: Thanks for the hint! But khardel needs Emacs 27.1, mine (on Linux Mint) is Emacs 26.3. Now it is: wait or upgrade...

uwejochum commented 2 years ago

Correction: Just checked khardel -- it also works with Emacs 26.3 (although the package says it needs >27.1)!

flexibeast commented 2 years ago

Sorry to have taken so long to respond further on this.

Yes, @krisman, that was my assessment too: vdirel has apparently been relying on an implementation detail, which changed in the org-vcard commit you mentioned. That commit was part of lots of broader work i've been doing to 'tidy' the codebase in various ways: this package was my first ELisp package, and it has many, er, 'infelicities'. :-)

i'd been thinking that, even though vdirel's reliance on this implementation detail was probably ill-advised, i'd probably revert the commit, on the basis that this bit of 'tidying' wasn't worth breaking vdirel. However, since vdirel is deprecated in favour of khardel, i'd prefer to not revert the commit, and instead tell people to migrate to khardel.

@uwejochum: Emacs 26.3 was released in August 2019, and there have been two major releases since then; it seems odd that a major distro like Mint has an Emacs package that's so out of date. :-( At any rate, since you've said khardel works with 26.3, i'm going to close this issue.