unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Extended menu items, when are :enable and :filter computed?
@ 2006-02-26  1:42 Lennart Borgman
  2006-02-26 15:55 ` Stefan Monnier
  2006-02-27  8:59 ` Richard Stallman
  0 siblings, 2 replies; 18+ messages in thread
From: Lennart Borgman @ 2006-02-26  1:42 UTC (permalink / raw)


I think at least for me it is impossible to understand from the 
documentation when :enable and :filter in a menu-item list is computed. 
I believe the documentation should be improved.

 From my simple tests is seems like the argument to :filter is computed 
every time the menubar is accessed. It is not really what I would expect 
when this is in a submenu. Is this behaviour intentional?

The same seems to be true for the argument to :enable. Is this intentional?

What I mean is that I would expect those argument to be computed when 
they are needed, ie when the submenu is displayed.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-26  1:42 Extended menu items, when are :enable and :filter computed? Lennart Borgman
@ 2006-02-26 15:55 ` Stefan Monnier
  2006-02-27 19:02   ` Richard Stallman
  2006-02-27  8:59 ` Richard Stallman
  1 sibling, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2006-02-26 15:55 UTC (permalink / raw)
  Cc: Emacs Devel

> I think at least for me it is impossible to understand from the
> documentation when :enable and :filter in a menu-item list is
> computed. I believe the documentation should be improved.

>  From my simple tests is seems like the argument to :filter is computed
>  every time the menubar is accessed. It is not really what I would expect
>  when this is in a submenu. Is this behaviour intentional?

Depends what you mean by "intentional".
When the menubar is accessed, the whole menu tree is computed before handing
it to the toolkit: submenus are precomputed rather than being computed on
the fly when the user actually accesses them.

> The same seems to be true for the argument to :enable. Is this intentional?

Same thing.

I don't think this is considered as a feature (and I thought it was in
the TODO list to change it so that submenus are only constructed when
needed, but I can't seem to find it in the TODO file), but nobody's worked
on changing it.

Note that in most cases this only matters for reasons of performance.


        Stefan

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-26  1:42 Extended menu items, when are :enable and :filter computed? Lennart Borgman
  2006-02-26 15:55 ` Stefan Monnier
@ 2006-02-27  8:59 ` Richard Stallman
  1 sibling, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2006-02-27  8:59 UTC (permalink / raw)
  Cc: emacs-devel

     From my simple tests is seems like the argument to :filter is computed 
    every time the menubar is accessed. It is not really what I would expect 
    when this is in a submenu. Is this behaviour intentional?

Yes.  The toolkit displays the menus, and Emacs does not even know which
ones it displays.  Emacs must provide the full info in advance.

There is no choice about this.

Why do you care?  The user COULD look at all the submenus at any time,
so why do you care whether he does look at them all, or only at some?

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-26 15:55 ` Stefan Monnier
@ 2006-02-27 19:02   ` Richard Stallman
  2006-02-27 21:49     ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2006-02-27 19:02 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel

    I don't think this is considered as a feature (and I thought it was in
    the TODO list to change it so that submenus are only constructed when
    needed, but I can't seem to find it in the TODO file),

The reason for precomputing all the submenus is so that the toolkit
can display them all autonomously.  I think that's the only way some
toolkits can do it, so the idea of changing this is a non-starter.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-27 19:02   ` Richard Stallman
@ 2006-02-27 21:49     ` Stefan Monnier
  2006-02-28  6:19       ` Richard Stallman
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2006-02-27 21:49 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel

>     I don't think this is considered as a feature (and I thought it was in
>     the TODO list to change it so that submenus are only constructed when
>     needed, but I can't seem to find it in the TODO file),

> The reason for precomputing all the submenus is so that the toolkit
> can display them all autonomously.  I think that's the only way some
> toolkits can do it, so the idea of changing this is a non-starter.

If the only toolkits which could do it are non-free or "insignificant", then
I agree, but otherwise it may still make sense to provide it as
a toolkit-dependent optimization.  But indeed, it means that even if we
manage to change it for some toolkits, you won't be able to rely on
your :filters and :enables being called only when strictly necessary.

I've always viewed such a change as a performance improvement for those
cases where we use large dynamically-generated menus or menus with lots of
shortcuts to compute (X-Symbol comes to mind).

AFAIK XEmacs does compute menus on-demand.


        Stefan

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-27 21:49     ` Stefan Monnier
@ 2006-02-28  6:19       ` Richard Stallman
  2006-02-28  7:29         ` Lennart Borgman
                           ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Richard Stallman @ 2006-02-28  6:19 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel

    I've always viewed such a change as a performance improvement for those
    cases where we use large dynamically-generated menus or menus with lots of
    shortcuts to compute (X-Symbol comes to mind).

Is this optimization really worth while on modern computers?

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-28  6:19       ` Richard Stallman
@ 2006-02-28  7:29         ` Lennart Borgman
  2006-03-01 14:14           ` Richard Stallman
  2006-02-28 16:06         ` Stefan Monnier
  2006-03-02 11:26         ` David Kastrup
  2 siblings, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-02-28  7:29 UTC (permalink / raw)
  Cc: Stefan Monnier, emacs-devel

