From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gavin Smith Newsgroups: gmane.emacs.bugs Subject: bug#34023: Support double colons in Info index entries Date: Fri, 11 Jan 2019 19:46:32 +0000 Message-ID: <20190111194631.GA14925__17176.7931002707$1547236388$gmane$org@darkstar> References: <20190109211433.GB1481@darkstar> <875zuwys8f.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1547236388 4007 195.159.176.226 (11 Jan 2019 19:53:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2019 19:53:08 +0000 (UTC) User-Agent: Mutt/1.5.23 (2014-03-12) Cc: 34023@debbugs.gnu.org, bug-texinfo@gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 11 20:53:03 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 1gi2rW-0000tA-1K for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Jan 2019 20:53:02 +0100 Original-Received: from localhost ([127.0.0.1]:37978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gi2td-0003iw-35 for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Jan 2019 14:55:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gi2rY-00027R-R5 for bug-gnu-emacs@gnu.org; Fri, 11 Jan 2019 14:53:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gi2rX-000186-RI for bug-gnu-emacs@gnu.org; Fri, 11 Jan 2019 14:53:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57065) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gi2rX-00015k-Hz for bug-gnu-emacs@gnu.org; Fri, 11 Jan 2019 14:53:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gi2rW-0008VH-Ey for bug-gnu-emacs@gnu.org; Fri, 11 Jan 2019 14:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gavin Smith Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Jan 2019 19:53: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.154723636432658 (code B ref 34023); Fri, 11 Jan 2019 19:53:02 +0000 Original-Received: (at 34023) by debbugs.gnu.org; 11 Jan 2019 19:52:44 +0000 Original-Received: from localhost ([127.0.0.1]:56346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gi2rD-0008Ug-EN for submit@debbugs.gnu.org; Fri, 11 Jan 2019 14:52:43 -0500 Original-Received: from mail-wr1-f44.google.com ([209.85.221.44]:38657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gi2rB-0008UR-4i for 34023@debbugs.gnu.org; Fri, 11 Jan 2019 14:52:41 -0500 Original-Received: by mail-wr1-f44.google.com with SMTP id v13so16450568wrw.5 for <34023@debbugs.gnu.org>; Fri, 11 Jan 2019 11:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Ok+tHfP29Ku0nbnnLXuxiFaTRyEV5qFu8awKEwJunzA=; b=tBYjuLYl/aILpB325br94EsdvsAN4/mk7dMmcQWdM2zOLL923r0aLrzf1Tlwsux7/n MCUFtRK9R3UfOYeKovC4xAxYMi2O6ZvpNgziTiZ83vjkbpkdMbRZvb7dKymGg8lai+zx 7YoOj2rdfWw75yJP/6ONBRuz65UB8IYoorlaYqP53pBGfux44FIpkM7eGl1ziJf/b4xv l8LTlKgskaiVFKNXbv+Cm5uj3ykY/mpiiVSARVOGlsXISaoDgcMCPtk7r/rKzlehfqmO z62w2ebcJ0tJnPejUapihYIrCNqS+r23AW9BhLNwlBYBtE18hc8WQGZ+o1MPPXPiN2Oo sDgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=Ok+tHfP29Ku0nbnnLXuxiFaTRyEV5qFu8awKEwJunzA=; b=d5iGo2TNMlIuoEnbASay2wAMlxZ07FW9dEUXMcwIBGXqmjhXvzg9P1pO7t8Bb+d6et xb+yuLE2nzSW7SSqKA4vzGXSPUcoksa+zk2iSbiXI9fTfCfW+P/iQK4iajQVrw4iKbO4 KFiQAe2L27BhtnWbAFanzc7Ndlulm1PxI2otoNXdxO5mHIqDpt6fa9vaZAiVIHsOwbzv CLGu127fECIehwM8v+CEjWV4WDMNQRF00XuIvUTjcv47c9JIXt0A6vu8zfRqJeMfR2+C EyyOMXUu6AFbiibgkGok0kCz4OPG3+avoEx42HZFxjhmOkY0URGjM33+1WhiFvahBxIz eomw== X-Gm-Message-State: AJcUukdF1cDAFTyo7I+tOsyqnb94m+cRwdrfggbdBTkvCb/LssnnVH/B B4Cyh9ZaZGh7e70nrrPby2Qp2l+6 X-Google-Smtp-Source: ALg8bN5AW1dlP2RmTeD55brZsSK+mmbv8Y+MK87nDasW/U59Sa2zVi1IgVsghWsZCNmUdo+BrbkXiQ== X-Received: by 2002:adf:aa9c:: with SMTP id h28mr14699955wrc.216.1547236355076; Fri, 11 Jan 2019 11:52:35 -0800 (PST) Original-Received: from darkstar.example.net (55.37.198.146.dyn.plus.net. [146.198.37.55]) by smtp.gmail.com with ESMTPSA id y34sm178169078wrd.68.2019.01.11.11.52.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 11:52:34 -0800 (PST) X-Google-Original-From: Gavin Smith Original-Received: from darkstar.example.net (localhost [127.0.0.1]) by darkstar.example.net (8.14.9/8.14.9) with ESMTP id x0BJsERd028736; Fri, 11 Jan 2019 19:54:14 GMT Original-Received: (from g@localhost) by darkstar.example.net (8.14.9/8.14.9/Submit) id x0BJkWgg025900; Fri, 11 Jan 2019 19:46:32 GMT Mail-Followup-To: Gavin Smith , Juri Linkov , 34023@debbugs.gnu.org, bug-texinfo@gnu.org Content-Disposition: inline In-Reply-To: <875zuwys8f.fsf@mail.linkov.net> 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:154357 Archived-At: On Fri, Jan 11, 2019 at 02:04:32AM +0200, Juri Linkov wrote: > 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. I've attached a file that includes different possibilities. > 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? I don't understand. Whatever markup is added has to be read somehow, with regexp or other. > Better yet would be to read Info manual in HTML format in Info reader. > That would allow extracting all information unambiguously. That would be a different project with several unresolved questions; this could be the way forward in the long term. I would be opposed to making the standalone info program read HTML as this would be a complete rewrite of the program and there are probably better ways of dealing with it. > 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)