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
[Message part 1 (text/plain, inline)]
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
--- 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))
- (+ (point-min) (read (current-buffer)))
+ (+ (point-min) (byte-to-position
+ (read (current-buffer))))
major-mode)))))
(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)))
- (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 direction."
(re-search-backward "\\(^.*\\): [0-9]+$")
(re-search-forward "\\(^.*\\): [0-9]+$"))
(goto-char (+ (match-end 1) 2))
- (setq list (cons (cons (+ (point-min)
- (read (current-buffer)))
- (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:
----
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 <teddy <at> recompile.se>.
----
/Teddy Hogeborn
[signature.asc (application/pgp-signature, inline)]
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.