Didier Verna <didier(a)epita.fr> writes:
I wrote:
> it seems that these changes have completely broken the completion mecanism
> for me. The symptom is:
Actually, it has not. This is only true at the top level. Perhaps the
completion mechanism could also parse the menus ?
Yes, we can add dir file handling to
Info-build-node-completions.
My usual usage is
C-h i g xe TAB
[No match]
??? What? Oh, yes.
C-g m xe TAB RET :-)
This patch makes completion available for `g'.
Most of this patch is indentation change from `if'.
2000-01-14 Yoshiki Hayashi <t90553(a)mail.ecc.u-tokyo.ac.jp>
* info.el (Info-build-node-completions): Search menu
when in dir.
Index: info.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/info.el,v
retrieving revision 1.15.2.11
diff -u -r1.15.2.11 info.el
--- info.el 2000/01/14 00:11:21 1.15.2.11
+++ info.el 2000/01/14 08:47:12
@@ -1562,29 +1562,43 @@
(defun Info-build-node-completions ()
(or Info-current-file-completions
(let ((compl (Info-build-annotation-completions)))
- (save-excursion
- (save-restriction
- (widen)
- (if (marker-buffer Info-tag-table-marker)
- (progn
- (set-buffer (marker-buffer Info-tag-table-marker))
- (goto-char Info-tag-table-marker)
- (while (re-search-forward "\nNode: \\(.*\\)\177" nil t)
- (setq compl
- (cons (list (buffer-substring (match-beginning 1)
- (match-end 1)))
- compl))))
+ (if (string= (file-name-nondirectory (buffer-file-name))
+ "dir")
+ ;; When this is dir file, search this buffer.
+ (save-excursion
(goto-char (point-min))
- (while (search-forward "\n\^_" nil t)
- (forward-line 1)
- (let ((beg (point)))
- (forward-line 1)
- (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]"
- beg t)
- (setq compl
+ (let ((case-fold-search t))
+ (if (not (search-forward "\n* menu:" nil t))
+ (error "No menu in dir")))
+ (while (re-search-forward
+ "\n\\* \\([^:\t\n]*\\):" nil t)
+ (setq compl (cons (list (buffer-substring
+ (match-beginning 1)
+ (match-end 1)))
+ compl))))
+ (save-excursion
+ (save-restriction
+ (widen)
+ (if (marker-buffer Info-tag-table-marker)
+ (progn
+ (set-buffer (marker-buffer Info-tag-table-marker))
+ (goto-char Info-tag-table-marker)
+ (while (re-search-forward "\nNode: \\(.*\\)\177" nil t)
+ (setq compl
(cons (list (buffer-substring (match-beginning 1)
(match-end 1)))
- compl))))))))
+ compl))))
+ (goto-char (point-min))
+ (while (search-forward "\n\^_" nil t)
+ (forward-line 1)
+ (let ((beg (point)))
+ (forward-line 1)
+ (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]"
+ beg t)
+ (setq compl
+ (cons (list (buffer-substring (match-beginning 1)
+ (match-end 1)))
+ compl)))))))))
(setq Info-current-file-completions compl))))
(defvar Info-last-search nil
--
Yoshiki Hayashi