[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20704: info.el bug fix; Interprets Info format wrongly
From: |
Eli Zaretskii |
Subject: |
bug#20704: info.el bug fix; Interprets Info format wrongly |
Date: |
Mon, 01 Jun 2015 18:12:35 +0300 |
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Mon, 01 Jun 2015 10:01:59 -0400
> Cc: 20704@debbugs.gnu.org
>
> Thanks,
>
> > + (+ (point-min) (byte-to-position
> > + (read (current-buffer))))
>
> Hmm... this only works if the Info file is encoded in UTF-8.
> I guess in the case of Info, 99% of the files are just ASCII and there's
> a chance that the vast majority of the rest is (or will be) UTF-8,
> so maybe this hack works well in practice.
Using byte-to-position would make things worse for Latin-1 and the
likes.
But it shouldn't be hard to add a simple test of
buffer-file-coding-system: if it states fixed-size encoding, like any
of the 8-bit encodings, or UTF-16, the conversion to character
position is trivial. AFAIR, the only problems will be with ISO-2022
derived encodings, and those are really rare in Info. So IMO adding
such a simple test would go a long way towards making the solution
almost perfect.
> But I think we should define an `Info-bytepos-to-charpos' function for that.
> It can be defined as an alias for byte-to-position, but at least it
> concentrates this utf-8 assumption at a single place where we can place
> a clear comment.
Right.
Thanks.