From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 4/4] emacs: Add 'guix-devel-lint-package' Date: Fri, 2 Oct 2015 16:04:06 +0300 Message-ID: <1443791046-1015-5-git-send-email-alezost@gmail.com> References: <1443791046-1015-1-git-send-email-alezost@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi00j-0007E7-Eq for guix-devel@gnu.org; Fri, 02 Oct 2015 09:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi00h-0001qU-A4 for guix-devel@gnu.org; Fri, 02 Oct 2015 09:04:29 -0400 Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]:33493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi00h-0001qP-3P for guix-devel@gnu.org; Fri, 02 Oct 2015 09:04:27 -0400 Received: by lbos8 with SMTP id s8so26033252lbo.0 for ; Fri, 02 Oct 2015 06:04:26 -0700 (PDT) Received: from localhost.localdomain ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id a188sm1516555lfa.9.2015.10.02.06.04.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Oct 2015 06:04:25 -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 Suggested by Ludovic Courtès . * emacs/guix-devel.el (guix-devel-setup-repl): Add a workaround for 'guix-warning-port'. (guix-devel-lint-package): New command. (guix-devel-keys-map): Add key binding for it. * doc/emacs.texi (Emacs Development): Document it. --- doc/emacs.texi | 4 ++++ emacs/guix-devel.el | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/emacs.texi b/doc/emacs.texi index 00f86f3..18009fa 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -667,6 +667,10 @@ 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 . l +Lint (check) a package defined by the current variable definition +(@pxref{Invoking guix lint}) (@code{guix-devel-lint-package}). + @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 diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el index a8167a0..4d380ce 100644 --- a/emacs/guix-devel.el +++ b/emacs/guix-devel.el @@ -71,11 +71,14 @@ Interactively, use the module defined by the current scheme file." (guix-devel-use-modules "(guix monad-repl)" "(guix packages)" "(guix scripts)" - "(guix store)") - ;; Without this workaround, the build output disappears. See + "(guix store)" + "(guix ui)") + ;; Without this workaround, the warning/build output disappears. See ;; for details. (guix-geiser-eval-in-repl - "(current-build-output-port (current-error-port))" + "(begin + (guix-warning-port (current-warning-port)) + (current-build-output-port (current-error-port)))" repl 'no-history 'no-display)) (defvar guix-devel-repl-processes nil @@ -126,6 +129,17 @@ Use this function to compute SHA256 hash of the package source." (format "(guix-download (origin-uri (package-source %s)))" def))))) +(defun guix-devel-lint-package () + "Check the current package. +See Info node `(guix) Invoking guix lint' for details." + (interactive) + (guix-devel-with-definition def + (guix-devel-use-modules "(guix scripts lint)") + (when (or (not guix-operation-confirm) + (y-or-n-p (format "Lint '%s' package?" def))) + (guix-geiser-eval-in-repl + (format "(run-checkers %s)" def))))) + ;;; Font-lock @@ -164,6 +178,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 "l") 'guix-devel-lint-package) (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) -- 2.5.0