Skip to content

Commit

Permalink
use !all(grepl()) instead of !grepl() because length(nm) could …
Browse files Browse the repository at this point in the history
…be greater than one
  • Loading branch information
yihui committed Sep 29, 2023
1 parent 2c157c6 commit 374f7b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: evaluate
Type: Package
Title: Parsing and Evaluation Tools that Provide More Details than the Default
Version: 0.21.1
Version: 0.21.2
Authors@R: c(
person("Hadley", "Wickham", role = "aut"),
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Version 0.22
================================================================================

- Fixed a problem in the internal function `plot_calls()` that made the examples of `recordGraphics` fail to run on its help page (thanks, Kurt Hornik).

Version 0.21
================================================================================
Expand Down
5 changes: 3 additions & 2 deletions R/graphics.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ plot_calls <- function(plot) {
# grid graphics do not have x[[1]]$name
if (!is.null(nm <- x[[1]][["name"]])) return(nm)
nm <- deparse(x[[1]])
# the plot element should not be empty
if (length(x[[2]]) > 0 || !grepl("^requireNamespace\\(", nm)) nm
# the plot element should not be empty, and ignore calls that are simply
# requireNamespace()
if (length(x[[2]]) > 0 || !all(grepl("^requireNamespace\\(", nm))) nm
}))
}

0 comments on commit 374f7b5

Please sign in to comment.