all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: guix-devel@gnu.org
Subject: [PATCH 1/4] emacs: Add code to pipe guix output to external program.
Date: Mon, 31 Aug 2015 00:04:23 +0300	[thread overview]
Message-ID: <1440968666-23605-2-git-send-email-alezost@gmail.com> (raw)
In-Reply-To: <1440968666-23605-1-git-send-email-alezost@gmail.com>

* 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)))))
+
 \f
 ;;; Lists of packages, lint checkers, etc.
 
-- 
2.4.3

  reply	other threads:[~2015-08-30 21:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-30 21:04 [PATCH 0/4] emacs: Add "View graph" action to graph popup Alex Kost
2015-08-30 21:04 ` Alex Kost [this message]
2015-08-31 21:29   ` [PATCH 1/4] emacs: Add code to pipe guix output to external program Ludovic Courtès
2015-08-30 21:04 ` [PATCH 2/4] emacs: Add code to run 'dot' program Alex Kost
2015-08-31 21:29   ` Ludovic Courtès
2015-08-30 21:04 ` [PATCH 3/4] emacs: Allow to choose 'find-file' function Alex Kost
2015-08-31 21:31   ` Ludovic Courtès
2015-09-01 10:05     ` Alex Kost
2015-08-30 21:04 ` [PATCH 4/4] emacs: Add "View graph" action to graph popup Alex Kost
2015-08-31 21:32   ` Ludovic Courtès
2015-08-31 21:28 ` [PATCH 0/4] " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440968666-23605-2-git-send-email-alezost@gmail.com \
    --to=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.