From e2a8115ba8e871b69bba1d3b7b81d1008441e768 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 11 Sep 2023 21:05:41 -0700 Subject: [PATCH] [oni-core] Add command to copy the guix build hash This is convenient when I'm writing Guix packages. --- oni-core.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/oni-core.el b/oni-core.el index 029d51d..9f76fbb 100644 --- a/oni-core.el +++ b/oni-core.el @@ -527,5 +527,17 @@ which normally have their errors suppressed." (when (treesit-available-p) (add-to-list 'interpreter-mode-alist '("bash" . bash-ts-mode))) +(defun oni-core-copy-guix-build-hash () + "Try and find the last actual hash in the compilation buffer and insert it." + (interactive) + (insert + (with-current-buffer compilation-last-buffer + (save-excursion + (save-match-data + (goto-char (point-max)) + (re-search-backward (rx bol (zero-or-more whitespace) "actual hash:" (one-or-more whitespace))) + (goto-char (match-end 0)) + (buffer-substring-no-properties (point) (line-end-position))))))) + (provide 'oni-core) ;;; oni-core.el ends here