changeset 45014:a590e8ab89d0

(Info-find-in-tag-table-1, Info-read-subfile): Use point-min. (Info-read-node-name-1): Complete file names. (Info-complete-menu-item): Don't cons unnecessarily.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 30 Apr 2002 02:08:56 +0000
parents 564222cd2e88
children 76f3260fb45e
files lisp/info.el
diffstat 1 files changed, 32 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/info.el	Tue Apr 30 01:59:00 2002 +0000
+++ b/lisp/info.el	Tue Apr 30 02:08:56 2002 +0000
@@ -539,7 +539,7 @@
       (beginning-of-line)
       (when (re-search-forward regexp nil t)
 	(list (string-equal "Ref:" (match-string 1))
-	      (1+ (read (current-buffer)))
+	      (+ (point-min) (read (current-buffer)))
 	      major-mode)))))
 
 (defun Info-find-in-tag-table (marker regexp)
@@ -929,7 +929,7 @@
 			thisfilepos thisfilename)
 		    (search-forward ": ")
 		    (setq thisfilename  (buffer-substring beg (- (point) 2)))
-		    (setq thisfilepos (read (current-buffer)))
+		    (setq thisfilepos (+ (point-min) (read (current-buffer))))
 		    ;; read in version 19 stops at the end of number.
 		    ;; Advance to the next line.
 		    (forward-line 1)
@@ -1074,19 +1074,35 @@
 ;; It does completion using the alist in Info-read-node-completion-table
 ;; unless STRING starts with an open-paren.
 (defun Info-read-node-name-1 (string predicate code)
-  (let ((no-completion (and (> (length string) 0) (eq (aref string 0) ?\())))
-    (cond ((eq code nil)
-	   (if no-completion
-	       string
-	     (try-completion string Info-read-node-completion-table predicate)))
-	  ((eq code t)
-	   (if no-completion
-	       nil
-	     (all-completions string Info-read-node-completion-table predicate)))
-	  ((eq code 'lambda)
-	   (if no-completion
-	       t
-	     (assoc string Info-read-node-completion-table))))))
+  (cond
+   ;; First complete embedded file names.
+   ((string-match "\\`([^)]*\\'" string)
+    (let ((file (substring string 1)))
+      (cond
+       ((eq code nil)
+	(let ((comp (try-completion file 'locate-file-completion
+				    (cons Info-directory-list
+					  (mapcar 'car Info-suffix-list)))))
+	  (cond
+	   ((eq comp t) (concat string ")"))
+	   (comp (concat "(" comp)))))
+       ((eq code t) (all-completions file 'locate-file-completion
+				     (cons Info-directory-list
+					   (mapcar 'car Info-suffix-list))))
+       (t nil))))
+   ;; 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)))
+   ;; Otherwise use Info-read-node-completion-table.
+   ((eq code nil)
+    (try-completion string Info-read-node-completion-table predicate))
+   ((eq code t)
+    (all-completions string Info-read-node-completion-table predicate))
+   (t
+    (test-completion string Info-read-node-completion-table predicate))))
 
 (defun Info-read-node-name (prompt &optional default)
   (let* ((completion-ignore-case t)
@@ -1443,8 +1459,7 @@
 	    (while
 		(progn
 		  (while (re-search-forward pattern nil t)
-		    (push (cons (match-string-no-properties 1)
-				(match-beginning 1))
+		    (push (match-string-no-properties 1)
 			  completions))
 		  ;; Check subsequent nodes if applicable.
 		  (and Info-complete-next-re