From: Steven Allen <steven@stebalien.com>
To: Tony Zorman <soliditsallgood@mailbox.org>
Cc: 63541@debbugs.gnu.org
Subject: bug#63541: [PATCH] ; Fix use-package :vc keyword when byte-compiled
Date: Thu, 25 May 2023 21:54:29 -0700 [thread overview]
Message-ID: <875y8fzo8q.fsf@stebalien.com> (raw)
In-Reply-To: <874jo6owrz.fsf@hyperspace>
[-- Attachment #1: Type: text/plain, Size: 81 bytes --]
Here's a version of the patch with a test.
(sent to the right list this time)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-use-package-vc-keyword-when-byte-compiled.patch --]
[-- Type: text/x-patch, Size: 2404 bytes --]
From fee8eb4e81f8d541301bdbe74d7090bc5f27e455 Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@stebalien.com>
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
next prev parent reply other threads:[~2023-05-26 4:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 23:12 bug#63541: [PATCH] ; Fix use-package :vc keyword when byte-compiled Steven Allen
2023-05-18 19:54 ` Philip Kaludercic
2023-05-19 15:16 ` Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-20 16:50 ` Philip Kaludercic
2023-05-21 9:32 ` Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-26 4:54 ` Steven Allen [this message]
2023-05-31 13:23 ` Eli Zaretskii
2023-05-31 21:53 ` Philip Kaludercic
2023-06-03 7:28 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875y8fzo8q.fsf@stebalien.com \
--to=steven@stebalien.com \
--cc=63541@debbugs.gnu.org \
--cc=soliditsallgood@mailbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).