{"id":13862419,"url":"https://github.com/nickserv/add-hooks","last_synced_at":"2025-04-11T09:42:26.124Z","repository":{"id":145235736,"uuid":"87481603","full_name":"nickserv/add-hooks","owner":"nickserv","description":"Emacs function for setting multiple hooks.","archived":false,"fork":false,"pushed_at":"2017-12-17T01:24:06.000Z","size":49,"stargazers_count":16,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T06:31:55.567Z","etag":null,"topics":["emacs","emacs-lisp","emacs-packages"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickserv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-04-06T22:42:34.000Z","updated_at":"2022-06-28T12:53:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"87ac2b5b-d56d-4aa7-8e88-eef07df02c2d","html_url":"https://github.com/nickserv/add-hooks","commit_stats":null,"previous_names":["nickserv/add-hooks"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickserv%2Fadd-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickserv%2Fadd-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickserv%2Fadd-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickserv%2Fadd-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickserv","download_url":"https://codeload.github.com/nickserv/add-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248369295,"owners_count":21092550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","emacs-lisp","emacs-packages"],"created_at":"2024-08-05T06:01:43.970Z","updated_at":"2025-04-11T09:42:26.103Z","avatar_url":"https://github.com/nickserv.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"# `add-hooks`\n[![Build Status](https://travis-ci.org/nickmccurdy/add-hooks.svg?branch=master)](https://travis-ci.org/nickmccurdy/add-hooks)\n[![MELPA](https://melpa.org/packages/add-hooks-badge.svg)](https://melpa.org/#/add-hooks)\n[![MELPA Stable](https://stable.melpa.org/packages/add-hooks-badge.svg)](https://stable.melpa.org/#/add-hooks)\n\nEmacs functions for setting multiple hooks.\n\nTypically, you would need to call `add-hook` multiple times with\nsimilar arguments to declare multiple functions for one hook, or\nvice versa.  `add-hooks-pair` is a variant that takes multiple\nhooks or functions that apply to each other.  The `add-hooks`\nfunction tidies up duplicate hook and function names further into a\nsingle declarative call (inspired by the\n[`bind-key`](https://github.com/jwiegley/use-package/blob/master/bind-key.el)\n package).\n\nIf you're using [`use-package`](https://github.com/jwiegley/use-package), use its [`:hook`](https://github.com/jwiegley/use-package#hooks) keyword instead, which has a\nsimilar syntax while establishing autoload definitions and supporting\ndeferred loading.\n\n## Documentation\n\n### `(add-hooks-pair HOOKS FUNCTIONS)`\nCall `add-hook` for each combined pair of items in *HOOKS* and *FUNCTIONS*.\n\n*HOOKS* can be a symbol or a list of symbols representing hook\nvariables (the `-hook` suffix is implied).  *FUNCTIONS* can be a\nsymbol, a lambda, or a list of either representing hook\nfunctions.  If lists are used, a function can be added to\nmultiple hooks and/or multiple functions can be added to a hook.\n\n#### Example\n```emacs\nELISP\u003e (add-hooks-pair '(css-mode sgml-mode) 'emmet-mode)\nnil\nELISP\u003e css-mode-hook\n(emmet-mode)\nELISP\u003e sgml-mode-hook\n(emmet-mode)\n```\n\n### `(add-hooks PAIRS)`\nCall `add-hooks-pair` on each cons pair in *PAIRS*.\n\nEach pair has a `car` for setting hooks and a `cdr` for setting\nfunctions to add to those hooks.  Pair values are passed to the\n*HOOKS* and *FUNCTIONS* arguments of `add-hooks-pair`, respectively.\n\n#### Usage\n```emacs\n(add-hooks ((HOOKS . FUNCTIONS)...))\n```\n\n#### Example\n```emacs\nELISP\u003e (add-hooks '(((css-mode sgml-mode) . emmet-mode)))\nnil\nELISP\u003e css-mode-hook\n(emmet-mode)\nELISP\u003e sgml-mode-hook\n(emmet-mode)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickserv%2Fadd-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickserv%2Fadd-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickserv%2Fadd-hooks/lists"}