bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#397: 23.0.60; T in Info when in (dir)


From: Drew Adams
Subject: bug#397: 23.0.60; T in Info when in (dir)
Date: Wed, 27 Apr 2016 10:46:38 -0700 (PDT)

> Basically, Info calls
> (Info-find-node "dir" "*TOC*")
> which then fails.  Looking at that code, it's quite long and convoluted,
> and calling that just to gray out the menu item is probably not a good
> idea.  Does anybody know of a quick shortcut to determine whether the
> TOC isn't available?  I'm quite unfamiliar with the Info code.

`Info-toc' should raise an error immediately, if the current node
is the top.  Something like this, perhaps:

(defun Info-toc ()
  "@@@@@@@@@"
  (interactive)
  (when (equal Info-current-file "dir") (error "@@@@@@@@@@@@@@@@@"))
  (Info-find-node Info-current-file "*TOC*")
  (let ((prev-node (nth 1 (car Info-history))) p)
    (goto-char (point-min))
    (if (setq p (search-forward (concat "*Note " prev-node ":") nil t))
        (setq p (- p (length prev-node) 2)))
    (goto-char (or p (point-min)))))

But you might need to worry about different versions of "dir", such
as is done in function `Info-insert-dir'.  Dunno.  I took only a
quick look.  Maybe you also need to check for the node name being
"top", as in `Info-directory' - dunno.

But probably not.  `Info-index' does only this:
(equal Info-current-file "dir")





reply via email to

[Prev in Thread] Current Thread [Next in Thread]