From 7d2e03adbf29c1eb9658ccc017e0faf9dee1c390 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Mon, 25 Nov 2024 09:18:37 -0800 Subject: [PATCH] remove try_save_all() to ensure that no files are saved without intention --- DESCRIPTION | 1 - NEWS.md | 1 + R/rextendr_document.R | 2 -- R/try_save_all.R | 15 --------------- 4 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 R/try_save_all.R diff --git a/DESCRIPTION b/DESCRIPTION index ffefa8c5..7fb39554 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -61,7 +61,6 @@ Suggests: knitr, lintr, rmarkdown, - rstudioapi, testthat (>= 3.1.7), usethis VignetteBuilder: diff --git a/NEWS.md b/NEWS.md index ecc18976..81bc493e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # rextendr (development version) +* `document()` will no longer try to save all open files using rstudioapi * `use_cran_default()` has been removed as the default package template is CRAN compatible * `use_extendr()` now creates `tools/msrv.R`, `configure` and `configure.win`. These have been moved out of `use_cran_defaults()` * `Makevars` now prints linked static libraries at compile time by adding `--print=native-static-libs` to `RUSTFLAGS` diff --git a/R/rextendr_document.R b/R/rextendr_document.R index 85393b82..9883945d 100644 --- a/R/rextendr_document.R +++ b/R/rextendr_document.R @@ -10,8 +10,6 @@ #' @return No return value, called for side effects. #' @export document <- function(pkg = ".", quiet = FALSE, roclets = NULL) { - try_save_all(quiet = quiet) - withr::local_envvar(devtools::r_env_vars()) register_extendr(path = pkg, quiet = quiet) diff --git a/R/try_save_all.R b/R/try_save_all.R deleted file mode 100644 index 220f653a..00000000 --- a/R/try_save_all.R +++ /dev/null @@ -1,15 +0,0 @@ -#' Try to save open files if \pkg{rextendr} is called from an IDE. -#' -#' Uses rstudio API (if available) to save modified files. -#' Improves package development experience within RStudio. -#' @param quiet Logical scalar indicating whether the output should be quiet (`TRUE`) -#' or verbose (`FALSE`). -#' @noRd -try_save_all <- function(quiet = FALSE) { - if (requireNamespace("rstudioapi", quietly = TRUE) && rstudioapi::hasFun("documentSaveAll")) { - rstudioapi::documentSaveAll() - if (!isTRUE(quiet)) { - cli::cli_alert_success("Saving changes in the open files.") - } - } -}