;;; Guix automation. (defun guix-build-package-at-point () "Evaluate sexp at point and build it in Geiser." (interactive) (let ((name (save-excursion (beginning-of-defun) (forward-char) ;skip ( (forward-sexp) ;define-public (forward-comment (point-max)) (symbol-at-point))) (sexp-string (save-mark-and-excursion (mark-defun) (buffer-substring-no-properties (region-beginning) (region-end))))) ;; Evaluate the package. (geiser-mode-switch-to-repl-and-enter) ;start geiser/load module (geiser-repl-switch) ;switch back to scheme buffer (guix-geiser-eval sexp-string) ;; ;; Build the package. (guix-geiser-eval "(use-modules (guix))") (guix-geiser-eval-in-repl (format ",build %s" name)) ;; TODO: Inspect if there's a log in the last 10 lines, if so, ;; open it. (let ((repl-text (save-mark-and-excursion (buffer-substring-no-properties (region-beginning) (region-end))))) (when (string-match (rx "View build log at '" (group (+ graphic)) "'.") repl-text) (guix-build-log-find-file (match-string 1 repl-text))))))