From 4f1779c962fffc2bea1f341c7348203893aa178a Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 4 Sep 2010 11:28:25 +0200 Subject: Enhance text insertion --- offlineimap.el | 14 +++++++++++--- 1 file 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." -- cgit v1.2.3