[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] Ratpoison path for genrpbindings
From: |
Jérémie Courrèges-Anglas |
Subject: |
[RP] Ratpoison path for genrpbindings |
Date: |
Mon, 27 May 2013 16:24:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) |
Hi,
currently genrpbindings uses the environment variable "$RATPOISON" when
generating bindings, faling back to "ratpoison" if the variable is
unset. I think it makes more sense to detect this at runtime rather
than at binding generation time.
|cos| on #ratpoison implemented the change for Perl bindings, here are
the missing bits for other languages. I only tested this diff roughly
(my daily use of ratpoison doesn't involve $RATPOISON nor language
bindings). Please report problems you spot.
Any opinions on just removing the use of $ENV{RATPOISON} at bindings
*generation* time?
On another subject, the clocc/port Common Lisp package could be easier
to install (all the cool kids use quicklisp these days, right?). If
someone more versed into CL could take a look at the alternatives or
write down a comment on how to easily install "port", that'd be nice.
Thanks,
--
Jérémie Courrèges-Anglas
PGP Key fingerprint: 61DB D9A0 00A4 67CF 2A90 8961 6191 8FBF 06A1 1494
diff --git a/contrib/genrpbindings b/contrib/genrpbindings
index ee91043..4d69888 100755
--- a/contrib/genrpbindings
+++ b/contrib/genrpbindings
@@ -41,7 +41,12 @@ use warnings;
$\="\n";
# set this to your rp binary
-$RATPOISON=$ENV{RATPOISON} || "ratpoison";
+if (defined($ENV{RATPOISON})) {
+ $RATPOISON = $ENV{RATPOISON};
+ print "Warning: using '$RATPOISON' as the path to the ratpoison binary";
+} else {
+ $RATPOISON = 'ratpoison';
+}
# open source file
$ACTIONS_C="../src/actions.c";
@@ -65,8 +70,8 @@ print PERL '$RATPOISON=$ENV{RATPOISON} ? $ENV{RATPOISON} :
"',$RATPOISON,'";';
print PERL 'sub command { my $a = "@_"; $a =~ s/(\')/\'\\\\\'\'/g; return
`$RATPOISON -c \'$a\'`; }';
# ELISP preamble
-print ELISP '(defvar ratpoison-program "',$RATPOISON,'")';
print ELISP <<PREAMBLE;
+(defvar ratpoison-program (or (getenv "RATPOISON") "$RATPOISON"))
(defmacro defun-ratpoison (cmd)
`(progn (defun ,(intern (concat "ratpoison-" (symbol-name cmd))) (&rest args)
@@ -91,7 +96,7 @@ PREAMBLE
print RUBY <<PREAMBLE;
module Ratpoison
- RATPOISON="$RATPOISON"
+ RATPOISON=ENV.fetch('RATPOISON', "$RATPOISON")
def command(command, *args)
return `#{RATPOISON} -c "#{command} #{args.join(' ')}"`
@@ -102,6 +107,7 @@ PREAMBLE
# Scheme preamble
print COMMONLISP <<PREAMBLE;
+(require :asdf :asdf-utils)
(defpackage :ratpoison
(:use :cl))
@@ -110,7 +116,9 @@ print COMMONLISP <<PREAMBLE;
(in-package :ratpoison)
-(defvar ratpoison-program "$RATPOISON")
+(defvar ratpoison-program
+ (or (asdf-utils:getenv "RATPOISON")
+ "$RATPOISON"))
(defmacro defun-ratpoison (cmd)
(let ((sym (intern (concatenate 'string "RP-" (symbol-name cmd)))))
@@ -143,9 +151,9 @@ PREAMBLE
print PYTHON <<PREAMBLE;
import os
-ratpoison="ratpoison -c "
+ratpoison = os.getenv('RATPOISON') or '$RATPOISON'
def rp_command( *args ):
- p = os.popen( ratpoison + '"' + (' '.join( args ) ) + '"', 'r' )
+ p = os.popen( ratpoison + ' -c ' + '"' + (' '.join( args ) ) + '"', 'r' )
r = p.readlines();
p.close();
return r
@@ -192,6 +200,9 @@ print ELISP '(provide \'ratpoison-cmd)';
# RUBY postamble
print RUBY "end";
+# COMMON-LISP postamble
+# nothing
+
# PYTHON postamble
# nothing
pgpvZetutvOAU.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [RP] Ratpoison path for genrpbindings,
Jérémie Courrèges-Anglas <=