On Apr 17, 2015 7:37 PM, "Paul Domaskis" <paul.domaskis at gmail.com> wrote:> I don't suppose there is a way to have it > automatically invoked when the window size/positition changes?Possibly, though it would take a little building. If you were to launch R directly when you start the xterm (loosely xterm R rather than the default) then R would receive a SIGWINCH signal whenever the xterm window size changes (xterm automatically sends this to its child process). R doesn't directly enable handling of the signal, but there's nothing to stop you loading a dynamic library with a little C code that set up a handler for SIGWINCH and, when it got one, ran the equivalent of the stty command to get the new width. The thing I've not been able to figure out is how the C code would ever then hand that to R asynchronously. Anyone? Cheers, - Peter
At this point, and since we are in an X windows context, I think it might be easier to use the window manager's features and write a little macro or something that will send my setwid() command to the active window, then assign it to a simple keystroke. Then: resize the window; hit the keystroke, and you're done. True, it's not fully automatic, but it would be pretty quick and easy. Either that or give ESS a try, using the bit that Ista offered. Or maybe Rstudio? Peter's got a good start, but I too would be stymied at the last step; definitely beyond my skill. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 4/18/15, 1:41 PM, "Peter Crowther" <peter.crowther at melandra.com> wrote:>On Apr 17, 2015 7:37 PM, "Paul Domaskis" <paul.domaskis at gmail.com> wrote: >> I don't suppose there is a way to have it >> automatically invoked when the window size/positition changes? > >Possibly, though it would take a little building. If you were to >launch R directly when you start the xterm (loosely xterm R rather >than the default) then R would receive a SIGWINCH signal whenever the >xterm window size changes (xterm automatically sends this to its child >process). R doesn't directly enable handling of the signal, but >there's nothing to stop you loading a dynamic library with a little C >code that set up a handler for SIGWINCH and, when it got one, ran the >equivalent of the stty command to get the new width. The thing I've >not been able to figure out is how the C code would ever then hand >that to R asynchronously. Anyone? > >Cheers, > >- Peter > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
Paul Domaskis <paul.domaskis <at> gmail.com> writes:> Yes, I found the width option in the help pages, but I was wondering > if there was automatic setting of the wrapping according to the > current window width. > > Your function works exactly as I wished. I'll probably get smarter > with time (I hope) but would it be reasonably good practice to stick > this into ~/.Rprofile? I don't suppose there is a way to have it > automatically invoked when the window size/positition changes? > (It's still priceless even without automatic triggering).Ista Zahn <istazahn <at> gmail.com> writes:> For ESS see > https://github.com/gaborcsardi/dot-emacs/blob/master/.emacsThanks, Ista....I'm...err....I'm a vim user <<cowers>>.... Peter Crowther <peter.crowther <at> melandra.com> writes:> Possibly, though it would take a little building. If you were to > launch R directly when you start the xterm (loosely xterm R rather > than the default) then R would receive a SIGWINCH signal whenever > the xterm window size changes (xterm automatically sends this to its > child process). R doesn't directly enable handling of the signal, > but there's nothing to stop you loading a dynamic library with a > little C code that set up a handler for SIGWINCH and, when it got > one, ran the equivalent of the stty command to get the new width. > The thing I've not been able to figure out is how the C code would > ever then hand that to R asynchronously. Anyone?MacQueen, Don <macqueen1 <at> llnl.gov> writes:> At this point, and since we are in an X windows context, I think it > might be easier to use the window manager's features and write a > little macro or something that will send my setwid() command to the > active window, then assign it to a simple keystroke. Then: resize > the window; hit the keystroke, and you're done. True, it's not fully > automatic, but it would be pretty quick and easy. > > Either that or give ESS a try, using the bit that Ista offered. Or > maybe Rstudio? > > Peter's got a good start, but I too would be stymied at the last > step; definitely beyond my skill.Peter, Don, Considering that I've been using Matlab, VBA, and Access for the last decade, I think that venturing down this path might take quite some time. I appreciate the ideas, and if I'm ever in the zone with programming under the hood with X-windows (which I use), I'll refer back. Thanks.