guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/07: emacs: Add 'guix-devel-lint-package'


From: Alex Kost
Subject: 07/07: emacs: Add 'guix-devel-lint-package'
Date: Fri, 09 Oct 2015 13:53:26 +0000

alezost pushed a commit to branch master
in repository guix.

commit b94ef11a538e19900c1f570500ac4dee73543844
Author: Alex Kost <address@hidden>
Date:   Thu Oct 1 21:16:18 2015 +0300

    emacs: Add 'guix-devel-lint-package'
    
    Suggested by Ludovic Courtès <address@hidden>.
    
    * 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 b6f2701..325e14e 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}).
 
address@hidden C-c . l
+Lint (check) a package defined by the current variable definition
+(@pxref{Invoking guix lint}) (@code{guix-devel-lint-package}).
+
 @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 7f758f5..547044f 100644
--- a/emacs/guix-devel.el
+++ b/emacs/guix-devel.el
@@ -76,11 +76,14 @@ Interactively, use the module defined by the current scheme 
file."
   "Setup REPL for using `guix-devel-...' commands."
   (guix-devel-use-modules "(guix monad-repl)"
                           "(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
   ;; <https://github.com/jaor/geiser/issues/83> for details.
   (guix-geiser-eval-in-repl-synchronously
-   "(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
@@ -119,6 +122,17 @@ run BODY."
                                       guix-use-substitutes)
                 "#:dry-run?" (guix-guile-boolean guix-dry-run)))))))
 
+(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
 
@@ -163,6 +177,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 "k") 'guix-devel-copy-module-as-kill)
     (define-key map (kbd "u") 'guix-devel-use-module)
     map)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]