From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks Date: Sat, 27 Aug 2022 09:19:42 +0200 Message-ID: <86y1vaqhkh.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="39263"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 Cc: Stefan Monnier , emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 27 09:22:16 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 1oRq92-000A5d-0F for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Aug 2022 09:22:16 +0200 Original-Received: from localhost ([::1]:33936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRq90-0003zl-UI for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Aug 2022 03:22:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRq7I-0002jm-AQ for emacs-devel@gnu.org; Sat, 27 Aug 2022 03:20:28 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48808) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRq7H-0000JB-DY; Sat, 27 Aug 2022 03:20:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=l5x2Mcq9GqZlbfN3vChFX3RJmmM/qn/YfVIOZMrqjvE=; b=BW7b4n5YOU+cWcU2r5Fa WUTTqpcyYithkUXHTVQY2snv8ZUIFWYKXPpmRU7LkMoDCUA9EK3mqhBqzL53HqDtONitOR5ggqaPf Ioex3XzNo0cDaXDTpE00+fHycS+z+Tw23VsfZoXShKchRgDVkryQz2Nr3YM6+vjsZIH8hVnq34JR9 YhFUz7rdRXIysGvTuJlyu4F2bYAZM9KNcsfbmve6OLZI6dPgm14Smh/zt/lhDgP8q7kRvcB4FoJWz c+HFTDbPzrmU35+7BYN1AjuNxn1akyEcGkjhv6x4bcJlKxeoMC4tL+UHl4/vLcTlUaORps01GwCHC /9sEQgPFCWdCTw==; Original-Received: from pd9fb77f7.dip0.t-ipconnect.de ([217.251.119.247]:58419 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRq7G-0000Mr-SK; Sat, 27 Aug 2022 03:20:27 -0400 In-Reply-To: <87y1vavhw4.fsf@fastmail.fm> (Tassilo Horn's message of "Fri, 26 Aug 2022 22:47:47 +0200") 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:294178 Archived-At: Tassilo Horn writes: > That's true. I've searched the auctex lists and found out that Arash > made this change because he wanted to make it possible for styles to do > stuff like > > (TeX-add-style-hook > "foo" > (lambda () > (TeX-add-symbols > '("bar" (TeX-arg-key-val (append alist1 alist2)))))) > > where (append alist1 alist2) is what's being evaled. Arash, wouldn't > > (TeX-add-style-hook > "foo" > (lambda () > (TeX-add-symbols > `("bar" (TeX-arg-key-val ,(append alist1 alist2)))))) > > be just as good? 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. Actually, I changed all AUCTeX styles to have a function which returns a keyval-alist for the ones which are populated dynamically. Maintaining a single variable for this kind of stuff was a mess. So take fancyvrb.el for example which has a variable `LaTeX-fancyvrb-key-val-options'[1] (which can declared by defconst now) and a function `LaTeX-fancyvrb-key-val-options'[2] which returns the current keyvals. So my last requirement was to be able to do something like this: (TeX-add-style-hook "foo" (lambda () (TeX-add-symbols '("bar" (TeX-arg-key-val (append (func1-returning-keyval-alist) (func2-returning-keyval-alist))))))) And this didn't work with the (apply head tail) version. Any other suggestion how to implement this in `TeX-arg-key-val' is highly welcome. I was reluctant to use eval in the first place since I knew that Stefan will complain :-) but I didn't see any other possibility. Best, Arash Footnotes: [1] http://git.savannah.gnu.org/cgit/auctex.git/tree/style/fancyvrb.el#n74 [2] http://git.savannah.gnu.org/cgit/auctex.git/tree/style/fancyvrb.el#n127