Subject: Emacs 25.0.94: Info-read-node-name fails outside of Info buffers; patch to fix included

From: Robert Weiner <[email-masked]>
Date: Mon, 27 Jun 2016 16:04:15 -0400

Info-read-node-name is useful even when the current buffer is not an
Info buffer because it can be used to specify a file from which to read
Info node name completions, e.g. if you want to produce a link within an
Emacs Lisp file to a specific Info node.

Unfortunately, when this function is called outside of an Info buffer,
it produces an error when it calls `Info-build-node-completions' and
that calls `Info-build-node-completions-1' which fails to produce any
completions.  By wrapping that last call in a condition-case to catch
the error, the problem is solved and Info-read-node-name works properly
in any buffer.  At first, it will report there are no completions, then
when you specify an Info file, it will complete for that file as
desired.  For example, try the unpatched and then the patched code
in an Emacs Lisp buffer, evaluating this expression:

(Info-read-node-name "(File)Node: ")

The patch is included below.

Bob
--------

*** info-orig.el.gz 2016-06-27 15:57:29.000000000 -0400
--- info.el.gz 2016-06-27 15:57:29.000000000 -0400
***************
*** 1882,1888 ****
     (push (cons filename Info-current-file-completions)
Info-file-completions)
     Info-current-file-completions))
      (or Info-current-file-completions
! (Info-build-node-completions-1))))

  (defun Info-build-node-completions-1 ()
    (let ((compl nil)
--- 1882,1890 ----
     (push (cons filename Info-current-file-completions)
Info-file-completions)
     Info-current-file-completions))
      (or Info-current-file-completions
! (condition-case nil
!    (Info-build-node-completions-1)
!  (error nil)))))

  (defun Info-build-node-completions-1 ()
    (let ((compl nil)