From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20704: info.el bug fix; Interprets Info format wrongly Date: Mon, 01 Jun 2015 18:12:35 +0300 Message-ID: <83382btqcc.fsf@gnu.org> References: <87d21gpzle.fsf@tower.recompile.se> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1433171604 24296 80.91.229.3 (1 Jun 2015 15:13:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Jun 2015 15:13:24 +0000 (UTC) Cc: teddy@recompile.se, 20704@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 01 17:13:12 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YzROp-0005ic-GX for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Jun 2015 17:13:11 +0200 Original-Received: from localhost ([::1]:52918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzROo-0005rX-QU for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Jun 2015 11:13:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzROk-0005rO-TW for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2015 11:13:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzROg-0006po-T4 for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2015 11:13:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzROg-0006pk-PG for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2015 11:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YzROg-0001ys-Bi for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2015 11:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Jun 2015 15:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20704 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 20704-submit@debbugs.gnu.org id=B20704.14331715787605 (code B ref 20704); Mon, 01 Jun 2015 15:13:02 +0000 Original-Received: (at 20704) by debbugs.gnu.org; 1 Jun 2015 15:12:58 +0000 Original-Received: from localhost ([127.0.0.1]:36305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YzROc-0001ya-F2 for submit@debbugs.gnu.org; Mon, 01 Jun 2015 11:12:58 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:55027) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YzROZ-0001yD-8a for 20704@debbugs.gnu.org; Mon, 01 Jun 2015 11:12:56 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NP900E00TN0H300@a-mtaout20.012.net.il> for 20704@debbugs.gnu.org; Mon, 01 Jun 2015 18:12:49 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NP900EF1U9CGT30@a-mtaout20.012.net.il>; Mon, 01 Jun 2015 18:12:49 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103436 Archived-At: > From: Stefan Monnier > 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.