From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 4/4] emacs: Add "View graph" action to graph popup. Date: Mon, 31 Aug 2015 00:04:26 +0300 Message-ID: <1440968666-23605-5-git-send-email-alezost@gmail.com> References: <1440968666-23605-1-git-send-email-alezost@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9mg-0001H5-Bw for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZW9mf-0003zn-BI for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:02 -0400 Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]:33176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9mf-0003z3-4D for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:01 -0400 Received: by lbbsx3 with SMTP id sx3so51175692lbb.0 for ; Sun, 30 Aug 2015 14:05:00 -0700 (PDT) Received: from localhost.localdomain ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id f1sm3353473laf.15.2015.08.30.14.04.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Aug 2015 14:04:59 -0700 (PDT) In-Reply-To: <1440968666-23605-1-git-send-email-alezost@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * 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 file 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. -- 2.4.3