guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/04: emacs: Add "View graph" action to graph popup.


From: Alex Kost
Subject: 04/04: emacs: Add "View graph" action to graph popup.
Date: Tue, 01 Sep 2015 10:05:03 +0000

alezost pushed a commit to branch master
in repository guix.

commit 761d6fd9c16801a13d1abe0a6951e793144ae791
Author: Alex Kost <address@hidden>
Date:   Sun Aug 30 18:52:30 2015 +0300

    emacs: Add "View graph" action to graph popup.
    
    * emacs/guix-command.el: Require 'guix-external'.
      (guix-run-view-graph): New function.
      (guix-command-additional-execute-arguments,
      guix-command-special-executors): Add entries for "View graph" action.
---
 emacs/guix-command.el |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/emacs/guix-command.el b/emacs/guix-command.el
index 139724d..3513300 100644
--- a/emacs/guix-command.el
+++ b/emacs/guix-command.el
@@ -65,6 +65,7 @@
 (require 'guix-help-vars)
 (require 'guix-read)
 (require 'guix-base)
+(require 'guix-external)
 
 (defgroup guix-commands nil
   "Settings for guix popup windows."
@@ -490,7 +491,9 @@ to be modified."
   "List of default 'execute' action arguments.")
 
 (defvar guix-command-additional-execute-arguments
-  nil
+  `((("graph")
+     ,(guix-command-make-argument
+       :name "view" :char ?v :doc "View graph")))
   "Alist of guix commands and additional 'execute' action arguments.")
 
 (defun guix-command-execute-arguments (commands)
@@ -508,7 +511,9 @@ to be modified."
   '((("environment")
      ("repl" . guix-run-environment-command-in-repl))
     (("pull")
-     ("repl" . guix-run-pull-command-in-repl)))
+     ("repl" . guix-run-pull-command-in-repl))
+    (("graph")
+     ("view" . guix-run-view-graph)))
   "Alist of guix commands and alists of special executers for them.
 See also `guix-command-default-executors'.")
 
@@ -545,6 +550,15 @@ Perform pull-specific actions after operation, see
    (apply #'guix-make-guile-expression 'guix-command args)
    nil 'pull))
 
+(defun guix-run-view-graph (args)
+  "Run 'guix ARGS ...' graph command, make the image and open it."
+  (let* ((graph-file (guix-dot-file-name))
+         (dot-args   (guix-dot-arguments graph-file)))
+    (if (guix-eval-read (guix-make-guile-expression
+                         'pipe-guix-output args dot-args))
+        (guix-find-file graph-file)
+      (error "Couldn't create a graph"))))
+
 
 ;;; Generating popups, actions, etc.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]