GNU bug report logs -
#20704
info.el bug fix; Interprets Info format wrongly
Previous Next
Reported by: Teddy Hogeborn <teddy <at> recompile.se>
Date: Sun, 31 May 2015 17:53:03 UTC
Severity: normal
Tags: patch
Merged with 13431
Found in version 24.2
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Date: Mon, 01 Jun 2015 10:01:59 -0400
> Cc: 20704 <at> 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.
This bug report was last modified 5 years and 333 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.