Subject: bug#13431: 24.2; UTF-8 causes bad reference position under Emacs Info

From: Joseph Oswald <[email-masked]>
Date: Sun, 13 Jan 2013 18:12:39 -0500

Info files with UTF-8 characters cause bad cursor positioning when
following references.

In the attached utf8-test info file, following the reference "English"
positions the point "p" in "speaking", several characters past where
the reference is located.

utf8-test was generated using makeinfo from texinfo 4.13

I did a bit of investigation: makeinfo apparently generates tag tables
using bytes, not characters; it seems Emacs Info is using goto-char
without the bytes-to-position conversion.

However, when I tried a simple fix, the position was still off-by-one.
Standalone info seems to be off-by-one position as well.

In GNU Emacs 24.2.1 (x86_64-apple-darwin10.8.0, NS apple-appkit-1038.36)
 of 2012-11-29 on joseph-oswalds-ibook-g4.local
Windowing system distributor `Apple', version 10.3.1038
Configured using:
 `configure '--prefix=/opt/local' '--with-ns' '--without-x'
 '--without-dbus' 'CC=/usr/bin/gcc-4.2' 'CFLAGS=-pipe -O2 -arch x86_64'
 'LDFLAGS=-L/opt/local/lib -arch x86_64'
 'CPPFLAGS=-I/opt/local/include''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <up> <up>
<up> <up> <up> <up> <up> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> C-x C-x k
C-x k <return> y e s <return> q q q q C-u C-h i ~ /
D o c <tab> D e v <tab> F <tab> S <tab> t e <tab> <tab>
<tab> <return> n f E n g <tab> <return> <escape> x
<up> <return> <up> <up> <return> C-x ` <down> <up>
<up> C-v <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <up> C-x k <return> y e
s <return> q U H i C-u C-h i ~ / D o c u m e n t s
/ D e v e l o p m e n t / F S F / t e x t i n f o /
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> i n f o / u t f - <backspace> 8 - t e s
t <return> n f E n g l i s h <return> <escape> x <up>
<return>

Recent messages:
Checking 48 files in
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/emulation...
Checking 148 files in
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/emacs-lisp...
Checking 24 files in
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/cedet...
Checking 57 files in
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/calendar...
Checking 87 files in
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/calc...
Checking 65 files in
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/obsolete...
Checking 1 files in /Applications/MacPorts/Emacs.app/Contents/Resources/leim...
Checking for load-path shadows...done
byte-code: No more matches
Auto-saving...done

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message idna rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums eldoc network-stream
auth-source eieio assoc password-cache starttls tls doc-view image-mode
cl-specs edebug trace debug texnfo-upd goto-addr tabify vc-rcs color
cus-edit descr-text nroff-mode scheme sgml-mode conf-mode newcomment
nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc
rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok
ruby-mode skeleton sh-script executable dired-aux mule-util cal-move
parse-time org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc
org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks find-func
org-agenda org-info org-gnus org-docview org-bibtex bibtex org-bbdb org
ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table org-footnote org-src
ob-comint ob-keys ob ob-eval org-pcomplete pcomplete org-list org-faces
org-compat org-entities org-macs noutline outline format-spec cal-menu
calendar cal-loaddefs ediff-merg ediff-diff ediff-wind ediff-help
ediff-util ediff-mult ediff-init ediff ind-util tar-mode jka-compr dired
misearch multi-isearch info vc-git texinfo help-mode view gnus gnus-ems
nnheader gnus-util mail-utils mm-util mail-prsvr wid-edit cus-start
cus-load slime-asdf warnings slime-fancy slime-fontifying-fu
slime-package-fu slime-references slime-scratch slime-presentations
slime-fuzzy slime-fancy-inspector slime-c-p-c slime-editing-commands
slime-autodoc advice advice-preload slime-parse slime-repl slime
byte-opt bytecomp byte-compile cconv macroexp derived apropos help-fns
edmacro kmacro easy-mmode hideshow easymenu pp comint regexp-opt
ansi-color ring hyperspec thingatpt browse-url cl time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)