From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teddy Hogeborn Newsgroups: gmane.emacs.bugs Subject: bug#20704: info.el bug fix; Interprets Info format wrongly Date: Sun, 31 May 2015 16:54:05 +0200 Message-ID: <87d21gpzle.fsf@tower.recompile.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1433094804 14824 80.91.229.3 (31 May 2015 17:53:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 May 2015 17:53:24 +0000 (UTC) To: 20704@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 31 19:53:13 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 1Yz7Q8-00041d-Dn for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 May 2015 19:53:12 +0200 Original-Received: from localhost ([::1]:42730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz7Q7-0002YV-NC for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 May 2015 13:53:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz7Q3-0002YL-KI for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 13:53:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yz7Q0-0006HZ-B5 for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 13:53:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz7Q0-0006HV-7a for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 13:53:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yz7Q0-0002BF-1m for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 13:53:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Teddy Hogeborn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 May 2015 17:53:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20704 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14330947728344 (code B ref -1); Sun, 31 May 2015 17:53:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 May 2015 17:52:52 +0000 Original-Received: from localhost ([127.0.0.1]:35064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yz7Pm-0002AU-JI for submit@debbugs.gnu.org; Sun, 31 May 2015 13:52:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46525) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yz4d6-0006Zp-OO for submit@debbugs.gnu.org; Sun, 31 May 2015 10:54:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yz4d0-0004FF-NW for submit@debbugs.gnu.org; Sun, 31 May 2015 10:54:19 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4d0-0004FB-Ka for submit@debbugs.gnu.org; Sun, 31 May 2015 10:54:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4cz-0004sL-BQ for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:54:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yz4cw-0004Dc-54 for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:54:17 -0400 Original-Received: from tower.recompile.se ([88.80.28.95]:55630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yz4cv-0004DN-Uf for bug-gnu-emacs@gnu.org; Sun, 31 May 2015 10:54:14 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by tower.recompile.se (Postfix) with ESMTP id A654736E530; Sun, 31 May 2015 16:54:09 +0200 (CEST) Original-Received: by tower.recompile.se (Postfix, from userid 1000) id 7858336E4C9; Sun, 31 May 2015 16:54:09 +0200 (CEST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sun, 31 May 2015 13:52:48 -0400 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:103401 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable The Info file format (see (texinfo)Info Format Tag Table.) is documented as having the reference position in bytes. However, the info.el functions "Info-find-in-tag-table-1", "Info-read-subfile", and "Info-search" reads the byte value and adds it to (point-min), which is a character position, not a byte position. This causes the Emacs Info reader to jump to the wrong position in Info files with a lot of non-ascii characters. Solution: Convert the read value to position using byte-to-position: diff --git a/lisp/info.el b/lisp/info.el index 80428e7..b179510 100644 =2D-- a/lisp/info.el +++ b/lisp/info.el @@ -1020,7 +1020,8 @@ which the match was found." (beginning-of-line) (when (re-search-forward regexp nil t) (list (string-equal "Ref:" (match-string 1)) =2D (+ (point-min) (read (current-buffer))) + (+ (point-min) (byte-to-position + (read (current-buffer)))) major-mode))))) =20 (defun Info-find-in-tag-table (marker regexp &optional strict-case) @@ -1523,7 +1524,9 @@ is non-nil)." thisfilepos thisfilename) (search-forward ": ") (setq thisfilename (buffer-substring beg (- (point) 2))) =2D (setq thisfilepos (+ (point-min) (read (current-buffer)))) + (setq thisfilepos (+ (point-min) + (byte-to-position + (read (current-buffer))))) ;; read in version 19 stops at the end of number. ;; Advance to the next line. (forward-line 1) @@ -2013,9 +2016,11 @@ If DIRECTION is `backward', search in the reverse di= rection." (re-search-backward "\\(^.*\\): [0-9]+$") (re-search-forward "\\(^.*\\): [0-9]+$")) (goto-char (+ (match-end 1) 2)) =2D (setq list (cons (cons (+ (point-min) =2D (read (current-buffer))) =2D (match-string-no-properties 1)) + (setq list (cons (cons + (+ (point-min) + (byte-to-position + (read (current-buffer)))) + (match-string-no-properties 1)) list)) (goto-char (if backward (1- (match-beginning 0)) Suggested ChangeLog: =2D--- Convert reference byte positions from Info file to character position. * lisp/info.el (Info-find-in-tag-table-1, Info-read-subfile) (Info-search): Convert position read from Info file from bytes to character position. Patch by Teddy Hogeborn . =2D--- /Teddy Hogeborn --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJVayCNAAoJEOubGwHeBXLk9cYQAJ6KYtVDeXZxTT7Nx9ISK0zQ soMH6XJbjeWVCzounDoVCS/fZdrLbmmrPQO9SLlC34AWpfeE/CjHqHQlCFO22M68 6N/tJjQ5Zy7t6nH2i9p3KRfoohmZpewCMwvmW9EY7BapwDBezG8xzkpr3mhgYfUV S+0DyLB3pElkxDhemcrjVLsGbtSqvBnjyIFWV//jLNmy2c/edMWP+RaNI3h/6x2I uvX0d+4cOLIgVLGGdUkO2EYTn9Vtzqb3tOjLTkDkACywtma+bgDMzsap9vcQjI+l oioi9HPs+awW99hDs19lfiuKx2Qi3kglSKbkJeffTbO9fFg+VdfufKTosA2/GOP3 KSHWIKuWwYlr5nCpcWpBd3/pn6xXL6QKFBMwnK0vZRglJgtFQpXGB/h/CLH6khzj GANWnm0wV5R6l/w5zxF5MLVH2wqUKZJjm8klK00iPQtrY/m+0WF6iRk5dO9MjOla Z0iQgLTBH1B81yCCisXEMld44GgQAFb9shQN4/8yYAhnQ53mftkMgZiq6wmoOl/S AxR362KfWpRrKn/zDdbDH0/lrzUS8XNKFH/pCX7gxoxuB4Isdt9oBypw+2mLjhjt RuiFWRztPTEoaWsev0nMBhzEDdXrKvTrkfsFWDUqHHBpqTYQF1sobo32MsKq7/NB UAZlLhjc5xs8jFJzFLzV =Ccju -----END PGP SIGNATURE----- --=-=-=--