unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: emacs-devel@gnu.org
Subject: Re: [ELPA] Proposed package: vcard
Date: Sat, 01 Feb 2020 09:22:04 -0500	[thread overview]
Message-ID: <jwvy2tm9z2i.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <878slnq6nu.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Fri, 31 Jan 2020 20:21:25 -0800")

> 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
>     '("BEGIN:VCARD" "END:VCARD"
>      ("^[^;:]+" . '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,


        Stefan




  reply	other threads:[~2020-02-01 14:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-01  4:21 [ELPA] Proposed package: vcard Eric Abrahamsen
2020-02-01 14:22 ` Stefan Monnier [this message]
2020-02-02 17:50   ` Eric Abrahamsen
2020-02-03 20:05     ` Eric Abrahamsen
2020-02-03 20:52       ` Stefan Monnier
2020-02-03 21:26         ` Eric Abrahamsen

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvy2tm9z2i.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs.git

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