Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id s52FLYQb027732 for ; Mon, 2 Jun 2014 17:21:35 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx108) with ESMTPS (Nemesis) id 0MACJR-1WyOzu3bFB-00BHHC for ; Mon, 02 Jun 2014 17:21:28 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id s52FHw5B005260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Jun 2014 17:17:58 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s52DBWMk021210; Mon, 2 Jun 2014 17:17:57 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11076597 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 2 Jun 2014 17:17:57 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s52FHvYU020834 for ; Mon, 2 Jun 2014 17:17:57 +0200 Received: from smtp3.easily.co.uk (smtp3.easily.co.uk [95.130.72.151]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s52FHnnM015817 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 2 Jun 2014 17:17:51 +0200 Received: from [139.222.114.112] (port=53786 helo=[139.222.114.112]) by smtp3.easily.co.uk with esmtpa (Exim 4.43) id 1WrUz4-0000NS-8U for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 02 Jun 2014 17:21:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <538C959C.3060904@morningstar2.co.uk> Date: Mon, 2 Jun 2014 16:17:48 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: 'Preseting' keys To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:ruGoXcPTx6Q=:8jNsNEjU8zI7+BWnppW4XL7K8Z Oy+uip+NyX28CuN8aDqZClR4DOYLjet5hhYLm4K+dU0RJTYpF8z0frOPYg52EDK0U1QO8FeM7 /3iHBMkbOA1RqsikdL64ZSxARhhxU0trq0kPNaR/7bHI7oXL5/onYS5cWLyuDG0c2xnAP8Lnc d3/Cs/DzBpydqr47RSOC/osZU/SAue/gfGsgSnYV7s0j5r0Q8cqWVgn/6p7uRRXP+k44GFPTy uAVy0IQnmO7rdqCY+TlsRqkyolvI2WzJ/+P1wqrMCXIESiTY/pR6MQ1y5Ql6fSyfUx3Ia68mH RSMhn/LoPCQFJrlUrioM5E7w+Fr/uPfmxnB+YV3RagcQ0ec696AhbqG6uPI00I9ft+m80BfHy I890SQUqFaJPuhecrPQsXehlfpp/VT8nAjk+AEfAt4bpLmd8WC3vKJS6i5TeAJTltMM1M2U9j lG/0rLHkQnjk9k9nLqQNtyIKfw1GdO1XkwFTLtzakmagXWCGfB8JbwLcAAhTsBHUK8X7ofNUh tDGgR725DYcjEK5+icqwdslXDGUmf/Hboha+cLOSIVFw+9BLK+/pA52QzNp1bS8fYKi15AlSH 07sxxhroSL9dprcEZJrUBpbm3MVYIxtDKBlKJc8zeOct658mgM6uvSlzFloE/9PzlppfnxRuk ergHHMuXZFVPgBzT61BJ1sYa1hpHo6+yA0aCNGTikJF0W8Svz0mJSWy/KsnFNRYgrqZlzyxa6 3SuM/Jp24Gy02Qt1feyryPZ2RWFKTriTcXl7METCXsjuu177Nwb039k1sFa3ijgJBU5FYf+5C NDf13F6Jpi2o5Irx4yo1jNSWqhVgwj+/EJ2YPUtKqB/cUwBIxFofkCXdaI1LAF3kxJsIV9xJl 45XMA5QqVMUs0Bf1dGMDwpps1lTA320OA2ryYrrz+o7xqZRMDWu4NLrswbu3lXZRLNeKx8NA6 hAQP5SHNdpZoIm3j4lgPAJLFIFohouDbnHpm8KFjSlFG5PPB19NZROx5UrWrg73MDbHwiJRhb zg+rZFSFxGCjA17RnWHbOJFMjpnZVULYbN6CqZEQluM9pi+KEKmo693X4zeyyire2IKKYx2no U4+S1aUMA3QoPoMk2GtG5dKOjkcrntY2nU0d9n5xP1iIFchoTGmJrhHNnZap7QBu4iWKINk8U yHq1FIAYVMpsEY+MTAxKlRK96zt+WoJ7uJga4rSWODDNsJSW5SrZoUB+44Av1+F0U2w1DbLu+ TNUr5ECW/fFY8olf898iaD6yBDs7Mk0EFwoYkVVaZmeF+6hYM+UcZlegQwIc/aCMrQ/CXZCeJ jH2deXiBcI4eQXvIHzY258SH8XXohl8bYWb7HaW1UrK2wWCXtoLo7GqoMJdzy4Jbk/D1m4L0y /0Z9b0QnSGmVj7+8FX/v5FFw+fWE1roMc04jz91FmU8o7EIQNCTZ9CeVZMe1H+u5Umt54vzhk AMHA6VHwCzhFTv7tq3ryyIveUeOXJJl31ma/g2hjvaUaEotsw2PW1NS4BYjs4tBecxRJCZhWU J1UWeBNcwG5FoKmjQqe/4whtnQ53RRX8UuUOL40/JLT7DRasOw5vcfRx4r1K3+Q== X-UI-Loop:V01:b/rDP1EVsBE=:p7H455VEgdCKYzGsGef72YW4CdNfp1KGT/1Kj/cFFFw= Status: R X-Status: X-Keywords: X-UID: 7480 Hello all, A reasonably common use case for keyval method is is the situation where one or more keys are set to a value implicitly. This is often managed in LaTeX using grouping. % Set up keys \keys_define:nn { mymod } { key-a .tl_set:N = \l_mya_tl , ... } \keys_set:nn { mymod } { key-a = value % Applies unless set otherwise } ... \group_begin: \keys_set:nn { mymod } { key-a = new-value } \group-end: % key-a will be "value" again \group_begin: \keys_set:nn { mymod } { % No key-a set => "value" } However, there are cases where you'd like to 'preset' the key every time. Currently, that would require \cs_new_protected:Npn \foo #1#2 % #1 = keys { \keys_set:nn { mymod } { key-a = new-value , #1 } but that is not that efficient and also not that clear. An alternative approach is to provide a method to 'preset' keys from within the key system, something like \keys_define:nn { mymod } { key-a .tl_set:N = \l_mya_tl , key-a .preset:n = value ... } where the presetting can avoid having to parse the keys each time it's run (cf. what happens in xtemplate). The team have some use cases where this makes sense, so I will be looking to add it as an experimental idea. Before I do, thought, I'd like to know if the name, etc., makes sense. It's distinct from ".default:n" (used if a key name is given with no property) and ".initial:n" (a 'set up' shortcut). I note that xkeyval offers the idea of preset keys, but in a slightly more complex fashion as it allows 'tail' keys and does some tests for the presence of keys before doing presetting. I don't see a similar concept in the pgfkeys manual: I have a feeling there just the 'manual' approach is used. Thoughts? -- Joseph Wright