From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 2/4] emacs: Add 'guix-devel-download-package-source'. Date: Fri, 2 Oct 2015 16:04:04 +0300 Message-ID: <1443791046-1015-3-git-send-email-alezost@gmail.com> References: <1443791046-1015-1-git-send-email-alezost@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi00j-0007E8-Em for guix-devel@gnu.org; Fri, 02 Oct 2015 09:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi00f-0001pg-Ld for guix-devel@gnu.org; Fri, 02 Oct 2015 09:04:29 -0400 Received: from mail-la0-x233.google.com ([2a00:1450:4010:c03::233]:32780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi00f-0001pb-Eo for guix-devel@gnu.org; Fri, 02 Oct 2015 09:04:25 -0400 Received: by lafb9 with SMTP id b9so3945773laf.0 for ; Fri, 02 Oct 2015 06:04:24 -0700 (PDT) Received: from localhost.localdomain ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id a188sm1516555lfa.9.2015.10.02.06.04.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Oct 2015 06:04:24 -0700 (PDT) In-Reply-To: <1443791046-1015-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-devel.el (guix-devel-setup-repl): Use (guix packages) module. (guix-devel-download-package-source): New command. (guix-devel-keys-map): Add key binding for it. * doc/emacs.texi (Emacs Development): Document it. --- doc/emacs.texi | 6 ++++++ emacs/guix-devel.el | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/doc/emacs.texi b/doc/emacs.texi index b6f2701..00f86f3 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -667,6 +667,12 @@ this command---for example, with @kbd{C-M-x} (@pxref{To eval or not to eval,,, geiser, Geiser User Manual}) (@code{guix-devel-build-package-definition}). +@item C-c . s +Download a source of the package defined by the current variable +definition and print its SHA256 hash. This command has the same meaning +as running @code{guix download} on the package source (@pxref{Invoking +guix download}) (@code{guix-devel-download-package-source}). + @end table Unluckily, there is a limitation related to long-running REPL commands. diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el index ee7629f..a8167a0 100644 --- a/emacs/guix-devel.el +++ b/emacs/guix-devel.el @@ -69,6 +69,7 @@ Interactively, use the module defined by the current scheme file." (defun guix-devel-setup-repl (&optional repl) "Setup REPL for using `guix-devel-...' commands." (guix-devel-use-modules "(guix monad-repl)" + "(guix packages)" "(guix scripts)" "(guix store)") ;; Without this workaround, the build output disappears. See @@ -113,6 +114,18 @@ run BODY." guix-use-substitutes) "#:dry-run?" (guix-guile-boolean guix-dry-run))))))) +(defun guix-devel-download-package-source () + "Download the source of the current package. +Use this function to compute SHA256 hash of the package source." + (interactive) + (guix-devel-with-definition def + (guix-devel-use-modules "(guix scripts download)") + (when (or (not guix-operation-confirm) + (y-or-n-p (format "Download '%s' package source?" def))) + (guix-geiser-eval-in-repl + (format "(guix-download (origin-uri (package-source %s)))" + def))))) + ;;; Font-lock @@ -151,6 +164,7 @@ to find 'modify-phases' keywords." (defvar guix-devel-keys-map (let ((map (make-sparse-keymap))) (define-key map (kbd "b") 'guix-devel-build-package-definition) + (define-key map (kbd "s") 'guix-devel-download-package-source) (define-key map (kbd "k") 'guix-devel-copy-module-as-kill) (define-key map (kbd "u") 'guix-devel-use-module) map) -- 2.5.0