Ratpoison path for genrpbindings

[email protected] (Jérémie Courrèges-Anglas)
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <[email protected]>
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

_______________________________________________
Ratpoison-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/ratpoison-devel
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (OpenBSD)

iQIcBAEBCgAGBQJRo2ylAAoJEGGRj78GoRSUXPgP/2Ruwd5tdVEfBODlbEVRfw/k
pYDPWHSiZiKzrfp0VWB3wasfBuqgAPqCJ73JiZqX0t1IooAOAIp99hzs4S/LJg8k
uHORvYkzB5GJs7vMx105rczsmZXgVzYAZExWRajd9qjK6aFZhGHcvVexKNC7eGjW
GYr9EJXkKpku6YcAmtFKBqtZW0KLlrLnRC+oAoaXVWlw638erwx9vUdgFnwho9xJ
IXW49QZPIq9HE+ix6Ia2A53rrgGMhOEDj00g8UibjFbUgyOD8r6Ad9tEiAexu4OK
d9wQM53JxFJf8jHReJuV/9puRB1GxWYgymsnp3twku1QoEqoxJHCcv4mcIeCtB6e
m0KfXqM1NZ4j3IhTGGf1zDWQv1F6mlWuuCQW/k1IyMn3aHmfOu926mfLnPDpb4rb
0Yl0GMg6jsGzHyMWnkeDpXBK11ZGCKglYafsS6h1OlMWYTqbSLDbS0ln46ChvdZ/
2mPe940VAamrJyj+RW7Xri9Xqpc/ipKh2+u7s3MPnkGJF8smhsg5LXp0XCUR3ghq
ana643PM2mLicnVeAd0iU5Vo+mbh5+7tCT/LbM5lOJyd+syjexi+YYUHb79zKRHS
UnQU2rIzi1km9SHqkmbLOvo5LokrqOOR0eNRx/kngpd3p1li7nIR+6DEp9SsQHTM
qLLgzYfUclhNHt5sIxw6
=+eOq
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.