[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Karl Berry
Subject: arithmetic
Date: Thu, 15 Aug 2013 18:22:09 GMT


Was this change in node pointer arithmetic unintentional?
At least I don't recall discussing it.

Can we go back to the original arithmetic?  And perhaps we should
document the specifics in the Info spec appendix.



Date: Tue, 30 Apr 2013 09:50:14 +0300
From: Juri Linkov <address@hidden>
To: address@hidden
Cc: address@hidden
Subject: Re: bug#14125: 24.3;
        "No such node or anchor: Top" for Info files created by makeinfo 5.1

[Cc'ing to bug-texinfo for reference, thread started at
 http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-04/msg00039.html ]

> Info-goto-node cannot find the "Top" node for some Info files
> generated with makeinfo 5.1.

Makeinfo 5.0 changes in arithmetic of node positions in the tag table
makes Info files with the summary segment longer than a thousand characters
unreadable by the Emacs Info reader.

Makeinfo 4.13 produced the character positions of indirect subfiles
relative to the beginning of the first node, but Makeinfo 5.0 produces the
positions relative to the beginning of the subfile.  The Emacs Info reader
fails when the distance between the beginning of the subfile and
the beginning of its first node is longer than a thousand characters.

Both addressing schemes are valid and both make sense.  But to able to support
Info files produced by Makeinfo 5.0/1 the Emacs Info reader needs to be fixed.

The expression (+ (- nodepos lastfilepos) (point)) in `Info-read-subfile'
assumes that `lastfilepos' in `Info-read-subfile' is the beginning of the
first node, so for Info files produced by Makeinfo 4.13 it returns the
length of the summary segment, but for Makeinfo 5.0 it returns
two lengths of the summary segment.

The following patch changes it to return (point-min) for 4.13 and
the length of the summary segment for 5.0.  Since this code was merely
an optimization to skip the summary segment, this change shouldn't break
reading of Info files produced by Makeinfo 4.13 and older versions where
`Info-find-node-2' will start searching for the node in the summary segment.
However, this part of `Info-read-subfile'

    (if (looking-at "\^_")
        (forward-char 1)
      (search-forward "\n\^_"))

should be left unchanged for `Info-search' to not search in the summary segment.

The minimal patch to support all Makeinfo versions:

=== modified file 'lisp/info.el'
--- lisp/info.el        2013-04-22 06:41:30 +0000
+++ lisp/info.el        2013-04-30 06:49:35 +0000
@@ -1545,7 +1545,7 @@ (defun Info-read-subfile (nodepos)
        (forward-char 1)
       (search-forward "\n\^_"))
     (if (numberp nodepos)
-       (+ (- nodepos lastfilepos) (point)))))
+       (+ (- nodepos lastfilepos) (point-min)))))
 (defun Info-unescape-quotes (value)
   "Unescape double quotes and backslashes in VALUE."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]