From 2c4f1f97796e5d7c58980fcc5ba4f2636bfa8119 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Mon, 1 Sep 2014 01:25:20 -0500 Subject: [PATCH] Revert "fixed knit_child when knitting chunks with blocks that produce multiple ..." --- R/output.R | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/R/output.R b/R/output.R index 6fead69da4..1b77c2ceae 100644 --- a/R/output.R +++ b/R/output.R @@ -355,12 +355,6 @@ auto_format = function(ext) { #' #' # comment out the child doc by \Sexpr{knit_child('child-doc.Rnw', eval = FALSE)} knit_child = function(..., options = NULL, envir = knit_global()) { - old <- remove_all_hooks() - on.exit(restore_hooks(old), add = TRUE) - knit_child_unwrapped(..., options= options, envir = envir) -} - -knit_child_unwrapped = function(..., options = NULL, envir = knit_global()) { child = child_mode() opts_knit$set(child = TRUE) # yes, in child mode now on.exit(opts_knit$set(child = child)) # restore child status @@ -380,26 +374,6 @@ knit_child_unwrapped = function(..., options = NULL, envir = knit_global()) { paste(c('', res), collapse = '\n') } -get_hook_names <- function() { - ls(.userHooksEnv, all.names = TRUE) -} - -remove_all_hooks <- function() { - hook_names <- get_hook_names() - old <- list() - for (hook_name in hook_names) { - old[[hook_name]] <- getHook(hook_name) - setHook(hook_name, NULL, action = "replace") - } - old -} - -restore_hooks <- function(hooks) { - for (hook_name in names(hooks)) { - setHook(hook_name, hooks[[hook_name]], action = "replace") - } -} - #' Exit knitting early #' #' Sometimes we may want to exit the knitting process early, and completely