all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23857: Emacs 25.0.94: Info-read-node-name fails outside of Info buffers; patch to fix included
@ 2016-06-27 20:04 Robert Weiner
  2019-06-25 12:22 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Weiner @ 2016-06-27 20:04 UTC (permalink / raw)
  To: 23857

[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]

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)

[-- Attachment #2: Type: text/html, Size: 5991 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#23857: Emacs 25.0.94: Info-read-node-name fails outside of Info buffers; patch to fix included
  2016-06-27 20:04 bug#23857: Emacs 25.0.94: Info-read-node-name fails outside of Info buffers; patch to fix included Robert Weiner
@ 2019-06-25 12:22 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 12:22 UTC (permalink / raw)
  To: Robert Weiner; +Cc: 23857, rswgnu

Robert Weiner <rsw@gnu.org> writes:

> 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.

(Info-read-node-name "(File)Node: ")
=> "Top	This is the top of the INFO tree"

It seems like a very mode-specific function to me...

[...]

> ! (condition-case nil
> !    (Info-build-node-completions-1)
> !  (error nil)))))

And just catching all errors isn't a good way to solve these things,
because it may be covering up other errors we want to catch.

Given both these things, I don't think this is a good idea, and I'm
closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-25 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-27 20:04 bug#23857: Emacs 25.0.94: Info-read-node-name fails outside of Info buffers; patch to fix included Robert Weiner
2019-06-25 12:22 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.