Richard Stallman wrote:
>     I've always viewed such a change as a performance improvement for those
>     cases where we use large dynamically-generated menus or menus with lots of
>     shortcuts to compute (X-Symbol comes to mind).
>
> Is this optimization really worth while on modern computers?
>   
Yes, I believe so. If the building involves accessing the file system 
(which is rather likely for a program like Emacs) then it could take 
some time.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-28  6:19       ` Richard Stallman
  2006-02-28  7:29         ` Lennart Borgman
@ 2006-02-28 16:06         ` Stefan Monnier
  2006-03-01 17:55           ` Richard Stallman
  2006-03-02 11:26         ` David Kastrup
  2 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2006-02-28 16:06 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel

>     I've always viewed such a change as a performance improvement for
>     those cases where we use large dynamically-generated menus or menus
>     with lots of shortcuts to compute (X-Symbol comes to mind).

> Is this optimization really worth while on modern computers?

Of course.  The speed of the average computer is not relevant since faster
computers simply means that the package authors can put more complex code in
:enable and :filter.


        Stefan

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-28  7:29         ` Lennart Borgman
@ 2006-03-01 14:14           ` Richard Stallman
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2006-03-01 14:14 UTC (permalink / raw)
  Cc: monnier, emacs-devel

    > Is this optimization really worth while on modern computers?

    Yes, I believe so. If the building involves accessing the file system 
    (which is rather likely for a program like Emacs) then it could take 
    some time.

I am not sure what "building" refers to here.  We are talking
about testing whether menu items are active.

You seem to say that you speculate this is likely to mean looking at
the file system.  However, to me that seems like a rather unlikely way
to control activity of Emacs menu items.

Are there really Emacs Lisp programs that control menu item activity
based on looking for files?

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-28 16:06         ` Stefan Monnier
@ 2006-03-01 17:55           ` Richard Stallman
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2006-03-01 17:55 UTC (permalink / raw)
  Cc: lennart.borgman.073, emacs-devel

    > Is this optimization really worth while on modern computers?

    Of course.  The speed of the average computer is not relevant since faster
    computers simply means that the package authors can put more complex code in
    :enable and :filter.

They can, but I suspect most of them do not.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-02-28  6:19       ` Richard Stallman
  2006-02-28  7:29         ` Lennart Borgman
  2006-02-28 16:06         ` Stefan Monnier
@ 2006-03-02 11:26         ` David Kastrup
  2006-03-02 19:44           ` Richard Stallman
  2 siblings, 1 reply; 18+ messages in thread
From: David Kastrup @ 2006-03-02 11:26 UTC (permalink / raw)
  Cc: lennart.borgman.073, Stefan Monnier, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     I've always viewed such a change as a performance improvement
>     for those cases where we use large dynamically-generated menus
>     or menus with lots of shortcuts to compute (X-Symbol comes to
>     mind).
>
> Is this optimization really worth while on modern computers?

Computing menus might require loading Lisp packages.  And many free
software developers are not particularly wealthy and able to keep up
with the trends in current hardware, which are mostly due to playing
games (running Windows XP with its compulsory registration and
security problems might be considered a special case of online
gambling).

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-03-02 11:26         ` David Kastrup
@ 2006-03-02 19:44           ` Richard Stallman
  2006-03-02 20:01             ` Lennart Borgman
  2006-03-27 17:01             ` Per Abrahamsen
  0 siblings, 2 replies; 18+ messages in thread
From: Richard Stallman @ 2006-03-02 19:44 UTC (permalink / raw)
  Cc: lennart.borgman.073, monnier, emacs-devel

    Computing menus might require loading Lisp packages.

Theoretically true, but seems unlikely in practice.  Anyway, it will
only be necessary to load them once, the first time.

      And many free
    software developers are not particularly wealthy and able to keep up
    with the trends in current hardware,

So maybe they have machines a few years old.  The question is still
important.

I think this optimization is not needed any more, so I don't want to
put it in etc/TODO.  I don't want to do it at all, unless people show
there is a real need for it today.  Not just a theoretical need, but a
substantial practical need.  Not just a speculation but actual facts.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-03-02 19:44           ` Richard Stallman
@ 2006-03-02 20:01             ` Lennart Borgman
  2006-03-03 20:58               ` Richard Stallman
  2006-03-27 17:01             ` Per Abrahamsen
  1 sibling, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-03-02 20:01 UTC (permalink / raw)
  Cc: monnier, emacs-devel

