unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#397: 23.0.60; T in Info when in (dir)
@ 2008-06-12 15:53 Drew Adams
  2016-04-27 16:11 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2008-06-12 15:53 UTC (permalink / raw)
  To: emacs-pretest-bug

`T' in Info when you are at the directory level (dir), should either
raise an error or DTRT.
 
To DTRT, it could do either of these:
 
- return to the directory listing (which is useless),
  which is the top-level TOC
- show the contents of all manuals (pretty costly),
  which is the detailed TOC
 
Currently, what `T' does is worse than useless. It shows this, where
(dir) and the second Top are links to the same place - the directory
you just came from:
 
 Up: (dir)
 File: toc,  Node: Top
 
 Table of Contents
 *****************
 
 Top.
 
This is not only useless; it is wrong. Top cannot be the same thing as
(dir), but both links lead to the same place. And the Top listed as
the current node is different from the destination of the Top link.
 
Please, at a minimum, (1) raise an error if `T' is used in the
directory (dir), and (2) disable (dim) the corresponding item in the
Info menu when in (dir).
 
 
 
In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-05-29 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/g/include
-fno-crossjumping'
 







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

* bug#397: 23.0.60; T in Info when in (dir)
  2008-06-12 15:53 bug#397: 23.0.60; T in Info when in (dir) Drew Adams
@ 2016-04-27 16:11 ` Lars Ingebrigtsen
  2016-04-27 16:42   ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 16:11 UTC (permalink / raw)
  To: Drew Adams; +Cc: 397

"Drew Adams" <drew.adams@oracle.com> writes:

> `T' in Info when you are at the directory level (dir), should either
> raise an error or DTRT.
>
> To DTRT, it could do either of these:
>
> - return to the directory listing (which is useless),
>   which is the top-level TOC
> - show the contents of all manuals (pretty costly),
>   which is the detailed TOC
>
> Currently, what `T' does is worse than useless. It shows this, where
> (dir) and the second Top are links to the same place - the directory
> you just came from:
>
>  Up: (dir)
>  File: toc,  Node: Top
>
>  Table of Contents
>  *****************
>
>  Top.

This seems like it's fixed now.  If I `T' in the top level node, it just
says "user-error: No such node or anchor: *TOC*".

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





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 16:11 ` Lars Ingebrigtsen
@ 2016-04-27 16:42   ` Drew Adams
  2016-04-27 16:47     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2016-04-27 16:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 397



> -----Original Message-----
> From: Lars Ingebrigtsen [mailto:larsi@gnus.org]
> Sent: Wednesday, April 27, 2016 9:12 AM
> To: Drew Adams
> Cc: 397@debbugs.gnu.org
> Subject: Re: bug#397: 23.0.60; T in Info when in (dir)
> 
> "Drew Adams" <drew.adams@oracle.com> writes:
> 
> > `T' in Info when you are at the directory level (dir), should either
> > raise an error or DTRT.
> >
> > To DTRT, it could do either of these:
> >
> > - return to the directory listing (which is useless),
> >   which is the top-level TOC
> > - show the contents of all manuals (pretty costly),
> >   which is the detailed TOC
> >
> > Currently, what `T' does is worse than useless. It shows this, where
> > (dir) and the second Top are links to the same place - the directory
> > you just came from:
> >
> >  Up: (dir)
> >  File: toc,  Node: Top
> >
> >  Table of Contents
> >  *****************
> >
> >  Top.
> 
> This seems like it's fixed now.  If I `T' in the top level node, it just
> says "user-error: No such node or anchor: *TOC*".

Thanks, but that is not the whole fix.  You missed this part:

    and (2) disable (dim) the corresponding item in the
    Info menu when in (dir).

The Info menu correctly has things like Up disabled (dimmed).
But menu item Table of Contents (T) is not disabled.
Please fix this part of the bug also.





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 16:42   ` Drew Adams
@ 2016-04-27 16:47     ` Lars Ingebrigtsen
  2016-04-27 17:12       ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 16:47 UTC (permalink / raw)
  To: Drew Adams; +Cc: 397

Drew Adams <drew.adams@oracle.com> writes:

> Thanks, but that is not the whole fix.  You missed this part:
>
>     and (2) disable (dim) the corresponding item in the
>     Info menu when in (dir).
>
> The Info menu correctly has things like Up disabled (dimmed).
> But menu item Table of Contents (T) is not disabled.
> Please fix this part of the bug also.

Hm...  I don't quite follow.  Do you have a complete recipe, starting
from -Q?

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





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 16:47     ` Lars Ingebrigtsen
@ 2016-04-27 17:12       ` Drew Adams
  2016-04-27 17:35         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2016-04-27 17:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 397

