1
0
Fork 0

[oni-core] Add command to copy the guix build hash

This is convenient when I'm writing Guix packages.
This commit is contained in:
Tom Willemse 2023-09-11 21:05:41 -07:00
parent 120bf9048f
commit e2a8115ba8

View file

@ -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