From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH] emacs: Add "View graph" actions to system graph commands. Date: Thu, 15 Oct 2015 22:46:21 +0300 Message-ID: <87a8rjkj8y.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmoTo-0002BK-8U for guix-devel@gnu.org; Thu, 15 Oct 2015 15:46:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmoTl-0007gN-1T for guix-devel@gnu.org; Thu, 15 Oct 2015 15:46:24 -0400 Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]:35847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmoTk-0007gH-Lp for guix-devel@gnu.org; Thu, 15 Oct 2015 15:46:20 -0400 Received: by lbcao8 with SMTP id ao8so82278034lbc.3 for ; Thu, 15 Oct 2015 12:46:20 -0700 (PDT) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id oi5sm2263976lbb.13.2015.10.15.12.46.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 12:46:19 -0700 (PDT) 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 --=-=-= Content-Type: text/plain I like graph commands. Thanks, Ludo! This patch adds "View graph" action for the new "M-x guix RET system" commands. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-emacs-Add-View-graph-actions-to-system-graph-command.patch >From 79027171c9be2cececde951caf54758c4e1bb8f5 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Thu, 15 Oct 2015 22:10:32 +0300 Subject: [PATCH] emacs: Add "View graph" actions to system graph commands. * emacs/guix-command.el (guix-command-additional-execute-arguments, guix-command-special-executors): Add "View graph" actions for 'dmd-graph' and 'extension-graph' commands. * doc/emacs.texi (Emacs Popup Interface): Document "View graph" action. --- doc/emacs.texi | 31 +++++++++++++++++++++++++++++++ emacs/guix-command.el | 26 ++++++++++++++++---------- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/doc/emacs.texi b/doc/emacs.texi index ab69515..cfd2301 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -531,6 +531,37 @@ GNU Emacs Manual}). @end itemize +Several commands (@command{guix graph}, @command{guix system dmd-graph} +and @command{guix system extension-graph}) also have a ``View graph'' +action, which allows to view a generated graph using @command{dot} +command (specified by @code{guix-dot-program} variable). By default a +PNG file will be saved in @file{/tmp} directory and will be opened +directly in Emacs. This behavior may be changed with the following +variables: + +@table @code + +@item guix-find-file-function +Function used to open a generated graph. If you want to open a graph in +an external program, you can do it by modifying this variable---for +example, you can use a functionality provided by the Org Mode +(@pxref{Top,,, org, The Org Manual}): + +@example +(setq guix-find-file-function 'org-open-file) +(add-to-list 'org-file-apps '("\\.png\\'" . "sxiv %s")) +@end example + +@item guix-dot-default-arguments +Command line arguments to run @command{dot} command. If you change an +output format (for example, into @code{-Tpdf}), you also need to change +the next variable. + +@item guix-dot-file-name-function +Function used to define a name of the generated graph file. Default +name is @file{/tmp/graph-XXXXXX.png}. + +@end table @node Emacs Prettify @section Guix Prettify Mode diff --git a/emacs/guix-command.el b/emacs/guix-command.el index 3ae7791..1a42594 100644 --- a/emacs/guix-command.el +++ b/emacs/guix-command.el @@ -499,15 +499,17 @@ to be modified." "List of default 'execute' action arguments.") (defvar guix-command-additional-execute-arguments - `((("build") - ,(guix-command-make-argument - :name "log" :char ?l :doc "View build log")) - (("graph") - ,(guix-command-make-argument - :name "view" :char ?v :doc "View graph")) - (("size") - ,(guix-command-make-argument - :name "view" :char ?v :doc "View map"))) + (let ((graph-arg (guix-command-make-argument + :name "view" :char ?v :doc "View graph"))) + `((("build") + ,(guix-command-make-argument + :name "log" :char ?l :doc "View build log")) + (("graph") ,graph-arg) + (("size") + ,(guix-command-make-argument + :name "view" :char ?v :doc "View map")) + (("system" "dmd-graph") ,graph-arg) + (("system" "extension-graph") ,graph-arg))) "Alist of guix commands and additional 'execute' action arguments.") (defun guix-command-execute-arguments (commands) @@ -531,7 +533,11 @@ to be modified." (("graph") ("view" . guix-run-view-graph)) (("size") - ("view" . guix-run-view-size-map))) + ("view" . guix-run-view-size-map)) + (("system" "dmd-graph") + ("view" . guix-run-view-graph)) + (("system" "extension-graph") + ("view" . guix-run-view-graph))) "Alist of guix commands and alists of special executers for them. See also `guix-command-default-executors'.") -- 2.5.0 --=-=-=--