From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Steven Allen Newsgroups: gmane.emacs.bugs Subject: bug#63541: [PATCH] ; Fix use-package :vc keyword when byte-compiled Date: Thu, 25 May 2023 21:54:29 -0700 Message-ID: <875y8fzo8q.fsf@stebalien.com> References: <20230516231204.40043-1-steven@stebalien.com> <87a5y1za7p.fsf@posteo.net> <87wn14wdvf.fsf@hyperspace> <87wn137xrp.fsf@posteo.net> <874jo6owrz.fsf@hyperspace> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27931"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63541@debbugs.gnu.org To: Tony Zorman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 26 06:55:26 2023 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 1q2PU5-00075N-2a for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 May 2023 06:55:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2PTn-0000Yf-C4; Fri, 26 May 2023 00:55:07 -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 1q2PTi-0000YO-R9 for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 00:55:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2PTi-0007L8-B9 for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 00:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2PTh-0003aS-KJ for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 00:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Steven Allen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 May 2023 04:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63541 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63541-submit@debbugs.gnu.org id=B63541.168507688313752 (code B ref 63541); Fri, 26 May 2023 04:55:01 +0000 Original-Received: (at 63541) by debbugs.gnu.org; 26 May 2023 04:54:43 +0000 Original-Received: from localhost ([127.0.0.1]:48556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2PTO-0003Zj-ML for submit@debbugs.gnu.org; Fri, 26 May 2023 00:54:43 -0400 Original-Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:34199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2PTL-0003ZR-Ht for 63541@debbugs.gnu.org; Fri, 26 May 2023 00:54:40 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 8DD423200923; Fri, 26 May 2023 00:54:31 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 26 May 2023 00:54:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1685076871; x= 1685163271; bh=M7qGdQwSNNAOFx4KS3/OxU0iSlRrmSHCp9bE0d+7Ja0=; b=M rWdubg3+66GXQcgJMQ+lupY855qgEM+e1Q1zWnTWXgj+J1vwjh6cvuvn8Ywc4Oae t1IdF9AIVJdPEvI8oyUApCzX3Qx/R8HeP1G4B5i9JToQyXrb2xSfRO4QXJmFlqxU xlYClys8urDFt30a1D8cL7PdovNVmgzA6iyfZULRnap0om/CXyDKkpwdcZMKVhH/ dBzu4lGLrC903VddZS8Bzq/FukxqVr61oRuAttNAL1dDilLiJHHazH+K7MS/SYkQ uRfkXRlm8M2GvfuWOlUcbFe8KnobDedxXMmRqS1lUQDoM94no/mJfoaw51lFD+79 ZnV2RAExfSK3jQs34S7XA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1685076871; x=1685163271; bh=M7qGdQwSNNAOF x4KS3/OxU0iSlRrmSHCp9bE0d+7Ja0=; b=iUsgtZRKPdBHp37VAS2S00VvCYUqP /jjlfP66H+7bjPApR3rMm+/2ATFdNq2V+D/oT8CmgzwajwHyAjJ/rwLvOzmQ0yZ/ DpjxRDJ+z2yfxtKD1CJU5FRaJaVwz8byv1bV6AW9riJuk6AfRh5/Kag1RFPvhMvb 7HjgikPYRTZ9aASn5iC9kzvcliow5FvcwT5hFFFfIUZy0WtbVNLpuyMSh1VVKOiZ 2lnq936Um1jtE4ozuDpuRPr8E1wLoXoNuDrF0uTNk1RCt0xHttCoIftKWrqNZH6P 5Y5++4TvUwvtlSThrzPwS6Se+zDDfqfYVrntskFGfUgDWr1PGzTGW2ZfA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejkedgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufgjfhffkfggtgesmhdtre ertddttdenucfhrhhomhepufhtvghvvghnucetlhhlvghnuceoshhtvghvvghnsehsthgv sggrlhhivghnrdgtohhmqeenucggtffrrghtthgvrhhnpeejudefvdeijeeukedttdegud egffevjeehheeiueelgfffhfelffehfeevhfdvgeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehsthgvvhgvnhesshhtvggsrghlihgvnhdrtg homh X-ME-Proxy: Feedback-ID: ie8a146a7:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 May 2023 00:54:30 -0400 (EDT) In-Reply-To: <874jo6owrz.fsf@hyperspace> 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:262403 Archived-At: --=-=-= Content-Type: text/plain Content-Disposition: inline Here's a version of the patch with a test. (sent to the right list this time) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-use-package-vc-keyword-when-byte-compiled.patch Content-Description: 0001-Fix-use-package-vc-keyword-when-byte-compiled.patch >From fee8eb4e81f8d541301bdbe74d7090bc5f27e455 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 16 May 2023 16:07:36 -0700 Subject: [PATCH] ; Fix use-package :vc keyword when byte-compiled * lisp/use-package/use-package-core.el (use-package-handler/:vc): Return the new 'body'. Otherwise, the entire package declaration gets dropped when byte-compiling. * test/lisp/use-package/use-package-tests.el (use-package-test-handler/:vc-6): test it. --- lisp/use-package/use-package-core.el | 3 ++- test/lisp/use-package/use-package-tests.el | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 0d99e270a3f..e0e16134ed3 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -1619,7 +1619,8 @@ use-package-handler/:vc ;; See `use-package-handler/:ensure' for an explanation. (if (bound-and-true-p byte-compile-current-file) (funcall #'use-package-vc-install arg local-path) ; compile time - (push `(use-package-vc-install ',arg ,local-path) body)))) ; runtime + (push `(use-package-vc-install ',arg ,local-path) body)) ; runtime + body)) (defun use-package-normalize--vc-arg (arg) "Normalize possible arguments to the `:vc' keyword. diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index c8c20fc51cb..9181a8171a7 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el @@ -1991,6 +1991,17 @@ use-package-test/:vc-5 (use-package-vc-install '(other-name) ,load-path?) (require 'foo nil nil))))) +(ert-deftest use-package-test-handler/:vc-6 () + (let ((byte-compile-current-file "use-package-core.el") + tried-to-install) + (cl-letf (((symbol-function #'use-package-vc-install) + (lambda (arg &optional local-path) + (setq tried-to-install arg)))) + (should (equal + (use-package-handler/:vc 'foo nil 'some-pkg '(:init (foo)) nil) + '(foo))) + (should (eq tried-to-install 'some-pkg))))) + (ert-deftest use-package-test-normalize/:vc () (should (equal '(foo "version-string") (use-package-normalize/:vc 'foo :vc '("version-string")))) -- 2.40.1 --=-=-=--