From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH] emacs: Add "View map" action to 'size' popup. Date: Tue, 22 Sep 2015 13:09:55 +0300 Message-ID: <87y4fyepe4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeKWP-0005Dz-BB for guix-devel@gnu.org; Tue, 22 Sep 2015 06:10:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeKWK-0000sU-7e for guix-devel@gnu.org; Tue, 22 Sep 2015 06:10:01 -0400 Received: from mail-la0-x22f.google.com ([2a00:1450:4010:c03::22f]:33371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeKWJ-0000sK-VX for guix-devel@gnu.org; Tue, 22 Sep 2015 06:09:56 -0400 Received: by lamp12 with SMTP id p12so5808335lam.0 for ; Tue, 22 Sep 2015 03:09:55 -0700 (PDT) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id y7sm126526laa.2.2015.09.22.03.09.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Sep 2015 03:09:54 -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 Just another action for "M-x guix". --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-emacs-Add-View-map-action-to-size-popup.patch >From aec97eb453a031352c48c678f49d9047628e82f7 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Mon, 21 Sep 2015 20:11:18 +0300 Subject: [PATCH] emacs: Add "View map" action to 'size' popup. * emacs/guix-command.el (guix-run-view-size-map): New function. (guix-command-additional-execute-arguments, guix-command-special-executors): Add entries for "View map" action. --- emacs/guix-command.el | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/emacs/guix-command.el b/emacs/guix-command.el index 6fdfb93..c573c8c 100644 --- a/emacs/guix-command.el +++ b/emacs/guix-command.el @@ -502,7 +502,10 @@ to be modified." :name "log" :char ?l :doc "View build log")) (("graph") ,(guix-command-make-argument - :name "view" :char ?v :doc "View graph"))) + :name "view" :char ?v :doc "View graph")) + (("size") + ,(guix-command-make-argument + :name "view" :char ?v :doc "View map"))) "Alist of guix commands and additional 'execute' action arguments.") (defun guix-command-execute-arguments (commands) @@ -524,7 +527,9 @@ to be modified." (("build") ("log" . guix-run-view-build-log)) (("graph") - ("view" . guix-run-view-graph))) + ("view" . guix-run-view-graph)) + (("size") + ("view" . guix-run-view-size-map))) "Alist of guix commands and alists of special executers for them. See also `guix-command-default-executors'.") @@ -582,6 +587,23 @@ open the log file(s)." (guix-find-file graph-file) (error "Couldn't create a graph")))) +(defun guix-run-view-size-map (args) + "Run 'guix ARGS ...' size command, and open the map file." + (let* ((wished-map-file + (cl-some (lambda (arg) + (and (string-match "--map-file=\\(.+\\)" arg) + (match-string 1 arg))) + args)) + (map-file (or wished-map-file (guix-png-file-name))) + (args (if wished-map-file + args + (apply #'list + (car args) + (concat "--map-file=" map-file) + (cdr args))))) + (guix-command-output args) + (guix-find-file map-file))) + ;;; Generating popups, actions, etc. -- 2.5.0 --=-=-=--