about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2023-04-03T15·44+0200
committerclbot <clbot@tvl.fyi>2023-04-07T09·32+0000
commit0cb2057a76d74bc7ac342202d80f1be63474d86f (patch)
tree4dec3077b2acfbe4b77948379ea501d9a79f720e /tools
parent8263c024c9436c1ad56f64fbd6aa2ec27070eecb (diff)
feat(emacs-pkgs/tvl): allow starting sly only including dependencies r/6075
Usually the current behavior is best: You are dropped in a REPL with the
package(s) you are working on already available. As you are working on
them, you recompile individual files and your changes become available.

However, I've found that there are some occasions when this is not
desireable, e.g.: When you are working on something and have broken the
test suite intermittently, it becomes impossible to start a new REPL.

Not sure how the yes-or-no-p question should be phrased, its negation
may be better?

Change-Id: I6a37ebc02f3121f628fc9206e0de650851824cd6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8415
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tools')
-rw-r--r--tools/emacs-pkgs/tvl/tvl.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/emacs-pkgs/tvl/tvl.el b/tools/emacs-pkgs/tvl/tvl.el
index 46dbe0ca6834..8db718a8359d 100644
--- a/tools/emacs-pkgs/tvl/tvl.el
+++ b/tools/emacs-pkgs/tvl/tvl.el
@@ -199,7 +199,7 @@ passes. This is potentially dangerous, use with care."
   (magit-status-setup-buffer tvl-depot-path))
 
 (eval-after-load 'sly
-  '(defun tvl-sly-from-depot (attribute)
+  '(defun tvl-sly-from-depot (attribute only-deps)
      "Start a Sly REPL configured with a Lisp matching a derivation
      from the depot.
 
@@ -207,12 +207,21 @@ passes. This is potentially dangerous, use with care."
      asynchronously. The build output is included in the error
      thrown on build failures."
 
-     (interactive "sAttribute: ")
+     ;; TODO(sterni): this function asumes that we are using SBCL
+     ;;               - for determining the resulting wrapper's location
+     ;;               - for creating the dep-only wrapper
+
+     (interactive (list (read-string "Attribute: ")
+                        (yes-or-no-p "Only include dependencies? ")))
      (lexical-let* ((outbuf (get-buffer-create (format "*depot-out/%s*" attribute)))
                     (errbuf (get-buffer-create (format "*depot-errors/%s*" attribute)))
-                    (expression (format "(import <depot> {}).%s.repl" attribute))
+                    (attr-display (if only-deps attribute (format "dependencies of %s" attribute)))
+                    (expression (if only-deps
+                                    (format "let d = import <depot> {}; in d.nix.buildLisp.sbcl.lispWith d.%s.lispDeps"
+                                            attribute)
+                                    (format "(import <depot> {}).%s.repl" attribute)))
                     (command (list "nix-build" "--no-out-link" "-I" (format "depot=%s" tvl-depot-path) "-E" expression)))
-       (message "Acquiring Lisp for <depot>.%s" attribute)
+       (message "Acquiring Lisp for <depot>.%s" attr-display)
        (make-process :name (format "depot-nix-build/%s" attribute)
                      :buffer outbuf
                      :stderr errbuf
@@ -224,10 +233,10 @@ passes. This is potentially dangerous, use with care."
                              ("finished\n"
                               (let* ((outpath (s-trim (with-current-buffer outbuf (buffer-string))))
                                      (lisp-path (s-concat outpath "/bin/sbcl")))
-                                (message "Acquired Lisp for <depot>.%s at %s" attribute lisp-path)
+                                (message "Acquired Lisp for <depot>.%s at %s" attr-display lisp-path)
                                 (sly lisp-path)))
                              (_ (with-current-buffer errbuf
-                                  (error "Failed to build '%s':\n%s" attribute (buffer-string)))))
+                                  (error "Failed to build %s:\nTried building '%s':\n%s" attr-display expression (buffer-string)))))
                          (kill-buffer outbuf)
                          (kill-buffer errbuf)))))))