> > Thanks, but that is not the whole fix.  You missed this part:
> >
> >     and (2) disable (dim) the corresponding item in the
> >     Info menu when in (dir).
> >
> > The Info menu correctly has things like Up disabled (dimmed).
> > But menu item Table of Contents (T) is not disabled.
> > Please fix this part of the bug also.
> 
> Hm...  I don't quite follow.  Do you have a complete recipe, starting
> from -Q?

emacs -Q
C-h i

Look at the Info menu, in the menu bar.  See the menu item
`Table of Contents           T'?  It should be disabled
when at the (dir), i.e., the top, level.





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 17:12       ` Drew Adams
@ 2016-04-27 17:35         ` Lars Ingebrigtsen
  2016-04-27 17:46           ` Drew Adams
       [not found]           ` <<5a64ed8a-d9c7-4b33-b63a-11d83b7dab99@default>
  0 siblings, 2 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 17:35 UTC (permalink / raw)
  To: Drew Adams; +Cc: 397

Drew Adams <drew.adams@oracle.com> writes:

>> > Thanks, but that is not the whole fix.  You missed this part:
>> >
>> >     and (2) disable (dim) the corresponding item in the
>> >     Info menu when in (dir).
>> >
>> > The Info menu correctly has things like Up disabled (dimmed).
>> > But menu item Table of Contents (T) is not disabled.
>> > Please fix this part of the bug also.
>> 
>> Hm...  I don't quite follow.  Do you have a complete recipe, starting
>> from -Q?
>
> emacs -Q
> C-h i
>
> Look at the Info menu, in the menu bar.  See the menu item
> `Table of Contents           T'?  It should be disabled
> when at the (dir), i.e., the top, level.

Oh, I see.  I didn't think you meant the Emacs menu menu, but a menu in
the Info buffer.  :-)

Let's see...  Yes, that menu item should be dimmed.

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.

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





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 17:35         ` Lars Ingebrigtsen
@ 2016-04-27 17:46           ` Drew Adams
  2016-04-27 17:58             ` Eli Zaretskii
       [not found]           ` <<5a64ed8a-d9c7-4b33-b63a-11d83b7dab99@default>
  1 sibling, 1 reply; 14+ messages in thread
From: Drew Adams @ 2016-04-27 17:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 397

> 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")





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 17:46           ` Drew Adams
@ 2016-04-27 17:58             ` Eli Zaretskii
  2016-04-27 18:22               ` Andreas Schwab
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-27 17:58 UTC (permalink / raw)
  To: Drew Adams; +Cc: larsi, 397

> Date: Wed, 27 Apr 2016 10:46:38 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: 397@debbugs.gnu.org
> 
> `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 "@@@@@@@@@@@@@@@@@"))

So, from now on, no Info manual can be called "dir" or "dir.info", or
suchlikes?  Does dimming an option in a rarely-used menu really
justify this?  I don't think so.

We should look for a better solution, if one exists.  If it doesn't,
then it isn't a catastrophe to have that option be available and fail
if invoked where it cannot work.  No one who knows something about
Info will invoke that function in this situation, anyway.

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

Bad, bad Info-index!





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

* bug#397: 23.0.60; T in Info when in (dir)
       [not found]             ` <<83vb33x7b6.fsf@gnu.org>
@ 2016-04-27 18:09               ` Drew Adams
  2016-04-27 18:28                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2016-04-27 18:09 UTC (permalink / raw)
  To: Eli Zaretskii, Drew Adams; +Cc: larsi, 397

