diff options
author | Eli Zaretskii <eliz@gnu.org> | 2015-07-18 13:23:22 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2015-07-18 13:23:22 +0300 |
commit | 166ffcb6c7a012ed5f655d7bb0fad97319ad54fc (patch) | |
tree | b003c93eae7a22c64e78be8e738ec5b0c2b7bc2c /lisp/info.el | |
parent | d3816bf8ad1fcfed2a32d23216a55850ee4325b5 (diff) | |
download | emacs-166ffcb6c7a012ed5f655d7bb0fad97319ad54fc.tar.gz |
Fix following Info cross-references to anchors
* lisp/info.el (Info-read-subfile): Add to the returned value the
length of subfile preamble, after converting it to file's byte
offset, as expected by the caller. Use bufferpos-to-filepos.
(Info-find-node-2): If searching for a node with a
1000-character slop fails, try again with a 10000-character slop,
to account for known bugs in Texinfo 5.0 and 5.1. (Bug#21055)
* lisp/international/mule-util.el (bufferpos-to-filepos): New
function.
* etc/NEWS: Mention bufferpos-to-filepos.
Diffstat (limited to 'lisp/info.el')
-rw-r--r-- | lisp/info.el | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lisp/info.el b/lisp/info.el index 413928bcfbc..bcff7ccffd3 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1217,6 +1217,18 @@ is non-nil)." (goto-char pos) (throw 'foo t))) + ;; If the Texinfo source had an @ifnottex block of text + ;; before the Top node, makeinfo 5.0 and 5.1 mistakenly + ;; omitted that block's size from the starting position + ;; of the 1st subfile, which makes GUESSPOS overshoot + ;; the correct position by the length of that text. So + ;; we try again with a larger slop. + (goto-char (max (point-min) (- guesspos 10000))) + (let ((pos (Info-find-node-in-buffer regexp strict-case))) + (when pos + (goto-char pos) + (throw 'foo t))) + (when (string-match "\\([^.]+\\)\\." nodename) (let (Info-point-loc) (Info-find-node-2 @@ -1553,10 +1565,13 @@ is non-nil)." (if (looking-at "\^_") (forward-char 1) (search-forward "\n\^_")) - ;; Don't add the length of the skipped summary segment to - ;; the value returned to `Info-find-node-2'. (Bug#14125) (if (numberp nodepos) - (- nodepos lastfilepos)))) + ;; Our caller ('Info-find-node-2') wants the (zero-based) byte + ;; offset corresponding to NODEPOS, from the beginning of the + ;; subfile. This is especially important if NODEPOS is for an + ;; anchor reference, because for those the position is all we + ;; have. + (+ (- nodepos lastfilepos) (bufferpos-to-filepos (point) 'exact))))) (defun Info-unescape-quotes (value) "Unescape double quotes and backslashes in VALUE." |