On 27 June 2025 at 17:21, Martin Maechler wrote: | >>>>> Dirk Eddelbuettel | >>>>> on Fri, 27 Jun 2025 09:22:36 -0500 writes: | | > The interactive() predicate is helpful in scripted environments. I sometimes | > also invoke R with '--quiet' and am unable to suppress messages from my own | > startup code as I cannot test if this flag was set or not. (I can work around | > it by setting an additional environment variable, but that is clunky.) For me | > '--quiet' is independent to 'interactive'. | | > R carries the state internally in the integer variable R_Quiet, so a minimal | > patch only needs to expose an accessor 'quiet()' model after 'interactive()'. | > Then we get the desired behaviour: | | > ~/svn/r-devel$ RD -q | >> quiet() | > [1] TRUE | >> | | > and this is similarly FALSE in a normal startup without '-q'. | | > Would this change be of interest? The patch is just a few lines (but does | > not yet contain Rd file changes). | | As Duncan Murdoch recently explained "here" (in the R mailinglists-verse), | this is indeed a change that only R-core could do .. and I agree
Rest assured that I am aware of that. | that the change would be relatively small, or rather that most of | the work here would be writing / updating documentation, NEWS, etc. | | On the other hand, this functionality has been "implicitly" in R, forever : | | > "--quiet" %in% commandArgs() | [1] FALSE Ah. Had not thought of that. I could wrap that in a one-line function or use it directly. But not, it doesn't actually work for the '-q | --quiet' equivalence so we would have to test both which is twice as clunky: ~/git/rcpp(feature/release_1.1.0)$ RD -q > "--quiet" %in% commandArgs() [1] FALSE > quiet() [1] TRUE > | ... though I agree that using commandArgs() looks a bit "clunky" Yes. Especially in "doubled-up use" for '-q' and '--quiet'. | and may not always do the expected thing (embedded use of R; R | Studio / Positron / ....). | | What do you think? Well I *wrote* the patch. I wrote the email to gauge if someone from R Core would consider the patch. So "what do you think" ? Cheers, Dirk | Best, | Martin | | > Cheers, Dirk | | > -- | > dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel