From 9e6bfb9075212f5c3ba8c19f55f9dc19bd09f0d2 Mon Sep 17 00:00:00 2001 From: Remco van 't Veer Date: Wed, 27 Jul 2016 12:16:21 +0200 Subject: [PATCH] Fix kill ring clobbering by get mail filter The kill ring fills up with lines like: C: 0/1 B: 28/29 M: +0/0 *0/0 #0/0 S: +2/2 *1/1 #0/0 when using mbsync or another tool using carriage return for progress. --- mu4e/mu4e-utils.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index f8110b56..264c19f7 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -930,9 +930,13 @@ Also scrolls to the final line, and update the progress throbber." (with-current-buffer (process-buffer proc) (goto-char (point-max)) (if (string-match ".*\r\\(.*\\)" msg) - (progn - (kill-line 0) - (insert (match-string 1 msg))) + (progn + ;; kill even with \r + (end-of-line) + (let ((end (point))) + (beginning-of-line) + (delete-region (point) end)) + (insert (match-string 1 msg))) (insert msg))) ;; Auto-scroll unless user is interacting with the window. (when (and (window-live-p procwin)