diff options
| author | David Bremner <bremner@debian.org> | 2012-01-27 18:04:44 -0400 |
|---|---|---|
| committer | David Bremner <bremner@debian.org> | 2012-01-27 18:04:44 -0400 |
| commit | bcd44490684965082e5921d0fc71064af3170987 (patch) | |
| tree | 12506f79f6792236b95ef0d6a19ab5113bb4587d /test/test-lib.el | |
| parent | bfb7feb1f51ae348503046823d72348621e34d08 (diff) | |
| parent | ffce9b7c25b9b44ec026b67d96e44cae09c99efe (diff) | |
Merge commit 'debian/0.11-1' into squeeze-backports
Conflicts:
debian/changelog
Diffstat (limited to 'test/test-lib.el')
| -rw-r--r-- | test/test-lib.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test-lib.el b/test/test-lib.el index 97ae5938..3b817c37 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -61,3 +61,18 @@ running, quit if it terminated." (if (not (process-attributes pid)) (kill-emacs) (run-at-time "1 min" nil 'orphan-watchdog pid))) + +(defun hook-counter (hook) + "Count how many times a hook is called. Increments +`hook'-counter variable value if it is bound, otherwise does +nothing." + (let ((counter (intern (concat (symbol-name hook) "-counter")))) + (if (boundp counter) + (set counter (1+ (symbol-value counter)))))) + +(defun add-hook-counter (hook) + "Add hook to count how many times `hook' is called." + (add-hook hook (apply-partially 'hook-counter hook))) + +(add-hook-counter 'notmuch-hello-mode-hook) +(add-hook-counter 'notmuch-hello-refresh-hook) |
