Function: Info-read-node-name-1

Info-read-node-name-1 is a byte-compiled function defined in info.el.gz.

Signature

(Info-read-node-name-1 STRING PREDICATE CODE)

Documentation

Internal function used by Info-read-node-name.

See completing-read for a description of arguments and usage.

Source Code

;; Defined in /usr/src/emacs/lisp/info.el.gz
(defun Info-read-node-name-1 (string predicate code)
  "Internal function used by `Info-read-node-name'.
See `completing-read' for a description of arguments and usage."
  (cond
   ;; First complete embedded file names.
   ((string-match "\\`([^)]*\\'" string)
    (completion-table-with-context
     "("
     (apply-partially #'completion-table-with-terminator ")"
                      (apply-partially #'Info-read-node-name-2
                                       Info-directory-list
                                       (mapcar #'car Info-suffix-list)))
     (substring string 1)
     predicate
     code))
   ;; If a file name was given, complete nodes in the file.
   ((string-match "\\`(\\([^)]+\\))" string)
    (let ((file0 (match-string 0 string))
	  (file1 (match-string 1 string))
	  (nodename (substring string (match-end 0))))
      (if (and (equal nodename "") (eq code 'lambda))
	  ;; Empty node name is permitted that means "Top".
	  t
	(completion-table-with-context
	 file0
         (lambda (string pred action)
           (complete-with-action
            action
            (when-let* ((file2 (Info-find-file file1 'noerror t)))
              (Info-build-node-completions file2))
            string pred))
	 nodename predicate code))))
   ;; Otherwise use Info-read-node-completion-table.
   (t (complete-with-action
       code Info-read-node-completion-table string predicate))))