From f88e8b93080f40de1c4683ff550239ecd632505c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 12 Sep 2010 22:18:33 +0200 Subject: Put buffer read-only without undo list --- offlineimap.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/offlineimap.el b/offlineimap.el index 9952351..04efe53 100644 --- a/offlineimap.el +++ b/offlineimap.el @@ -181,17 +181,18 @@ This is used when `offlineimap-mode-line-style' is set to 'symbol.") (let ((buffer (process-buffer process))) (when (buffer-live-p buffer) (with-current-buffer buffer - ;; If the cursor is at the end, append text like we would be in - ;; "tail". - (if (eq (point) (point-max)) - (progn + (let ((inhibit-read-only t)) + ;; 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))) - ;; 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)))))))) + (set-marker (process-mark process) (point))))))))) (defun offlineimap-process-filter (process msg) "Filter PROCESS output MSG." @@ -249,6 +250,8 @@ This is used when `offlineimap-mode-line-style' is set to 'symbol.") (define-derived-mode offlineimap-mode fundamental-mode "OfflineIMAP" "A major mode for OfflineIMAP interaction." - :group 'comm) + :group 'comm + (setq buffer-read-only t) + (setq buffer-undo-list t)) (provide 'offlineimap) -- cgit v1.2.3