[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colons in indices

From: Jan Nieuwenhuizen
Subject: Re: Colons in indices
Date: 04 May 2001 11:46:12 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/20.7

address@hidden writes:

>     Any ideas how to allow colons in menu items are welcome.
> In the general case, I think info readers (and generators) would have to
> use something other than : as the separator in references, otherwise it
> seems ambiguous.  True, you could heuristically guess depending on
> whether one parsing leads to valid node names and the other doesn't, but
> that seems yucky.

Yes, maybe it is.  I haven't really looked into this, as LilyPond
currently apparently doesn't use colons in node names, but only in
index entries, generated by the @defun command.

It seems that those can be handled fairly easily by adding the below
to your .emacs.  We'll have to look into colons in node names before
sending a patch to info.el, I guess.

What do you think?  Not using colons in node-names would be fine with
me, as long as they can be used in the index?


;; New entries allow for colons, but need whitespace (or punctuation)
;; after the last colon.  The -legacy are needed entries that
;; are followed immediately by text.

(setq Info-reference-start-re "\\*note[ \n]")
(setq Info-reference-re "\\*note[ \n]\\(.*\\):[ \n,.]")
(setq Info-reference-legacy-re "\\*note[ \n]\\([^:]*\\):")
(setq Info-entry-start-re "\\* +")
(setq Info-index-entry-re "\\* +\\(.*[^:]\\):[ \t]")
(setq Info-index-entry-legacy-re "\\* +\\([^:]*\\):")
(setq Info-menu-entry-legacy-re "\\* +\\([^:]*\\)::")

(defun Info-try-follow-nearest-node ()
  "Follow a node reference near point.  Return non-nil if successful."
  (let (node)
     ;; Note with trailing space or punctuation; node may have embedded
     ;; colons: `*note NODE::Name::,' 
     ((setq node (Info-get-token (point)
      (Info-follow-reference node))
     ;; Note without trailing punctuation or space, but without embedded
     ;; colons: `*note NODE-NAME:'
     ((setq node (Info-get-token (point) Info-reference-start-re
      (Info-follow-reference node))
     ;; Index entry with possibly embedded colons: `* NODE::NAME: '
     ((setq entry (Info-get-token (point) Info-entry-start-re
      (forward-char (- (string-width entry) 1))
      (setq node (Info-extract-menu-node-name))
      (Info-goto-node node))
     ;; Menu entry: `* NODE-NAME::'
     ((setq node (Info-get-token (point) Info-entry-start-re
      (Info-goto-node node))
     ;; Index without trailing space, but without embedded colons:
     ;; `* NODE-NAME:immediate text'
     ((Info-get-token (point) Info-entry-start-re
      (forward-char 2)
      (setq node (Info-extract-menu-node-name))
      (Info-goto-node node))
     ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
      (Info-goto-node node))
     ((setq node (Info-get-token (point) "Next: " "Next: \\([^,\n\t]*\\)"))
      (Info-goto-node node))
     ((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)"))
      (Info-goto-node "Top"))
     ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)"))
      (Info-goto-node node)))

Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter       |

reply via email to

[Prev in Thread] Current Thread [Next in Thread]