> > `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 "@@@@@@@@@@@@@@@@@"))
> 
> So, from now on, no Info manual can be called "dir" or "dir.info", or
> suchlikes?  Does dimming an option in a rarely-used menu really
> justify this?  I don't think so.

It was a quick-and-dirty implementation suggestion.  I don't
argue for that implementation.

If we put the "real" code for this into an :enable menu guard
then that guard would be (Info-find-node "dir" "*TOC*").

And in the case of your hypothetical manual named "dir", there
could be such a *TOC* node, and in that case the menu item would
be correctly enabled.

> We should look for a better solution, if one exists.  If it doesn't,
> then it isn't a catastrophe to have that option be available and fail
> if invoked where it cannot work.  No one who knows something about
> Info will invoke that function in this situation, anyway.

Fair enough.  Someone might actually try it: use the :enable
guard (Info-find-node "dir" "*TOC*") and see whether it is
in fact onerous.  If it is then I agree with (both of) you:
we can do without disabling the menu item.

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

;-)





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 17:58             ` Eli Zaretskii
@ 2016-04-27 18:22               ` Andreas Schwab
  2016-04-27 19:27                 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2016-04-27 18:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, 397

Eli Zaretskii <eliz@gnu.org> writes:

> So, from now on, no Info manual can be called "dir" or "dir.info", or
> suchlikes?

dir has always been special.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 18:09               ` Drew Adams
@ 2016-04-27 18:28                 ` Lars Ingebrigtsen
  2022-03-21 22:06                   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2016-04-27 18:28 UTC (permalink / raw)
  To: Drew Adams; +Cc: 397

Drew Adams <drew.adams@oracle.com> writes:

> Fair enough.  Someone might actually try it: use the :enable
> guard (Info-find-node "dir" "*TOC*") and see whether it is
> in fact onerous.  If it is then I agree with (both of) you:
> we can do without disabling the menu item.

Well, using it as is doesn't really work, because it does a lot
of... stuff.

Here's how it starts:

(defun Info-find-node-2 (filename nodename &optional no-going-back strict-case)
  (buffer-disable-undo (current-buffer))
  (or (derived-mode-p 'Info-mode)
      (Info-mode))
  (widen)
  (setq Info-current-node nil)
  (unwind-protect
      (let ((case-fold-search t)
	    (virtual-fun (Info-virtual-fun 'find-node
					   (or filename Info-current-file)
					   nodename))
	    anchorpos)
	(cond
	 ((functionp virtual-fun)
	  (let ((filename (or filename Info-current-file)))
	    (setq buffer-read-only nil)
	    (setq Info-current-file filename
		  Info-current-subfile nil
		  Info-current-file-completions nil
		  buffer-file-name nil)
	    (erase-buffer)

So that's not the right thing to use.

(Info-virtual-fun 'find-node "dir" "*TOC*")
=> Info-directory-find-node

(defun Info-directory-find-node (_filename _nodename &optional _no-going-back)
  "Directory-specific implementation of `Info-find-node-2'."
  (Info-insert-dir))

...

(defun Info-insert-dir ()
  (if (and Info-dir-contents Info-dir-file-attributes
	   ;; Verify that none of the files we used has changed
	   ;; since we used it.
	   (eval (cons 'and
		       (mapcar (lambda (elt)
				 (let ((curr (file-attributes
					      ;; Handle symlinks
					      (file-truename (car elt)))))


And down the rabbit hole we go.  Why are we calling that function and
ignoring the parameters?  It's all very confusing.

So does somebody know what the real way to find out whether a node
exists is?  :-)

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





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 18:22               ` Andreas Schwab
@ 2016-04-27 19:27                 ` Eli Zaretskii
  2016-04-30 20:08                   ` Juri Linkov
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2016-04-27 19:27 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: larsi, 397

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Drew Adams <drew.adams@oracle.com>,  larsi@gnus.org,  397@debbugs.gnu.org
> Date: Wed, 27 Apr 2016 20:22:07 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > So, from now on, no Info manual can be called "dir" or "dir.info", or
> > suchlikes?
> 
> dir has always been special.

It's name is special, but its structure could be anything, and could
support a TOC.





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 19:27                 ` Eli Zaretskii
@ 2016-04-30 20:08                   ` Juri Linkov
  0 siblings, 0 replies; 14+ messages in thread
From: Juri Linkov @ 2016-04-30 20:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, Andreas Schwab, 397

>> > So, from now on, no Info manual can be called "dir" or "dir.info", or
>> > suchlikes?
>>
>> dir has always been special.
>
> It's name is special, but its structure could be anything, and could
> support a TOC.

I remember an idea to display a table of contents of (usually very long)
dir itself with a list of its section names.





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

* bug#397: 23.0.60; T in Info when in (dir)
  2016-04-27 18:28                 ` Lars Ingebrigtsen
@ 2022-03-21 22:06                   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-21 22:06 UTC (permalink / raw)
  To: Drew Adams; +Cc: 397

I think the conclusion here was that it would be prohibitively expensive
to grey out the menu bar item here, so I'm closing this as a wontfix.

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






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

end of thread, other threads:[~2022-03-21 22:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-12 15:53 bug#397: 23.0.60; T in Info when in (dir) Drew Adams
2016-04-27 16:11 ` Lars Ingebrigtsen
2016-04-27 16:42   ` Drew Adams
2016-04-27 16:47     ` Lars Ingebrigtsen
2016-04-27 17:12       ` Drew Adams
2016-04-27 17:35         ` Lars Ingebrigtsen
2016-04-27 17:46           ` Drew Adams
2016-04-27 17:58             ` Eli Zaretskii
2016-04-27 18:22               ` Andreas Schwab
2016-04-27 19:27                 ` Eli Zaretskii
2016-04-30 20:08                   ` Juri Linkov
     [not found]           ` <<5a64ed8a-d9c7-4b33-b63a-11d83b7dab99@default>
     [not found]             ` <<83vb33x7b6.fsf@gnu.org>
2016-04-27 18:09               ` Drew Adams
2016-04-27 18:28                 ` Lars Ingebrigtsen
2022-03-21 22:06                   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).