ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

23.1.1 Running Hooks

At the appropriate times, Emacs uses the run-hooks function and the other functions below to run particular hooks.

— Function: run-hooks &rest hookvars

This function takes one or more normal hook variable names as arguments, and runs each hook in turn. Each argument should be a symbol that is a normal hook variable. These arguments are processed in the order specified.

If a hook variable has a non-nil value, that value should be a list of functions. run-hooks calls all the functions, one by one, with no arguments.

The hook variable's value can also be a single function—either a lambda expression or a symbol with a function definition—which run-hooks calls. But this usage is obsolete.

— Function: run-hook-with-args hook &rest args

This function is the way to run an abnormal hook and always call all of the hook functions. It calls each of the hook functions one by one, passing each of them the arguments args.

— Function: run-hook-with-args-until-failure hook &rest args

This function is the way to run an abnormal hook until one of the hook functions fails. It calls each of the hook functions, passing each of them the arguments args, until some hook function returns nil. It then stops and returns nil. If none of the hook functions return nil, it returns a non-nil value.

— Function: run-hook-with-args-until-success hook &rest args

This function is the way to run an abnormal hook until a hook function succeeds. It calls each of the hook functions, passing each of them the arguments args, until some hook function returns non-nil. Then it stops, and returns whatever was returned by the last hook function that was called. If all hook functions return nil, it returns nil as well.

blog comments powered by Disqus