diff options
author | Julien Danjou <julien@danjou.info> | 2010-09-04 11:28:25 +0200 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2010-09-04 11:28:25 +0200 |
commit | 4f1779c962fffc2bea1f341c7348203893aa178a (patch) | |
tree | 39400280a098d82e268d72d3feaf23733a251f27 | |
parent | 62ae627a127dae59a04d4c7dcd8e1ec1a9ff6fbf (diff) |
Enhance text insertion
-rw-r--r-- | offlineimap.el | 14 |
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." |