Skip to content

Commit

Permalink
Sort in C locale
Browse files Browse the repository at this point in the history
Fixes #1077
  • Loading branch information
hadley committed Jun 26, 2020
1 parent 65330c5 commit 65ce976
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# roxygen2 (development version)

* R6 methods and re-exported functions are always sorted in the C locale;
this ensures they're always sorted the same way in every environment (#1077).

* When processing cross package markdown links (e.g. `[pkg::fun()]`),
roxygen2 now looks up the file it needs to link to, instead of linking to
the topic, to avoid "Non-file package-anchored links" `R CMD check` warnings.
Expand Down
2 changes: 1 addition & 1 deletion R/object-import.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ merge.rd_section_reexport <- function(x, y, ...) {
format.rd_section_reexport <- function(x, ...) {
pkgs <- split(x$value$fun, x$value$pkg)
pkg_links <- map2(names(pkgs), pkgs, function(pkg, funs) {
funs <- sort(funs)
funs <- sort_c(funs)
files <- map_chr(
funs,
try_find_topic_in_package,
Expand Down
2 changes: 1 addition & 1 deletion R/object-r6.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ extract_r6_super_data <- function(x) {
c("method", "field", "active"),
c(length(method_nms), length(field_nms), length(active_nms))
)
rsort <- function(x) sort(x, decreasing = TRUE)
rsort <- function(x) sort_c(x, decreasing = TRUE)
names <-c(rsort(method_nms), rsort(field_nms), rsort(active_nms))
mth <- rbind(
data.frame(
Expand Down
2 changes: 1 addition & 1 deletion R/util-locale.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ with_collate <- function(locale, code) {
force(code)
}

sort_c <- function(x) with_collate("C", sort(x))
sort_c <- function(x, ...) with_collate("C", sort(x, ...))

0 comments on commit 65ce976

Please sign in to comment.