summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2010-09-03 14:47:37 +0200
committerJulien Danjou <julien@danjou.info>2010-09-03 14:47:37 +0200
commit6e3cfc3e9f792ae9b9ea198eb1a57f68931a2fad (patch)
tree2510fd8ca13ae2f30ed72f91ed535605bec912a7
parentde954b906c25c1a9635d1be709498b859bde6bd1 (diff)
Do not run offlineimap twice
Signed-off-by: Julien Danjou <julien@danjou.info>
-rw-r--r--offlineimap.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/offlineimap.el b/offlineimap.el
index d449e6f..a143aba 100644
--- a/offlineimap.el
+++ b/offlineimap.el
@@ -176,12 +176,14 @@ OfflineIMAP status should be displayed in the mode line."
(defun offlineimap ()
"Start OfflineIMAP."
(interactive)
- (let ((process (start-process-shell-command
- "offlineimap"
- (offlineimap-make-buffer)
- offlineimap-command)))
- (set-process-filter process 'offlineimap-process-filter)
- (set-process-sentinel process 'offlineimap-process-sentinel))
+ (let* ((buffer (offlineimap-make-buffer)))
+ (unless (get-buffer-process buffer)
+ (let ((process (start-process-shell-command
+ "offlineimap"
+ buffer
+ offlineimap-command)))
+ (set-process-filter process 'offlineimap-process-filter)
+ (set-process-sentinel process 'offlineimap-process-sentinel))))
(add-to-list 'global-mode-string '(:eval (offlineimap-mode-line))))
(defun offlineimap-quit ()