[Top][All Lists]

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

Re: [ELPA] Proposed package: vcard

From: Stefan Monnier
Subject: Re: [ELPA] Proposed package: vcard
Date: Sat, 01 Feb 2020 09:22:04 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> I wanted to add full vCard support to EBDB, including parsing vCard
> files. There are some vCard-related packages in the repos already, but
> they're all tied to some other specific library (BBDB, Org, etc), and I
> thought it would be good to have a library that does a sort of
> vCard-to-vanilla-data-structure process, so I wrote a new one. Yes, I am
> aware of the relevant XKCD comic.

The solution to the XKCD's objection is to rewrite at least one of the
existing solutions on top of your library.  Bonus points if your new one
is obtained by extracting code from that existing other solution rather
than by writing it all from scratch.

>    Note: It is possible for very simple implementations to generate
>    improperly folded lines in the middle of a UTF-8 multi-octet
>    sequence.  For this reason, implementations SHOULD unfold lines in
>    such a way as to properly restore the original sequence.
>    The dumb solution is to find *.vcf files literally, and delete all
>    runs of \015\012\040 or \015\012\011. But then the file should be
>    _revisited_ and decoded using whatever coding system and other
>    parameters that Emacs had originally guessed heuristically for the
>    file.

Hmm... so you have to make sure it's first opened as binary, then
do the unfolding, then do the normal decoding?  

>    I haven't come up with a clean way of doing that (apart from
>    maybe saving a temporary intermediate file).

I think the right answer likely involves `after-insert-file-set-coding`,
and `set-auto-coding`, but there's probably more to it.

> 3. The vcard-mode font-locking doesn't work correctly. The value of
>    `font-lock-defaults' is set to:
>    (defvar vcard-font-lock-keywords
>      ("^[^;:]+" . 'vcard-property-face)
>      (";\\([^=]+\\)=" (1 'vcard-parameter-key-face))
>      ("=\\([^;:]+\\)[;:]" (1 'vcard-parameter-value-face))))
>    But this _sometimes_ doesn't highlight the parameter keys correctly,
>    and I don't know why. I've never messed with font locking before, and
>    would appreciate pointers. I think it might have to do with
>    overlapping matches.

Give us an example,


reply via email to

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