[Top][All Lists]

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

Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and

From: Eli Zaretskii
Subject: Re: [elpa] 02/04: company-clang: handle multibyte chars between bol and point
Date: Wed, 19 Mar 2014 20:33:49 +0200

> Date: Wed, 19 Mar 2014 19:56:34 +0200
> From: Dmitry Gutov <address@hidden>
> CC: address@hidden, address@hidden
> On 19.03.2014 18:54, Eli Zaretskii wrote:
> > Sorry, maybe I'm missing something, but I don't see how this could be
> > a reasonable assumption.  Don't you need to produce the same byte
> > stream as would be found in the file when saved to disk?
> Since we only need to count the bytes between the bol and point (on 
> disk, yes), and multibyte chars are relatively rare, we can afford not 
> to be very accurate.

If clang can endure inaccurate counts (I don't know if it can), then
perhaps that's good enough.  But then so will be just length of the
string in characters.

> But if you could point out an easy way to obtain that byte count more 
> correctly, that would be quite welcome.

I did, see below.

> > If so, then
> > you need to produce data about byte counts as they will be in that
> > encoding, which is defined by buffer-file-coding-system.
> So, um, do I use something like
>   (length (encode-coding-string STR buffer-file-coding-system))
> ?

Yes, I think so.

reply via email to

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