[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Support double colons in Info index entries
From: |
Gavin Smith |
Subject: |
Support double colons in Info index entries |
Date: |
Wed, 9 Jan 2019 21:14:33 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Emacs version checked: 26.1.
In the Info format colons are special, and for this reason, there is
limited support for colons in index entries. The Emacs Info mode
supports single colons in index entries as long as they are not followed
by a space.
There is this comment at the start of info.el:
;; Note that nowadays we expect Info files to be made using makeinfo.
;; In particular we make these assumptions:
;; - a menu item MAY contain colons but not colon-space ": "
;; - a menu item ending with ": " (but not ":: ") is an index entry
;; - a node name MAY NOT contain a colon
;; This distinction is to support indexing of computer programming
;; language terms that may contain ":" but not ": ".
It doesn't state it, but when I tested it double colons don't work even
if they are not followed by a space.
There is a fairly simple solution to this problem that I haven't seen
suggested in all the messages posted on this topic in the mailing list
archives. In index nodes only (which have a special marker included,
address@hidden@^H]), use a colon to terminate the text of the index entry,
but instead of looking for the first colon in the line, look for the
last. So this entry:
* a::b: a colon b. (line 129)
would refer to line 129 of the node "a colon b". This is possible
because node names cannot contain colons. This restriction is not too
important, whereas the inability to index items containing colons is
quite important. This is what is implemented in the standalone info
browser (since change on 2017-04-08).
This change shouldn't be made for all nodes, because the comment after
the closing '.' could contain a colon:
* label: node. comment: with a colon.
This shouldn't be interpreted as refering to a node "with a colon".
However, the "(line ...)" comment can't contain a colon.
I'm not familiar with Emacs Lisp enough to propose a patch to implement
this change myself.
The standalone info program also implemented a quoting mechanism
(surrounding the text with a pair of 0x7F bytes) to allow nearly all
characters to be included in node names and index entries. This has
never been implemented in Emacs Info and has never been used by default
in texi2any's output. I think my suggestion above would be sufficient
and would work with existing Info files and versions of
texi2any/makeinfo without anything breaking. The quoting mechanism could
potentially be removed from texi2any and info as nobody has ever used it
and it makes things more complicated for no reason.
- Support double colons in Info index entries,
Gavin Smith <=