From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.bugs Subject: bug#72818: 29.4; Cannot hook with use-package if variable is not `-hook'$ Date: Mon, 26 Aug 2024 11:47:25 -0700 Message-ID: References: <87seurh7xe.fsf@telenieko.com> <86h6b7jz5k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29780"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72818@debbugs.gnu.org, Marc Fargas To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 26 20:48:24 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sielL-0007Y2-IG for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 26 Aug 2024 20:48:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1siel9-0007NQ-Ug; Mon, 26 Aug 2024 14:48:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siel9-0007NI-CL for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2024 14:48:11 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1siel9-0002BS-2u for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2024 14:48:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Fpgamu3oUg1cz3UmaEBnR9F5XE9ROKEeEX38lAgjwM8=; b=CAC7v7wcpFTaFY/aFOQEC/SLjZhFhIzVAtAt34KTqlfdKEJ32bh8AvuAF8Sb2SOalyFmFNyw7Yc4czR0r8ZvWIrdcs5saqH1oBQ5zKLP5PmRtzKlWbtbX7SSkfuGMVuZ3oUoABV17sgEbP4FS4WePpScEl6RPqbwXYd4H91ayCtp2i66HdLtKewXEVgBvuNjgDeLLQjbZYzYRfWQfRkeIFVKcnHCzFPXiU+sEZln7TnmanK+imMxlqgV3q/aCibqenCyRK+bdLhIZwEMtc+0F9mwLPxXcbKlCdELpEI8R7KTmjaNB/+4vcEtEyE24f6EqZ80u68Z71anEpNYuTgsow==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1siely-0006La-2Z for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2024 14:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Wiegley Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Aug 2024 18:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72818 X-GNU-PR-Package: emacs Original-Received: via spool by 72818-submit@debbugs.gnu.org id=B72818.172469811124350 (code B ref 72818); Mon, 26 Aug 2024 18:49:02 +0000 Original-Received: (at 72818) by debbugs.gnu.org; 26 Aug 2024 18:48:31 +0000 Original-Received: from localhost ([127.0.0.1]:45221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sielT-0006Kg-5E for submit@debbugs.gnu.org; Mon, 26 Aug 2024 14:48:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sielQ-0006KR-L5 for 72818@debbugs.gnu.org; Mon, 26 Aug 2024 14:48:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siekU-00022g-J1; Mon, 26 Aug 2024 14:47:30 -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=Fpgamu3oUg1cz3UmaEBnR9F5XE9ROKEeEX38lAgjwM8=; b=f3D+BzcRbRBIWlBo90qC C+XIsYGYktcDo0/6k5xIuRU80JDF46gQvrg/I44Rg67bYdSlPqhYmXjw8zEAvXdZnhdq24BedGP4e 0VmfsFHjoUX0k+1eDCupqBitxEKf1/68FNOWhOIlMqkUuWGC8T/KwB0RxLtthRAfb8Pc5cCcd+Jox svjyc7h4GaWKHMdDAf7yHpiQezUgllFsisF6z6YArNrXeH6FYh3qlOiZOEBl6gbhjARKFp57Q9FJB qwnqvB/8rjE19BZk2uDZby5FZM+iDBdTrS214B5ZlNITybLzuejnuPO4APoqsclHVOeNgrSyxX7bk OaMD4mbCBfXzmw==; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvkedguddvjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhffkfgfgggtgfesthhqredttder jeenucfhrhhomheplfhohhhnucghihgvghhlvgihuceojhhohhhnfiesghhnuhdrohhrgh eqnecuggftrfgrthhtvghrnhepiefftdehvdeivddtffefffffveekledujeeiledtudef heefhffhfeegjeetfeegnecuffhomhgrihhnpehnvgifrghrthhishgrnhhsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhohhhn fidomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieekjeektdelgeegqdduje ejheefkeduiedqjhhohhhnfieppehgnhhurdhorhhgsehnvgifrghrthhishgrnhhsrdgt ohhmpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope ejvdekudekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepthgvlhgvnhhi vghkohesthgvlhgvnh X-ME-Proxy: Feedback-ID: ib64945b7:Fastmail In-Reply-To: <86h6b7jz5k.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 26 Aug 2024 14:34:31 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290788 Archived-At: >>>>> Eli Zaretskii writes: >> From: Marc Fargas >> >> -- Variable: after-make-frame-functions >> An abnormal hook run by =E2=80=98make-frame=E2=80=99 after it created th= e frame. >> Each function in =E2=80=98after-make-frame-functions=E2=80=99 receives o= ne >> argument, the frame just created. >>=20 >> This hook cannot be configured with `use-package' :hook keyword as it >> does not end in `-hook'. > Maybe I'm missing something, but how can use-package configure > abnormal hooks? It doesn't know which arguments to pass to them, > right? > > John, am I missing something? I think the behavior should be that if the variable name exists at the time the use-package macro is encountered, it should use it directly. Only if the named hook variable has no =E2=80=98symbol-value=E2=80=99 =E2=80=94 at that= time =E2=80=94 should it try appending the name =E2=80=98-hook=E2=80=98 to find a place to append the fu= nction. I.e., the definition could be: (defun use-package-handler/:hook (name _keyword args rest state) "Generate use-package custom keyword code." (use-package-concat (use-package-process-keywords name rest state) (cl-mapcan #'(lambda (def) (let ((syms (car def)) (fun (cdr def))) (when fun (mapcar #'(lambda (sym) (if (boundp sym) `(add-hook (quote ,sym) (function ,fun)) `(add-hook (quote ,(intern (concat (symbol-name sym) use-package-hook-name-suffix))) (function ,fun)))) (use-package-hook-handler-normalize-mode-symbols syms))))) (use-package-normalize-commands args)))) --=20 John Wiegley GPG fingerprint =3D 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2