emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8d6dd1682e2: Fix use-package :vc keyword when byte-compiled


From: Eli Zaretskii
Subject: master 8d6dd1682e2: Fix use-package :vc keyword when byte-compiled
Date: Sat, 3 Jun 2023 03:27:25 -0400 (EDT)

branch: master
commit 8d6dd1682e2d42a813f9649e70da7aa7d6a95021
Author: Steven Allen <steven@stebalien.com>
Commit: Eli Zaretskii <eliz@gnu.org>

    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 @@ Also see the Info node `(use-package) Creating an 
extension'."
     ;; 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-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"))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]