[Openmcl-devel] External Programs and Piping

Steven Núñez steven.nunez at inference.sg
Thu Jan 1 09:46:22 PST 2015


Hi Ron,

Thanks. That does look like it will work, but it's a little more machinery that I want to put in place for a man page viewer. It's interesting that this topic hasn't come up before because it seems like something that would be very useful. Essentially I want a help system that will display man pages from the REPL, e.g. (help 'defun) and then have the man page displayed. Simply, yet surprisingly difficult to do.

The challenge in both cases (opening Preview or displaying in the REPL terminal) appears to be piping. In the REPL case, man would be piping to the value of PAGER, which might not be set in the environment, which leads me back to piping output of man to less. Unfortunately examples of piping are few, and documentation even rarer.

Anyone got a formula for taking the output of 'man', sending it to 'less' and displaying it on the terminal that the REPL is running in?


-          SteveN


From: Ron Garret [mailto:ron at flownet.com]
Sent: Wednesday, 31 December 2014 16:46
To: Steven Núñez
Cc: openmcl-devel at clozure.com
Subject: Re: [Openmcl-devel] External Programs and Piping

Try using bashlink, which is part of ergolib:

https://github.com/rongarret/ergolib

(bash "man -t ls | open -f -a /Applications/Preview.app/")

works for me, as does:

(join (bash "man ls") #\newline)

at least when you run CCL at the command prompt.  It doesn't work in the IDE, probably because the output of MAN has some funky embedded TTY controls in it that the IDE doesn't know how to deal with.

rg

On Dec 31, 2014, at 4:13 PM, Steven Núñez <steven.nunez at inference.sg<mailto:steven.nunez at inference.sg>> wrote:


Greeting everyone,

I'm trying to implement a system that will display manpages to the user from the REPL. There's a neat trick to convince Preview to do this here:

              http://www.devopsderek.com/blog/2013/03/10/view-man-pages-with-preview-on-mac-os-x/

But I can't seem to hit upon the right incantation to make this work from the CCL REPL. As a work-around / substitute I tried:

              (run-program "/usr/bin/man" '("ls") :output *standard-output*)

Which put the text of the man page in the REPL's terminal windows, but the manpage formatting is lost and it comes out as one big string of text. Efforts to pipe it to /usr/bin/less have failed. Seem piping, if working, isn't obvious.

Does anyone have any ideas?

Happy New Year,

-          SteveN


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com<mailto:Openmcl-devel at clozure.com>
https://lists.clozure.com/mailman/listinfo/openmcl-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20150101/72628785/attachment.htm>


More information about the Openmcl-devel mailing list