branch: externals/leaf
commit 1b94da0cbb8d6c9f0d5bc7fea02f1e85eceed1ff
Author: Youhei SASAKI <[email protected]>
Commit: Youhei SASAKI <[email protected]>

    leaf-handler-vc: Add package to package-selected-packages
    
    The `:vc` handler (`leaf-handler-vc`) previously only called
    `package-vc-install` but did not update `package-selected-packages`.
    This caused packages installed via `:vc` to be flagged as orphaned
    by `package-autoremove`.
    
    This commit adds a `leaf-safe-push` call to `leaf-handler-vc`,
    aligning its behavior with `leaf-handler-package`.
    This ensures that VC-installed packages are correctly registered
    in the in-memory session, preventing them from being unexpectedly
    removed during package cleanup.
    
    Signed-off-by: Youhei SASAKI <[email protected]>
---
 leaf.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/leaf.el b/leaf.el
index b6812fd4d8..0f33aef0d2 100644
--- a/leaf.el
+++ b/leaf.el
@@ -1119,10 +1119,12 @@ SPEC is a list of the form (PKG OPTIONS REVISION)"
   (let ((pkg (nth 0 spec))
         (opts (nth 1 spec))
         (rev (nth 2 spec)))
-    `(unless (package-installed-p ',pkg)
-       (package-vc-install
-        ',(if opts `(,pkg ,@opts) pkg)
-        ,rev))))
+    `(progn
+       (leaf-safe-push ',pkg package-selected-packages 'no-dup)
+       (unless (package-installed-p ',pkg)
+         (package-vc-install
+          ',(if opts `(,pkg ,@opts) pkg)
+          ,rev)))))
 
 (defmacro leaf-handler-auth (name sym store)
   "Handler auth-* to set SYM of NAME from STORE."

Reply via email to