6
6
#
7
7
8
8
register_hooks <- function () {
9
- rebind(
10
- " utils" ,
11
- " View" ,
12
- .ps.view_data_frame ,
13
- namespace = TRUE
14
- )
15
- rebind(
16
- " base" ,
17
- " debug" ,
18
- new_ark_debug(base :: debug ),
19
- namespace = TRUE
20
- )
21
- rebind(
22
- " base" ,
23
- " debugonce" ,
24
- new_ark_debug(base :: debugonce ),
25
- namespace = TRUE
26
- )
27
- rebind(
28
- " base" ,
29
- " browser" ,
30
- new_ark_browser(base :: browser ),
31
- namespace = TRUE
32
- )
9
+ rebind(" utils" , " View" , .ps.view_data_frame , namespace = TRUE )
10
+ rebind(" base" , " debug" , new_ark_debug(base :: debug ), namespace = TRUE )
11
+ rebind(" base" , " debugonce" , new_ark_debug(base :: debugonce ), namespace = TRUE )
33
12
register_getHook_hook()
34
13
}
35
14
@@ -45,7 +24,7 @@ rebind <- function(pkg, name, value, namespace = FALSE) {
45
24
pkg = pkg ,
46
25
name = name ,
47
26
value = value
48
- )
27
+ )
49
28
}
50
29
}
51
30
@@ -63,11 +42,7 @@ pkg_bind <- function(pkg, name, value) {
63
42
env <- as.environment(env )
64
43
65
44
if (! exists(name , envir = env , mode = " function" , inherits = FALSE )) {
66
- msg <- sprintf(
67
- " Can't register hook: function `%s::%s` not found." ,
68
- pkg ,
69
- name
70
- )
45
+ msg <- sprintf(" Can't register hook: function `%s::%s` not found." , pkg , name )
71
46
stop(msg , call. = FALSE )
72
47
}
73
48
@@ -95,12 +70,7 @@ register_getHook_hook <- function() {
95
70
local_unlock_binding(ns , " getHook" )
96
71
97
72
ns [[" getHook" ]] <- function (hookName , ... ) {
98
- hooks <- get0(
99
- hookName ,
100
- envir = .userHooksEnv ,
101
- inherits = FALSE ,
102
- ifnotfound = list ()
103
- )
73
+ hooks <- get0(hookName , envir = .userHooksEnv , inherits = FALSE , ifnotfound = list ())
104
74
105
75
if (! grepl(" ^UserHook::.*::onLoad$" , hookName )) {
106
76
return (hooks )
0 commit comments