From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks Date: Fri, 26 Aug 2022 23:17:37 +0200 Message-ID: <87r112vgrt.fsf@gnu.org> References: <166154439039.10036.933483657788018296@vcs2.savannah.gnu.org> <20220826200639.2B668C00889@vcs2.savannah.gnu.org> <87y1vavhw4.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11297"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.0; emacs 29.0.50 Cc: Arash Esbati , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 26 23:26:37 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRgqY-0002ih-V8 for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Aug 2022 23:26:35 +0200 Original-Received: from localhost ([::1]:50536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRgqX-0007kM-8x for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Aug 2022 17:26:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRgpl-00072d-SW for emacs-devel@gnu.org; Fri, 26 Aug 2022 17:25:45 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRgpl-0008F2-7x; Fri, 26 Aug 2022 17:25:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=XskiDjRG1CztzpLyLDAqZ69etkRmKpn99puLurTX4gI=; b=biS3Gto+tDxQ16 RiOfy7qxz4iBIoa2Zx+Zt9cLcpHFO97bSOov9wS8x7Aqhaek6wyfiQlXnytHjVhHYWS/umGMD3fY0 R8I2ON7gcRKTRqyWtl0Yef4aTvSxYEwxMcjLnWdII8aTtnCeNmtcjh7Snc3FWS5XFOsoVzIzk60cL kuKujOFSZNEUDSqTEqcM/7jrm5TmEiX5ne3l9Tn0x4K7NNrEucnjcjarUFnq+kvJSp3IEo5RdN7UI 3L86W+waBhqOM+gFpkFTOOaCL3JY+15MRHnnNE1wnBIfi0Aq5Y0jfQBlhExPsm2dzV3PYM89bp4X1 GdUXWSag+7H1TmfdWfQA==; Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:51499) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRgpk-0008WD-SQ; Fri, 26 Aug 2022 17:25:44 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 8498427C005B; Fri, 26 Aug 2022 17:25:44 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 26 Aug 2022 17:25:44 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdejhedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtsehttdertddtredtnecuhfhrohhmpefvrghs shhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnh epudejtdehuddvleffjeekteegvdehleehvdeufefhueekkeekhedvgfeggeffvefgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnh domhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeeh vdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Aug 2022 17:25:43 -0400 (EDT) In-reply-to: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294166 Archived-At: Stefan Monnier writes: >> I guess no because IIRC the context was that alist1 and alist2 might >> be populated dynamically (by parsing the document) so we need to take >> the values at the time the \bar macro is inserted. So probably >> >> (TeX-add-style-hook >> "foo" >> (lambda () >> (TeX-add-symbols >> `("bar" (TeX-arg-key-val ,(lambda () (append alist1 alist2))))))) >> >> would be the right thing which works without eval, right? It's a bit >> longer but I wouldn't mind. Wrapping code in a lambda to be >> evaluated later is a common concept. > > FWIW, I don't understand exactly how the above code is "linked" to the > definition of `TeX-arg-key-val` (which in my code takes two arguments > rather than one). Yes, all TeX-arg-* functions have OPTIONAL as first arg but that's implicit. If you use it them parentheses, it's mandatory (optional is nil) whereas when you use it with brackets it's optional. Brackets because that's how optional arguments are written in TeX. So you could also have `("bar" [TeX-arg-key-val ,(lambda () (append alist1 alist2))]) if it was \bar[key1=val1, key2=val2] instead of \bar{key1=val1, key2=val2}. > I tried to trace through the code, but it's a bit less obvious than > needed for my little head. Hehe, I agree... with the non-obviousness, of course, not the size of your head. :-) Bye, Tassilo