Richard Stallman wrote:
> I think this optimization is not needed any more, so I don't want to
> put it in etc/TODO.  I don't want to do it at all, unless people show
> there is a real need for it today.  Not just a theoretical need, but a
> substantial practical need.  Not just a speculation but actual facts.
>   
I do not know if my example is important, but here is how this problem 
came to my mind:

I am trying to use the excellent nxml-mode to build a web authoring 
environment in Emacs. This mode can tell what tags are allowed at a 
certain position in an XHTML document. This information could be used 
for building menus which perhaps would be good for beginners. However 
there are some computations required for that of course.

In this web authoring environment there are also cases when the 
existence of certain files could make difference for what to enable in 
the menus.

I realize this is not a very strong case. I could for example use a 
popup menu instead to show what tags are allowed. And the normal way to 
check this in nxhtml-mode is just completion the normal way in Emacs.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-03-02 20:01             ` Lennart Borgman
@ 2006-03-03 20:58               ` Richard Stallman
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2006-03-03 20:58 UTC (permalink / raw)
  Cc: monnier, emacs-devel

    This mode can tell what tags are allowed at a 
    certain position in an XHTML document. This information could be used 
    for building menus which perhaps would be good for beginners. However 
    there are some computations required for that of course.

If you really implement this, we can see how fast it runs
and whether it needs optimization.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-03-02 19:44           ` Richard Stallman
  2006-03-02 20:01             ` Lennart Borgman
@ 2006-03-27 17:01             ` Per Abrahamsen
  2006-03-28 19:33               ` Richard Stallman
  1 sibling, 1 reply; 18+ messages in thread
From: Per Abrahamsen @ 2006-03-27 17:01 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     Computing menus might require loading Lisp packages.
>
> Theoretically true, but seems unlikely in practice.  Anyway, it will
> only be necessary to load them once, the first time.

The Customize menus basically needs to load everything.  They have
been disabled for GNU Emacs for that reason, but was fully enabled for
XEmacs (with delayed generation) last time I checked (many years ago).

They are not really that practical though, the menu structure becomes
too deeply nested to be useful.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-03-27 17:01             ` Per Abrahamsen
@ 2006-03-28 19:33               ` Richard Stallman
  2006-03-29  7:00                 ` Per Abrahamsen
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2006-03-28 19:33 UTC (permalink / raw)
  Cc: emacs-devel

    The Customize menus basically needs to load everything.

Sorry, what is the "Customize menus"?

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-03-28 19:33               ` Richard Stallman
@ 2006-03-29  7:00                 ` Per Abrahamsen
  2006-03-29 23:02                   ` Richard Stallman
  0 siblings, 1 reply; 18+ messages in thread
From: Per Abrahamsen @ 2006-03-29  7:00 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     The Customize menus basically needs to load everything.
>
> Sorry, what is the "Customize menus"?

>From a *Customize* buffer, select Custom -> Customize.  You get a the
'customize' custom group as a menu structure.  The code that generates
this menu structure works (or worked) for any custom group group,
including 'emacs'.  That way you basically get a menu structure with
all customize options as leaves.

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

* Re: Extended menu items, when are :enable and :filter computed?
  2006-03-29  7:00                 ` Per Abrahamsen
@ 2006-03-29 23:02                   ` Richard Stallman
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2006-03-29 23:02 UTC (permalink / raw)
  Cc: emacs-devel

    >From a *Customize* buffer, select Custom -> Customize.  You get a the
    'customize' custom group as a menu structure.  The code that generates
    this menu structure works (or worked) for any custom group group,
    including 'emacs'.  That way you basically get a menu structure with
    all customize options as leaves.

It sounds like that duplicates the navigation facilities of the Custom
buffers and customize-browse.  It seems superfluous.

It seems to me we might as well get rid of this entirely.

Does anyone disagree?

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

end of thread, other threads:[~2006-03-29 23:02 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-26  1:42 Extended menu items, when are :enable and :filter computed? Lennart Borgman
2006-02-26 15:55 ` Stefan Monnier
2006-02-27 19:02   ` Richard Stallman
2006-02-27 21:49     ` Stefan Monnier
2006-02-28  6:19       ` Richard Stallman
2006-02-28  7:29         ` Lennart Borgman
2006-03-01 14:14           ` Richard Stallman
2006-02-28 16:06         ` Stefan Monnier
2006-03-01 17:55           ` Richard Stallman
2006-03-02 11:26         ` David Kastrup
2006-03-02 19:44           ` Richard Stallman
2006-03-02 20:01             ` Lennart Borgman
2006-03-03 20:58               ` Richard Stallman
2006-03-27 17:01             ` Per Abrahamsen
2006-03-28 19:33               ` Richard Stallman
2006-03-29  7:00                 ` Per Abrahamsen
2006-03-29 23:02                   ` Richard Stallman
2006-02-27  8:59 ` Richard Stallman

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