emacs: Add "View build log" action to build popup.
* emacs/guix-command.el (guix-run-view-build-log): New function. (guix-command-additional-execute-arguments, guix-command-special-executors): Add entries for "View build log" action. * emacs/guix-utils.el (guix-find-file-or-url): New function.master
parent
34850cd59d
commit
83d95c7b36
|
@ -497,7 +497,10 @@ to be modified."
|
||||||
"List of default 'execute' action arguments.")
|
"List of default 'execute' action arguments.")
|
||||||
|
|
||||||
(defvar guix-command-additional-execute-arguments
|
(defvar guix-command-additional-execute-arguments
|
||||||
`((("graph")
|
`((("build")
|
||||||
|
,(guix-command-make-argument
|
||||||
|
:name "log" :char ?l :doc "View build log"))
|
||||||
|
(("graph")
|
||||||
,(guix-command-make-argument
|
,(guix-command-make-argument
|
||||||
:name "view" :char ?v :doc "View graph")))
|
:name "view" :char ?v :doc "View graph")))
|
||||||
"Alist of guix commands and additional 'execute' action arguments.")
|
"Alist of guix commands and additional 'execute' action arguments.")
|
||||||
|
@ -518,6 +521,8 @@ to be modified."
|
||||||
("repl" . guix-run-environment-command-in-repl))
|
("repl" . guix-run-environment-command-in-repl))
|
||||||
(("pull")
|
(("pull")
|
||||||
("repl" . guix-run-pull-command-in-repl))
|
("repl" . guix-run-pull-command-in-repl))
|
||||||
|
(("build")
|
||||||
|
("log" . guix-run-view-build-log))
|
||||||
(("graph")
|
(("graph")
|
||||||
("view" . guix-run-view-graph)))
|
("view" . guix-run-view-graph)))
|
||||||
"Alist of guix commands and alists of special executers for them.
|
"Alist of guix commands and alists of special executers for them.
|
||||||
|
@ -556,6 +561,18 @@ Perform pull-specific actions after operation, see
|
||||||
(apply #'guix-make-guile-expression 'guix-command args)
|
(apply #'guix-make-guile-expression 'guix-command args)
|
||||||
nil 'pull))
|
nil 'pull))
|
||||||
|
|
||||||
|
(defun guix-run-view-build-log (args)
|
||||||
|
"Add --log-file to ARGS, run 'guix ARGS ...' build command, and
|
||||||
|
open the log file(s)."
|
||||||
|
(let* ((args (if (member "--log-file" args)
|
||||||
|
args
|
||||||
|
(apply #'list (car args) "--log-file" (cdr args))))
|
||||||
|
(output (guix-command-output args))
|
||||||
|
(files (split-string output "\n" t)))
|
||||||
|
(dolist (file files)
|
||||||
|
(guix-find-file-or-url file)
|
||||||
|
(guix-build-log-mode))))
|
||||||
|
|
||||||
(defun guix-run-view-graph (args)
|
(defun guix-run-view-graph (args)
|
||||||
"Run 'guix ARGS ...' graph command, make the image and open it."
|
"Run 'guix ARGS ...' graph command, make the image and open it."
|
||||||
(let* ((graph-file (guix-dot-file-name))
|
(let* ((graph-file (guix-dot-file-name))
|
||||||
|
|
|
@ -208,6 +208,16 @@ single argument."
|
||||||
(funcall guix-find-file-function file)
|
(funcall guix-find-file-function file)
|
||||||
(message "File '%s' does not exist." file)))
|
(message "File '%s' does not exist." file)))
|
||||||
|
|
||||||
|
(defvar url-handler-regexp)
|
||||||
|
|
||||||
|
(defun guix-find-file-or-url (file-or-url)
|
||||||
|
"Find FILE-OR-URL."
|
||||||
|
(require 'url-handlers)
|
||||||
|
(let ((file-name-handler-alist
|
||||||
|
(cons (cons url-handler-regexp 'url-file-handler)
|
||||||
|
file-name-handler-alist)))
|
||||||
|
(find-file file-or-url)))
|
||||||
|
|
||||||
(defmacro guix-while-search (regexp &rest body)
|
(defmacro guix-while-search (regexp &rest body)
|
||||||
"Evaluate BODY after each search for REGEXP in the current buffer."
|
"Evaluate BODY after each search for REGEXP in the current buffer."
|
||||||
(declare (indent 1) (debug t))
|
(declare (indent 1) (debug t))
|
||||||
|
|
Reference in New Issue