+(defun Info-read-node-name-2 (string path-and-suffixes action)
+ "Virtual completion table for file names input in Info node names.
+PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
+ (let* ((names nil)
+ (suffixes (remove "" (cdr path-and-suffixes)))
+ (suffix (concat (regexp-opt suffixes t) "\\'"))
+ (string-dir (file-name-directory string))
+ (dirs
+ (if (file-name-absolute-p string)
+ (list (file-name-directory string))
+ (car path-and-suffixes))))
+ (dolist (dir dirs)
+ (unless dir
+ (setq dir default-directory))
+ (if string-dir (setq dir (expand-file-name string-dir dir)))
+ (when (file-directory-p dir)
+ (dolist (file (file-name-all-completions
+ (file-name-nondirectory string) dir))
+ ;; If the file name has no suffix or a standard suffix,
+ ;; include it.
+ (and (or (null (file-name-extension file))
+ (string-match suffix file))
+ ;; But exclude subfiles of split Info files.
+ (not (string-match "-[0-9]+\\'" file))
+ ;; And exclude backup files.
+ (not (string-match "~\\'" file))
+ (push (if string-dir (concat string-dir file) file) names))
+ ;; If the file name ends in a standard suffix,
+ ;; add the unsuffixed name as a completion option.
+ (when (string-match suffix file)
+ (setq file (substring file 0 (match-beginning 0)))
+ (push (if string-dir (concat string-dir file) file) names)))))
+ (cond
+ ((eq action t) (all-completions string names))
+ ((null action) (try-completion string names))
+ (t (test-completion string names)))))
+