From 87c5b868dbbda590ee9b24d0e9fbf4120be03288 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 28 Apr 2024 19:18:05 +0100 Subject: [PATCH] Improve the "try!" macro by embedding use-package --- nix/modules/unit/lisp/fpkg.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nix/modules/unit/lisp/fpkg.el b/nix/modules/unit/lisp/fpkg.el index a3ef3bf..0415151 100644 --- a/nix/modules/unit/lisp/fpkg.el +++ b/nix/modules/unit/lisp/fpkg.el @@ -98,7 +98,12 @@ same NAME is set to t." (defmacro try! (pkg &rest details) - "Try the PKG with the given DETAILS in the running session." + "Try the PKG with the given DETAILS in the running session. + +It will install the package using Nix and make it available to the current +running session. For a persistant installation use `use!'." + (declare (indent defun)) + (let ((flake-dir (format "%s/share/fg42" (fg42-path))) (cwd (getenv "PWD"))) (cd flake-dir) @@ -107,7 +112,7 @@ same NAME is set to t." (out (car (string-split output "\n" t)))) (add-emacs-vars out) (cd cwd) - out))) + `(use-package ,pkg ,@details)))) (provide 'fpkg)