Skip to content

Commit

Permalink
propagate envs better
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 29, 2024
1 parent 951135e commit 5716052
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/key-.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ key_manual <- function(aesthetic, value = aesthetic,
key_map <- function(data, ..., .call = caller_env()) {
mapping <- enquos(...)
mapping <- Filter(Negate(quo_is_missing), mapping)
mapping <- new_aes(mapping)
mapping <- new_aes(mapping, env = .call)

df <- eval_aes(
data, mapping,
Expand Down
2 changes: 1 addition & 1 deletion R/key-range.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ key_range_manual <- function(start, end, name = NULL, level = NULL, ...) {
key_range_map <- function(data, ..., .call = caller_env()) {
mapping <- enquos(...)
mapping <- Filter(Negate(quo_is_missing), mapping)
mapping <- new_aes(mapping)
mapping <- new_aes(mapping, env = .call)

df <- eval_aes(
data, mapping,
Expand Down
4 changes: 2 additions & 2 deletions R/utils-ggplot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ rotate_just <- function(angle = NULL, hjust, vjust) {
list(hjust = hnew, vjust = vnew)
}

new_aes <- function(x, env = globalenv()) {
new_aes <- function(x, env = caller_env()) {
if (!is.list(x)) {
stop_input_type(x, as_cli("a {.cls list}"))
}
x <- lapply(x, new_aesthetic, env = env)
structure(x, class = "uneval")
}

new_aesthetic <- function(x, env = global_env()) {
new_aesthetic <- function(x, env = caller_env()) {
if (is_quosure(x)) {
if (!quo_is_symbolic(x)) {
x <- quo_get_expr(x)
Expand Down
5 changes: 4 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
This is a new release.
This is a resubmission of a new release.
I thank the volunteers for their time and comments.
A concern about modifying .GlobalEnv has been addressed in R/utils-ggplot2.R.
There are no references describing the methods in the package.

0 comments on commit 5716052

Please sign in to comment.