File tree Expand file tree Collapse file tree 3 files changed +13
-20
lines changed Expand file tree Collapse file tree 3 files changed +13
-20
lines changed Original file line number Diff line number Diff line change 24
24
,@ body))
25
25
26
26
(defun run-hooks (&rest hooks)
27
- " Run all the hooks in HOOKS.
27
+ " Run all the hooks in HOOKS, without arguments .
28
28
The variable `*hook*' is bound to the name of each hook as it is being
29
29
run."
30
30
(dolist (*hook* hooks)
31
31
(run-hook *hook* )))
32
32
33
- (defgeneric run-hook (hook)
34
- (:documentation " Run the functions in HOOK." )
35
- (:method ((*hook* symbol ))
36
- (dolist (fn (symbol-value *hook* ))
37
- (with-hook-restart
38
- (funcall fn)))))
39
-
40
- (defgeneric run-hook-with-args (hook &rest args)
33
+ (defgeneric run-hook (hook &rest args)
41
34
(:documentation " Apply each function in HOOK to ARGS." )
42
35
(:method ((*hook* symbol ) &rest args)
43
36
(dolist (fn (symbol-value *hook* ))
44
37
(with-hook-restart
45
38
(apply fn args)))))
46
39
47
- (defgeneric run-hook-with-args- until-failure (hook &rest args)
40
+ (defgeneric run-hook-until-failure (hook &rest args)
48
41
(:documentation " Like `run-hook-with-args', but quit once a function returns nil." )
49
42
(:method ((*hook* symbol ) &rest args)
50
43
(loop for fn in (symbol-value *hook* )
51
44
always (apply fn args))))
52
45
53
- (defgeneric run-hook-with-args- until-success (hook &rest args)
46
+ (defgeneric run-hook-until-success (hook &rest args)
54
47
(:documentation " Like `run-hook-with-args', but quit once a function returns
55
48
non-nil." )
56
49
(:method ((*hook* symbol ) &rest args)
Original file line number Diff line number Diff line change 286
286
# :remove-hook
287
287
# :run-hooks
288
288
# :run-hook
289
- # :run-hook-with-args
290
- # :run-hook-with-args- until-failure
291
- # :run-hook-with-args- until-success
289
+ # :run-hook
290
+ # :run-hook-until-failure
291
+ # :run-hook-until-success
292
292
; ; Fbind.
293
293
# :fbind
294
294
# :fbind*
Original file line number Diff line number Diff line change 34
34
(let ((list ' ()))
35
35
(flet ((add (n) (push n list )))
36
36
(add-hook hook #' add)
37
- (run-hook-with-args hook ' 2)
38
- (run-hook-with-args hook ' 1)
37
+ (run-hook hook ' 2)
38
+ (run-hook hook ' 1)
39
39
(is (equal list ' (1 2 )))))))
40
40
41
- (test run-hook-with-args- until-failure
41
+ (test run-hook-until-failure
42
42
(with-temp-hook (hook)
43
43
(add-hook hook (constantly nil ))
44
44
(add-hook hook
45
45
(lambda () (fail " This function should not run" ))
46
46
:append t )
47
- (run-hook-with-args- until-failure hook)))
47
+ (run-hook-until-failure hook)))
48
48
49
- (test run-hook-with-args- until-success
49
+ (test run-hook-until-success
50
50
(with-temp-hook (hook)
51
51
(add-hook hook (constantly t ))
52
52
(add-hook hook
53
53
(lambda () (fail " This function should not run" ))
54
54
:append t )
55
- (run-hook-with-args- until-success hook)))
55
+ (run-hook-until-success hook)))
You can’t perform that action at this time.
0 commit comments