diff options
author | Julien Danjou <julien@danjou.info> | 2010-10-26 14:29:11 +0200 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2010-10-26 14:29:11 +0200 |
commit | 1638de4821f286f0e0699930cb1ff08a4f77c948 (patch) | |
tree | fe3a36eb1e578114431c0c7c6f66ea268d511408 | |
parent | 36bc2bc0ec67cafb24858f6652a280b24c91807b (diff) |
Add hooks
-rw-r--r-- | offlineimap.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/offlineimap.el b/offlineimap.el index 2ace1b7..42dce38 100644 --- a/offlineimap.el +++ b/offlineimap.el @@ -74,6 +74,11 @@ This is used when `offlineimap-mode-line-style' is set to 'symbol." :type 'string :group 'offlinemap) +(defcustom offlineimap-event-hooks nil + "Hooks run when OfflineIMAP state changes." + :type 'hook + :group 'offlineimap) + (defvar offlineimap-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "q") 'offlineimap-quit) @@ -239,13 +244,15 @@ This is used when `offlineimap-mode-line-style' is set to 'symbol." (let ((comint-buffer-maximum-size offlineimap-buffer-maximum-size)) (comint-truncate-buffer)))) (process-put process :last-msg-type msg-type) - (process-put process :last-action action)) - (offlineimap-update-mode-line process)) + (process-put process :last-action action) + (offlineimap-update-mode-line process) + (run-hook-with-args 'offlineimap-event-hooks msg-type action))) (defun offlineimap-process-sentinel (process state) "Monitor STATE change of PROCESS." (offlineimap-insert process (concat "*** Process " (process-name process) " " state)) - (offlineimap-update-mode-line process)) + (offlineimap-update-mode-line process) + (run-hook-with-args 'offlineimap-event-hooks state)) (defun offlineimap-mode-line () "Return a string to display in mode line." |