diff options
author | Vincent Ambo <tazjin@google.com> | 2020-01-17T19·09+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-01-17T19·09+0000 |
commit | bdd488ce273c0943f03c91abbb5b089178be4103 (patch) | |
tree | 8032f7fbd7e2300efe86e3069b35f69ba828705c | |
parent | 8e9167fdc8294166a52c870acac4ae6ee769537c (diff) |
fix(emacs-pkgs/nix-util): Use lexical-let to allow variable capture r/398
The lambda that acts as the sentinel for building SBCL with packages needs to be able to capture variables if lexical binding is enabled, which is made possible by the lexical-let form.
-rw-r--r-- | tools/emacs-pkgs/nix-util/nix-util.el | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/emacs-pkgs/nix-util/nix-util.el b/tools/emacs-pkgs/nix-util/nix-util.el index b561ead16cf2..278adfc73d74 100644 --- a/tools/emacs-pkgs/nix-util/nix-util.el +++ b/tools/emacs-pkgs/nix-util/nix-util.el @@ -75,29 +75,29 @@ thrown on build failures." (interactive "sAttribute: ") - (let* ((outbuf (get-buffer-create (format "*depot-out/%s*" attribute))) + (lexical-let* ((outbuf (get-buffer-create (format "*depot-out/%s*" attribute))) (errbuf (get-buffer-create (format "*depot-errors/%s*" attribute))) (expression (format "let depot = import <depot> {}; in depot.nix.buildLisp.sbclWith [ depot.%s ]" attribute)) - (command (list "nix-build" "-I" (format "depot=%s" nix-depot-path) "-E" expression)) - (build-handler - (lambda (process event) - (unwind-protect - (pcase event - ("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) - (sly lisp-path))) - (_ (with-current-buffer errbuf - (error "Failed to build '%s':\n%s" attribute (buffer-string))))) - (kill-buffer outbuf) - (kill-buffer errbuf))))) + ;; TODO(tazjin): use <depot> + (command (list "nix-build" "-I" (format "depot=%s" nix-depot-path) "-E" expression))) (message "Acquiring Lisp for <depot>.%s" attribute) (make-process :name (format "depot-nix-build/%s" attribute) :buffer outbuf :stderr errbuf - :sentinel build-handler - :command command))) ; TODO(tazjin): use <depot> + :command command + :sentinel + (lambda (process event) + (unwind-protect + (pcase event + ("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) + (sly lisp-path))) + (_ (with-current-buffer errbuf + (error "Failed to build '%s':\n%s" attribute (buffer-string))))) + (kill-buffer outbuf) + (kill-buffer errbuf)))))) (provide 'nix-util) |