From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 1/4] emacs: Add code to pipe guix output to external program. Date: Mon, 31 Aug 2015 00:04:23 +0300 Message-ID: <1440968666-23605-2-git-send-email-alezost@gmail.com> References: <1440968666-23605-1-git-send-email-alezost@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9mf-0001Gc-3X for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZW9mc-0003xn-I9 for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:01 -0400 Received: from mail-la0-x231.google.com ([2a00:1450:4010:c03::231]:35577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9mc-0003xX-A6 for guix-devel@gnu.org; Sun, 30 Aug 2015 17:04:58 -0400 Received: by lanb10 with SMTP id b10so24913736lan.2 for ; Sun, 30 Aug 2015 14:04:57 -0700 (PDT) Received: from localhost.localdomain ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id f1sm3353473laf.15.2015.08.30.14.04.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Aug 2015 14:04:57 -0700 (PDT) In-Reply-To: <1440968666-23605-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-main.scm: Use (ice-9 popen) module. (pipe-guix-output): New procedure. --- emacs/guix-main.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index fe224fb..8d3a881 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -45,6 +45,7 @@ (use-modules (ice-9 vlist) (ice-9 match) + (ice-9 popen) (srfi srfi-1) (srfi srfi-2) (srfi srfi-11) @@ -949,6 +950,15 @@ GENERATIONS is a list of generation numbers." "Return string with 'guix COMMANDS ... --help' output." (apply guix-command-output `(,@commands "--help"))) +(define (pipe-guix-output guix-args command-args) + "Run 'guix GUIX-ARGS ...' command and pipe its output to a shell command +defined by COMMAND-ARGS. +Return #t if the shell command was executed successfully." + (let ((pipe (apply open-pipe* OPEN_WRITE command-args))) + (with-output-to-port pipe + (lambda () (apply guix-command guix-args))) + (zero? (status:exit-val (close-pipe pipe))))) + ;;; Lists of packages, lint checkers, etc. -- 2.4.3