comparison lisp/subr.el @ 12652:127ae5c0a005

(run-hook-with-args): Deleted; now in C code.
author Karl Heuer <kwzh@gnu.org>
date Tue, 25 Jul 1995 19:35:38 +0000
parents 0d404ef125ea
children 2f4bbd557180
comparison
equal deleted inserted replaced
12651:4bb00f26c714 12652:127ae5c0a005
476 (funcall (car value))) 476 (funcall (car value)))
477 (setq value (cdr value))) 477 (setq value (cdr value)))
478 (funcall value))))) 478 (funcall value)))))
479 (setq hooklist (cdr hooklist)))) 479 (setq hooklist (cdr hooklist))))
480 480
481 (defun run-hook-with-args (hook &rest args)
482 "Run HOOK with the specified arguments ARGS.
483 HOOK should be a symbol, a hook variable. If HOOK has a non-nil
484 value, that value may be a function or a list of functions to be
485 called to run the hook. If the value is a function, it is called with
486 the given arguments and its return value is returned. If it is a list
487 of functions, those functions are called, in order,
488 with the given arguments ARGS.
489 It is best not to depend on the value return by `run-hook-with-args',
490 as that may change.
491
492 To make a hook variable buffer-local, use `make-local-hook', not
493 `make-local-variable'."
494 (and (boundp hook)
495 (symbol-value hook)
496 (let ((value (symbol-value hook)))
497 (if (and (listp value) (not (eq (car value) 'lambda)))
498 (while value
499 (if (eq (car value) t)
500 ;; t indicates this hook has a local binding;
501 ;; it means to run the global binding too.
502 (let ((functions (default-value hook)))
503 (while functions
504 (apply (car functions) args)
505 (setq functions (cdr functions))))
506 (apply (car value) args))
507 (setq value (cdr value)))
508 (apply value args)))))
509
510 (defun run-hook-with-args-until-success (hook &rest args) 481 (defun run-hook-with-args-until-success (hook &rest args)
511 "Run HOOK with the specified arguments ARGS. 482 "Run HOOK with the specified arguments ARGS.
512 HOOK should be a symbol, a hook variable. Its value should 483 HOOK should be a symbol, a hook variable. Its value should
513 be a list of functions. We call those functions, one by one, 484 be a list of functions. We call those functions, one by one,
514 passing arguments ARGS to each of them, until one of them 485 passing arguments ARGS to each of them, until one of them