summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--offlineimap.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/offlineimap.el b/offlineimap.el
index 072903a..121bfdb 100644
--- a/offlineimap.el
+++ b/offlineimap.el
@@ -167,9 +167,17 @@ OfflineIMAP status should be displayed in the mode line."
(let ((buffer (process-buffer process)))
(when (buffer-live-p buffer)
(with-current-buffer buffer
- (goto-char (point-max))
- (insert text)
- (set-marker (process-mark process) (point))))))
+ ;; If the cursor is at the end, append text like we would be in
+ ;; "tail".
+ (if (eq (point) (point-max))
+ (progn
+ (insert text)
+ (set-marker (process-mark process) (point)))
+ ;; But if not, let the cursor where it is, so `save-excursion'.
+ (save-excursion
+ (goto-char (point-max))
+ (insert text)
+ (set-marker (process-mark process) (point))))))))
(defun offlineimap-process-filter (process msg)
"Filter PROCESS output MSG."