From: Gavin Smith <gavinsmith0123@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 34023@debbugs.gnu.org, bug-texinfo@gnu.org
Subject: bug#34023: Support double colons in Info index entries
Date: Fri, 11 Jan 2019 19:46:32 +0000 [thread overview]
Message-ID: <20190111194631.GA14925__17176.7931002707$1547236388$gmane$org@darkstar> (raw)
In-Reply-To: <875zuwys8f.fsf@mail.linkov.net>
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)
next prev parent reply other threads:[~2019-01-11 19:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-09 21:14 Support double colons in Info index entries Gavin Smith
2019-01-11 0:04 ` bug#34023: " Juri Linkov
2019-01-11 0:28 ` Drew Adams
2019-01-11 19:46 ` Gavin Smith [this message]
[not found] ` <20190111194631.GA14925@darkstar>
2019-01-11 19:49 ` Gavin Smith
2019-01-13 0:55 ` Juri Linkov
2019-01-11 0:53 ` Glenn Morris
2019-01-11 20:13 ` Gavin Smith
2019-01-11 20:14 ` Gavin Smith
2019-01-11 20:32 ` Glenn Morris
[not found] ` <hek1jbkk9o.fsf@fencepost.gnu.org>
2019-01-16 19:17 ` Gavin Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='20190111194631.GA14925__17176.7931002707$1547236388$gmane$org@darkstar' \
--to=gavinsmith0123@gmail.com \
--cc=34023@debbugs.gnu.org \
--cc=bug-texinfo@gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.