summaryrefslogtreecommitdiff
path: root/lisp/info.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-08-05 20:56:23 +0000
committerRichard M. Stallman <rms@gnu.org>1995-08-05 20:56:23 +0000
commit195974c29b4dbfe9baf09ee7bb649b9e5fbf55ef (patch)
treeb31fc568e728774b6411cefd9e649aca33468721 /lisp/info.el
parent722fa354450d694ccb3092db93c691f4128d7b55 (diff)
downloademacs-195974c29b4dbfe9baf09ee7bb649b9e5fbf55ef.tar.gz
(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).
Diffstat (limited to 'lisp/info.el')
-rw-r--r--lisp/info.el21
1 files changed, 20 insertions, 1 deletions
diff --git a/lisp/info.el b/lisp/info.el
index fd08a00e25e..6c079f9fc99 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -605,9 +605,28 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(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))