From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs,gmane.comp.tex.texinfo.bugs Subject: bug#34023: Support double colons in Info index entries Date: Fri, 11 Jan 2019 02:04:32 +0200 Organization: LINKOV.NET Message-ID: <875zuwys8f.fsf@mail.linkov.net> References: <20190109211433.GB1481@darkstar> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1547165285 16290 195.159.176.226 (11 Jan 2019 00:08:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2019 00:08:05 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 34023@debbugs.gnu.org, bug-texinfo@gnu.org To: Gavin Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 11 01:08:01 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghkMi-00044O-Pr for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Jan 2019 01:08:01 +0100 Original-Received: from localhost ([127.0.0.1]:57118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghkOp-0008Rd-Bz for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jan 2019 19:10:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghkOj-0008RY-2L for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 19:10:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghkOh-0004ch-7r for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 19:10:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghkOg-0004cV-Pb for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 19:10:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ghkOg-0000vZ-FZ for bug-gnu-emacs@gnu.org; Thu, 10 Jan 2019 19:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Jan 2019 00:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34023 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 34023-submit@debbugs.gnu.org id=B34023.15471653593504 (code B ref 34023); Fri, 11 Jan 2019 00:10:02 +0000 Original-Received: (at 34023) by debbugs.gnu.org; 11 Jan 2019 00:09:19 +0000 Original-Received: from localhost ([127.0.0.1]:54403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghkNz-0000uS-3q for submit@debbugs.gnu.org; Thu, 10 Jan 2019 19:09:19 -0500 Original-Received: from eastern.maple.relay.mailchannels.net ([23.83.214.55]:45069) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghkNw-0000uI-Bp for 34023@debbugs.gnu.org; Thu, 10 Jan 2019 19:09:17 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 327D55E3701; Fri, 11 Jan 2019 00:09:14 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (unknown [100.96.30.62]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id CCA295E3CD3; Fri, 11 Jan 2019 00:09:13 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Fri, 11 Jan 2019 00:09:14 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Squirrel-Drop: 1c1a92af30d192a7_1547165354068_1835466942 X-MC-Loop-Signature: 1547165354068:3530202630 X-MC-Ingress-Time: 1547165354067 Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTP id 56C3C80380; Thu, 10 Jan 2019 16:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=h7b4195aUSfH6Q84HoEDGPQ/kSE=; b= ydhfOoDxTBN3OQkR91fFpQXvOpUPBdrmr6iw8H7bo/XHjvfDyRh20lZVvwXuvMtt lWD1hlvKTorMwOhcLhgnslbhyv9PUy7WV1bVdeFPrmhTAhSwoi/AjGKmKZVc7FPT W1riiEMSlnLxMAlDSDxQ5SCc1l0S1mtXqJUvgLC8dVU= Original-Received: from mail.jurta.org (m91-129-101-91.cust.tele2.ee [91.129.101.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTPSA id 91D5E803E1; Thu, 10 Jan 2019 16:08:56 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a54 In-Reply-To: <20190109211433.GB1481@darkstar> (Gavin Smith's message of "Wed, 9 Jan 2019 21:14:33 +0000") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtledrfeeggddujecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtuddrledunecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtuddrledupdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepifgrvhhinhfumhhithhhtdduvdefsehgmhgrihhlrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154328 gmane.comp.tex.texinfo.bugs:9544 Archived-At: --=-=-= Content-Type: text/plain Hi Gavin, > 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. Thanks for the detailed description. > 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, > ^@^H[index^@^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). The following patch handles the cases that you presented, but it's hard to predict what other cases it might break. Do you have a sample test file that covers different cases? We could add such file to Emacs regression tests. > 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. The following change is made only for index nodes. I have to say that the current regexp-based parsing is an inherently fragile approach. Do you think it would be possible to add more markup to Info files instead of relying on regexps? Like index nodes having a special marker ^@^H[index^@^H] maybe adding some markers to identify index entries, node references, line numbers? Better yet would be to read Info manual in HTML format in Info reader. That would allow extracting all information unambiguously. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=info.el.support-double-colons-in-Info-index-entries.patch diff --git a/lisp/info.el b/lisp/info.el index 6038273c37..2f7e293297 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -2664,9 +2664,15 @@ Info-menu-entry-name-re Because of ambiguities, this should be concatenated with something like `:' and `Info-following-node-name-re'.") +(defconst Info-index-entry-name-re "\\(?:[^:]\\|:[^,.;() \t\n]\\)*" + "Regexp that matches an index entry name possibly including a colon.") + (defun Info-extract-menu-node-name (&optional multi-line index-node) (skip-chars-forward " \t\n") - (when (looking-at (concat Info-menu-entry-name-re ":\\(:\\|" + (when (looking-at (concat (if index-node + Info-index-entry-name-re + Info-menu-entry-name-re + ) ":\\(:\\|" (Info-following-node-name-re (cond (index-node "^,\t\n") @@ -2741,7 +2747,9 @@ Info-complete-menu-item (t (let ((pattern (concat "\n\\* +\\(" (regexp-quote string) - Info-menu-entry-name-re "\\):" + (if (Info-index-node) + Info-index-entry-name-re + Info-menu-entry-name-re) "\\):" Info-node-spec-re)) completions (complete-nodes Info-complete-nodes)) @@ -3966,7 +3974,8 @@ Info-try-follow-nearest-node (setq node t)) (setq node nil)))) ;; menu item: node name - ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::")) + ((setq node (unless (Info-index-node) + (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::"))) (Info-goto-node node fork)) ;; menu item: node name or index entry ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ") @@ -4929,7 +4938,9 @@ Info-fontify-node (let ((n 0) cont) (while (re-search-forward - (concat "^\\* Menu:\\|\\(?:^\\* +\\(" Info-menu-entry-name-re "\\)\\(:" + (concat "^\\* Menu:\\|\\(?:^\\* +\\(" (if (Info-index-node) + Info-index-entry-name-re + Info-menu-entry-name-re) "\\)\\(:" Info-node-spec-re "\\([ \t]*\\)\\)\\)") nil t) (when (match-beginning 1) --=-=-=--