Re: Execute a subprocess that takes input e.g. emacs
Thanks for the feedback Andy. I had a console-only emacs installed but I've reinstalled and confirmed one with X works. I was expecting a console editor to work as well as it does in ruby e.g. system(emacs -nw) but I'm guessing there's a limitation for java. Calling X emacs works for my use case but I'd be interested to hear if anyone solves opening a console editor. On Sun, Feb 3, 2013 at 6:50 PM, Andy Fingerhut andy.finger...@gmail.comwrote: I was able to open an X windows emacs session using: (require '[clojure.java.shell :as sh]) (sh/sh emacs) on my system. The REPL did not give another prompt until I quit that emacs invocation. I was able to get another REPL prompt immediately using this: (future (sh/sh emacs)) When I tried running the terminal version of emacs without using the X window system, it gave a valid complaint like this: user= (sh/sh emacs -nw) {:exit 1, :out , :err emacs: standard input is not a tty\n} You can also specify the file name and line number where the cursor should initially be placed like so: (sh/sh emacs +57 foo.txt) In case it matters what versions of things I am using, I was able to get similar results above on both of the following systems: Mac OS X 10.6.8 + Oracle/Apple JDK 1.6.0_37 + Leiningen 2.0.0 + Clojure 1.5.0-RC2 Ubuntu 11.10 32-bit desktop + Oracle JDK 1.6.0_38 + Leiningen 2.0.0 + Clojure 1.5.0-RC4 I also tried it with Clojure 1.4.0 with the same good results. Andy On Feb 3, 2013, at 2:30 PM, Gabriel Horner wrote: Hi, Is there a straightforward way to invoke an editor within clojure e.g. (clojure.java.shell/sh emacs some-file)? I've taken a look at popular shell libraries like conch and stevedore but found nothing helpful. If you're curious why I want to do it, it's to open a lein dependency in emacs from the commandline, https://github.com/cldwalker/lein-open . Thanks, Gabriel -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Execute a subprocess that takes input e.g. emacs
Hi, Is there a straightforward way to invoke an editor within clojure e.g. (clojure.java.shell/sh emacs some-file)? I've taken a look at popular shell libraries like conch and stevedore but found nothing helpful. If you're curious why I want to do it, it's to open a lein dependency in emacs from the commandline, https://github.com/cldwalker/lein-open . Thanks, Gabriel -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Execute a subprocess that takes input e.g. emacs
I was able to open an X windows emacs session using: (require '[clojure.java.shell :as sh]) (sh/sh emacs) on my system. The REPL did not give another prompt until I quit that emacs invocation. I was able to get another REPL prompt immediately using this: (future (sh/sh emacs)) When I tried running the terminal version of emacs without using the X window system, it gave a valid complaint like this: user= (sh/sh emacs -nw) {:exit 1, :out , :err emacs: standard input is not a tty\n} You can also specify the file name and line number where the cursor should initially be placed like so: (sh/sh emacs +57 foo.txt) In case it matters what versions of things I am using, I was able to get similar results above on both of the following systems: Mac OS X 10.6.8 + Oracle/Apple JDK 1.6.0_37 + Leiningen 2.0.0 + Clojure 1.5.0-RC2 Ubuntu 11.10 32-bit desktop + Oracle JDK 1.6.0_38 + Leiningen 2.0.0 + Clojure 1.5.0-RC4 I also tried it with Clojure 1.4.0 with the same good results. Andy On Feb 3, 2013, at 2:30 PM, Gabriel Horner wrote: Hi, Is there a straightforward way to invoke an editor within clojure e.g. (clojure.java.shell/sh emacs some-file)? I've taken a look at popular shell libraries like conch and stevedore but found nothing helpful. If you're curious why I want to do it, it's to open a lein dependency in emacs from the commandline, https://github.com/cldwalker/lein-open . Thanks, Gabriel -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.