From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KTEeE-0006KI-2a for mharc-grub-devel@gnu.org; Wed, 13 Aug 2008 07:36:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTEeB-0006Jo-NR for grub-devel@gnu.org; Wed, 13 Aug 2008 07:36:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTEe9-0006JS-K6 for grub-devel@gnu.org; Wed, 13 Aug 2008 07:36:10 -0400 Received: from [199.232.76.173] (port=38217 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTEe9-0006JP-Ba for grub-devel@gnu.org; Wed, 13 Aug 2008 07:36:09 -0400 Received: from nf-out-0910.google.com ([64.233.182.187]:1307) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KTEe8-0004rg-Ic for grub-devel@gnu.org; Wed, 13 Aug 2008 07:36:09 -0400 Received: by nf-out-0910.google.com with SMTP id c7so1144554nfi.26 for ; Wed, 13 Aug 2008 04:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer; bh=nrUYPglYFoDucEdlQ7HSEvk8a6cwYZurS+dmglMkI94=; b=TRwYFVPDeYH4/lOPiwgOxTnFVUP+bitFp88XB+EK4Cae9jlUQ9guMxhWOkh0vw4g/j OoW1hydheUSjfFwe51lZlVt6JMO7jizLuojhRgLhGGQMpbOgqeieDKfpjyzmezcEY8rI hTBwJM0sCg7aJq1Mu3spU/hsvUeCwqypn9e2g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer; b=w0J0GR33OJQbCAf3x/KLIDzbuiTRDB+ABBmJnY7FAwmxJuaRNRlxuub4y0/OWar5LW g7xvvHFkQrYiHz+e8SjVQtkD4G1bnP7ikEkJNwUULT/D0U0GZ3Uv4UFt25YXiUU3omio 4EdrJkPSEvhXdqmkef6fxD+NGpQMVMuzavBEA= Received: by 10.210.40.10 with SMTP id n10mr11751727ebn.116.1218627365503; Wed, 13 Aug 2008 04:36:05 -0700 (PDT) Received: from ?192.168.1.100? ( [213.37.137.93]) by mx.google.com with ESMTPS id b36sm158361ika.5.2008.08.13.04.36.03 (version=SSLv3 cipher=RC4-MD5); Wed, 13 Aug 2008 04:36:04 -0700 (PDT) From: Javier =?ISO-8859-1?Q?Mart=EDn?= To: The development of GRUB 2 In-Reply-To: <87od3x8ava.fsf@xs4all.nl> References: <87od3x8ava.fsf@xs4all.nl> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-7Q3JL/2aKzPDtzlk+cS8" Date: Wed, 13 Aug 2008 13:36:44 +0200 Message-Id: <1218627404.8757.13.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: Idea: use menu hook to implement the savedefault command X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2008 11:36:12 -0000 --=-7Q3JL/2aKzPDtzlk+cS8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable El mi=C3=A9, 13-08-2008 a las 12:31 +0200, Marco Gerards escribi=C3=B3: > Bean writes: >=20 > > 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=3Dsave_env default >=20 > Wouldn't this be a BOOT_PRELOAD? >=20 > I thought about this before (see archives about scripting), making it > possible for the user to add hooks. >=20 > In C: >=20 > ... menu code ... > /* The `menu' hook has one argument. */ > grub_hook_invoke ("menu", 1, arglist); >=20 >=20 > In scripting: >=20 > function menu_hook_handler() > save_env; >=20 > hook --register --hook=3Dmenu --script menu_hook_handler >=20 > Or do you think I am crazy now? ;-) >=20 > 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 +=3D myhook >=20 >=20 >=20 >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel --=-7Q3JL/2aKzPDtzlk+cS8 Content-Type: application/pgp-signature; name=signature.asc Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iQIVAwUASKLHTKSl+Fbdeo72AQJsMRAAg2GmyxGgJNYiws5PBOsAgNF+7a6Lhrwa FXBVQI/UrSC6YWR4EPZ9acizKRobIeWbDGLdBY4txY8YGxnZJR9dqGNIRA/bPXag Ec97YAXCUAlOpDLiWx7NTcKydhX1bK+cTDVymxE0XRfGRymD0Ln8Vyxd7NbzHZu/ 7MIRPG67KPVdnOTKG0sjZEGeV0SftY/FZIbFJI+G7WKSiR8vkuVAbWFIyNN97PSh s2KxzwqjNDwLvKH1NB5X7L4khPnMIGFtxNQZEYVF5MtqrgyBcJoIinFKsKq6RYFl w7z9ENjeASlrguycqLSywFmysTT8vrMfRyc82/30g0lOvp7CAvjcQWLOpC9EcGm1 DzCetDTlcI3f6+buoi60tuuPx+2jwA9oahca1oamMGlR0wf9mebs08dUtdRK4MN6 gz3OdpaLfBe078/bK694dJAudeHZno0d3qkphLX+FiHiIHxY3Fie7XNIRQxcW38l OPGgH14dzg5TfC0aMkGxbtxqciUBhpCuFL4JSoxz4PseANYsR6m5ZDBbJexevwSa NHFzpiUvj9B+dL5Bttk1u0fzgdzx3m7yTjAOtpsfKbsukWh5aYupNDO8lCRfiVMn ZhPWRB1QBJLerD478rlL7PXc7QfdlqxuYMfHQ6/DHNGOs9Hy2eUEsHLm3h8h7s3X G4pDNZnzijs= =jcYl -----END PGP SIGNATURE----- --=-7Q3JL/2aKzPDtzlk+cS8--