grub-devel
[Top][All Lists]
Advanced

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

Re: Idea: use menu hook to implement the savedefault command


From: Marco Gerards
Subject: Re: Idea: use menu hook to implement the savedefault command
Date: Wed, 13 Aug 2008 12:31:21 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Bean <address@hidden> 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?






reply via email to

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