(defvar gc 0) (add-hook 'post-gc-hook (lambda () (setq gc (1+ gc)))) (defun show-gc () (message "gc: %s" gc)) (add-hook 'post-command-hook 'show-gc)