From 9a39df31f58c11dc105aa7b525d78f515ecbd757 Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Sat, 27 Jan 2018 13:59:58 -0600 Subject: [PATCH] Relocate the package startup messages into the `enable_errorist()` / `disable_errorist()` modes. Remove enable/disable calls in package documentation proceeding shim activation. --- R/handlers.R | 10 ++-------- R/zzz.R | 10 ++-------- man/errorist_init.Rd | 3 --- man/shims.Rd | 5 ----- 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/R/handlers.R b/R/handlers.R index 0aa247f..cb7a63c 100644 --- a/R/handlers.R +++ b/R/handlers.R @@ -20,9 +20,6 @@ #' @author James Joseph Balamuta #' @examples #' -#' # Disable errorist mode if already engaged. -#' disable_errorist() -#' #' ### Default search engine is Google #' #' # Enable automatic search @@ -51,6 +48,7 @@ #' @rdname errorist_init enable_errorist = function(error_search_func = getOption("errorist.warning", searcher::search_google), warning_search_func = getOption("errorist.warning", searcher::search_google)) { + message("Warnings and errors will automatically trigger a web search.") enable_error_shim(error_search_func) enable_warning_shim(warning_search_func) } @@ -58,6 +56,7 @@ enable_errorist = function(error_search_func = getOption("errorist.warning", sea #' @export #' @rdname errorist_init disable_errorist = function() { + message("Warnings and errors are no longer automatically searched.") disable_error_shim() disable_warning_shim() } @@ -132,8 +131,6 @@ warning_handler = function(search_func = #' @author James Joseph Balamuta #' @examples #' -#' # Disable the errorist hooks if already loaded -#' disable_errorist() #' #' # Default setup #' enable_warning_shim() @@ -179,9 +176,6 @@ disable_warning_shim = function() { #' @export #' @examples #' -#' # Disable the errorist hooks if already loaded -#' disable_errorist() -#' #' # Enable only the error shim #' enable_error_shim() #' diff --git a/R/zzz.R b/R/zzz.R index 989f2e5..7631de0 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -8,20 +8,14 @@ "Please supply either: TRUE or FALSE.") } else if (autoload_config == TRUE) { - packageStartupMessage("Warnings and errors will automatically trigger a web search.") - - enable_error_shim() - enable_warning_shim() + enable_errorist() } invisible() } .onUnload = function(libpath) { - message("Warnings and errors are no longer automatically searched.") - - disable_error_shim() - disable_warning_shim() + disable_errorist() invisible() } diff --git a/man/errorist_init.Rd b/man/errorist_init.Rd index 35634fb..8ae41d7 100644 --- a/man/errorist_init.Rd +++ b/man/errorist_init.Rd @@ -34,9 +34,6 @@ wish to disable warnings or error individually, please use either } \examples{ -# Disable errorist mode if already engaged. -disable_errorist() - ### Default search engine is Google # Enable automatic search diff --git a/man/shims.Rd b/man/shims.Rd index d73e162..66f33c0 100644 --- a/man/shims.Rd +++ b/man/shims.Rd @@ -48,8 +48,6 @@ triggers an error. \examples{ -# Disable the errorist hooks if already loaded -disable_errorist() # Default setup enable_warning_shim() @@ -67,9 +65,6 @@ enable_warning_shim(warning_search_func = searcher::search_google) # Remove the shim disable_warning_shim() -# Disable the errorist hooks if already loaded -disable_errorist() - # Enable only the error shim enable_error_shim()