summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2010-09-03 23:05:13 +0200
committerJulien Danjou <julien@danjou.info>2010-09-03 23:05:13 +0200
commit62ae627a127dae59a04d4c7dcd8e1ec1a9ff6fbf (patch)
tree9fa42dca84e69606f6eacf35de0389c22b1048a6
parenta4aadba379e04a0c1fdc1d284ab2b7ef92e7d741 (diff)
Add mouse bindings
-rw-r--r--offlineimap.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/offlineimap.el b/offlineimap.el
index cf728a6..072903a 100644
--- a/offlineimap.el
+++ b/offlineimap.el
@@ -131,17 +131,35 @@ OfflineIMAP status should be displayed in the mode line."
(propertize text 'face face-sym)
text)))
+(defun offlineimap-switch-to-buffer (e)
+ "Go to OfflineIMAP buffer."
+ (interactive "e")
+ (save-selected-window
+ (select-window
+ (posn-window (event-start e)))
+ (switch-to-buffer (get-buffer offlineimap-buffer-name))))
+
+(defvar offlineimap-mode-line-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (vector 'mode-line 'mouse-2) 'offlineimap-switch-to-buffer)
+ map)
+ "Keymap used in mode line.")
+
(defun offlineimap-update-mode-line (process)
"Update mode line information about OfflineIMAP PROCESS."
(setq offlineimap-mode-line-string
- (concat " [OfflineIMAP: "
- (let ((status (process-status process)))
+ (propertize
+ (concat " [OfflineIMAP: "
+ (let ((status (process-status process)))
(if (eq status 'run)
(let ((msg-type (process-get process :last-msg-type))
(action (process-get process :last-action)))
(offlineimap-propertize-face msg-type action action))
(propertize (symbol-name status) 'face 'offlineimap-error-face)))
- "]"))
+ "]")
+ 'mouse-face 'mode-line-highlight
+ 'help-echo "mouse-2: Go to OfflineIMAP buffer"
+ 'local-map offlineimap-mode-line-map))
(force-mode-line-update))
(defun offlineimap-insert (buffer text)