bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)


From: Juri Linkov
Subject: bug#12456: 24.2.50; Completion in `Info-goto-node' (cross-manual jump)
Date: Tue, 18 Sep 2012 23:03:21 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu)

>> * "(elisp)<TAB>" completes to all nodes in the elisp manual.
>
> Yes, that's the part that's not yet implemented.  Patch welcome,

This can be implemented by this patch.  The remaining problem is
that it's too slow because it doesn't cache completions of non-current
manuals.  Perhaps `Info-build-node-completions' should use `Info-toc-nodes'
that caches node names from all visited manuals.

=== modified file 'lisp/info.el'
--- lisp/info.el        2012-09-13 22:01:45 +0000
+++ lisp/info.el        2012-09-18 20:02:43 +0000
@@ -1778,12 +1778,23 @@ (defun Info-read-node-name-1 (string pre
      (substring string 1)
      predicate
      code))
-   ;; If a file name was given, then any node is fair game.
-   ((string-match "\\`(" string)
-    (cond
-     ((eq code nil) string)
-     ((eq code t) nil)
-     (t t)))
+   ;; If a file name was given, complete nodes in the file.
+   ((string-match "\\`([^)]+)" string)
+    (let ((file (match-string 0 string))
+          (node (substring string (match-end 0))))
+      (completion-table-with-context
+       file
+       (apply-partially
+        (lambda (string pred action)
+          (complete-with-action
+           action
+           (with-temp-buffer
+             (Info-mode)
+             (Info-goto-node (concat file "Top"))
+             (Info-build-node-completions)
+             Info-current-file-completions)
+           string pred)))
+       node predicate code)))
    ;; Otherwise use Info-read-node-completion-table.
    (t (complete-with-action
        code Info-read-node-completion-table string predicate))))






reply via email to

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