[Top][All Lists]

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

Re: Info-index fails on node-name "~/.cvsrc"

From: Juri Linkov
Subject: Re: Info-index fails on node-name "~/.cvsrc"
Date: Sun, 25 Apr 2004 07:35:57 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

>     One possible solution is to extract node names up to the final period
>     ignoring all intermediate periods, e.g.
>     * J. Random Hacker:        J. Random Hacker.      (line  2)
>                                ----------------
>     with the assumption that no index entries have more text after the node
>     name (except the line number in the new Info format).
> That seems to me like it will work for the specific case of index
> entries.  Since we control index entry generation, we know for a fact
> there is no descriptive text on the index line that contains a period.
> So if you'd like to implement that change, it seems beneficial.
> Is it feasible to change just index entry parsing, without changing menu
> entry parsing?

Yes, it is feasible as well as desirable.  The following patch does it.

By the way, I implemented a related feature introduced by the latest
version of Texinfo: using the line numbers (line NNN) for locating
index entries (but it is not included in the following patch).

Index: lisp/info.el
RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
retrieving revision 1.390
diff -u -r1.390 info.el
--- lisp/info.el        22 Apr 2004 19:49:11 -0000      1.390
+++ lisp/info.el        25 Apr 2004 04:06:44 -0000
@@ -1858,11 +1872,27 @@
 Because of ambiguities, this should be concatenated with something like
 `:' and `Info-following-node-name-re'.")
-(defun Info-extract-menu-node-name (&optional multi-line)
+(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 ":\\(:\\|"
-                            (if multi-line "^.,\t" "^.,\t\n")) "\\)"))
+                             (cond
+                              (index-node "^,\t\n")
+                              (multi-line "^.,\t")
+                              (t          "^.,\t\n")))
+                            "\\)"
+                            (if index-node "\\." "")))
      "[ \n]+" " "
      (or (match-string 2)
@@ -2327,7 +2357,7 @@
   (if (equal Info-current-file "dir")
       (error "The Info directory node has no index; use m to select a manual"))
   (let ((orignode Info-current-node)
-       (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.\n]*\\)\\.[ 
+       (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ 
\t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
                         (regexp-quote topic)))
        (case-fold-search t))
@@ -2418,7 +2448,7 @@
 Build a menu of the possible matches."
   (interactive "sIndex apropos: ")
   (unless (string= string "")
-    (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^.]+\\)."
+    (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]+\\)\\."
                           (regexp-quote string)))
          (ohist Info-history)
          (ohist-list Info-history-list)
@@ -2583,21 +2616,16 @@
      ;; menu item: node name
      ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::"))
       (Info-goto-node node fork))
-     ;; menu item: index entry
+     ;; menu item: node name or index entry
      ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ")
       (forward-char 2)
-      (setq node (Info-extract-menu-node-name))
+      (setq node (Info-extract-menu-node-name
+                  nil (string-match "\\<index\\>" Info-current-node)))
       (Info-goto-node node fork))
      ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
       (Info-goto-node node fork))

Juri Linkov

reply via email to

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