changeset 12779:5b3d83e51b91

(Info-read-node-name-1): New function. (Info-read-node-name): Use Info-read-node-name-1 to avoid getting confused by spaces when text starts with (FILENAME).
author Richard M. Stallman <rms@gnu.org>
date Sat, 05 Aug 1995 20:56:23 +0000
parents 657be7aaa043
children 2c1f71512d5d
files lisp/info.el
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/info.el	Sat Aug 05 20:21:06 1995 +0000
+++ b/lisp/info.el	Sat Aug 05 20:56:23 1995 +0000
@@ -605,9 +605,28 @@
     (Info-find-node (if (equal filename "") nil filename)
 		    (if (equal nodename "") "Top" nodename))))
 
+;; This function is used as the "completion table" while reading a node name.
+;; It does completion using the alist in 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 completion-table predicate)))
+	  ((eq code t)
+	   (if no-completion
+	       nil
+	     (all-completions string completion-table predicate)))
+	  ((eq code 'lambda)
+	   (if no-completion
+	       t
+	     (assoc string completion-table))))))
+
 (defun Info-read-node-name (prompt &optional default)
   (let* ((completion-ignore-case t)
-	 (nodename (completing-read prompt (Info-build-node-completions))))
+	 (completion-table (Info-build-node-completions))
+	 (nodename (completing-read prompt 'Info-read-node-name-1)))
     (if (equal nodename "")
 	(or default
 	    (Info-read-node-name prompt))