El mié, 13-08-2008 a las 12:31 +0200, Marco Gerards escribió:
> Bean <[EMAIL PROTECTED]> writes:
> 
> > Hi,
> >
> > Now it's possible to implement savedefault with load_env and save_env,
> > but the problem is we need to add it to every menuitem, it's tedious
> > process, and new item don't get it automatically.
> >
> > I'm thinking about using menu hook to solve this. I can think of two
> > implementation:
> >
> > 1. Function interface
> >
> > We can install hooks, which get called just before the menu is invoked.
> >
> > 2. Script interface
> >
> > We can use certain variable to specific the command to use, for example:
> >
> > set MENU_PRELOAD=save_env default
> 
> Wouldn't this be a BOOT_PRELOAD?
> 
> I thought about this before (see archives about scripting), making it
> possible for the user to add hooks.
> 
> In C:
> 
> ... menu code ...
> /* The `menu' hook has one argument.  */
> grub_hook_invoke ("menu", 1, arglist);
> 
> 
> In scripting:
> 
> function menu_hook_handler()
>   save_env;
> 
> hook --register --hook=menu --script menu_hook_handler
> 
> Or do you think I am crazy now? ;-)
> 
> This will involve some scripting hacking, but might pay off.  Do you
> think this is too complex for users?
It might be unnecessarily complex, yes. What about a C#-delegate-like
approach? e.g.:

function myhook() {
  save_env
}

BOOT_PRELOAD += myhook

> 
> 
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to