From 9ada771e3df04aa49f295d46e75ba8d2e8012444 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 24 Jul 2014 19:40:14 +0100 Subject: [PATCH] slightly nicer iplayer-progress management --- iplayer.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/iplayer.el b/iplayer.el index cb61f3b..6c43520 100644 --- a/iplayer.el +++ b/iplayer.el @@ -226,17 +226,20 @@ The presets are defined in the variable `iplayer-presets'." (state (process-get process 'iplayer-state)) (progress (process-get process 'iplayer-progress))) (with-current-buffer (get-buffer-create "*iplayer-progress*") - (goto-char (point-min)) - (let ((found (re-search-forward (format "^%s:" id) nil 'end))) - (unless found - (unless (= (point) (progn (forward-line 0) (point))) - (goto-char (point-max)) - (newline))) - (forward-line 0) - (let ((beg (point))) - (end-of-line) - (delete-region beg (point))) - (insert (format "%s: %s %s%%" id state progress)))))) + (special-mode) + (save-excursion + (goto-char (point-min)) + (let ((found (re-search-forward (format "^%s:" id) nil 'end)) + (inhibit-read-only t)) + (unless found + (unless (= (point) (progn (forward-line 0) (point))) + (goto-char (point-max)) + (newline))) + (forward-line 0) + (let ((beg (point))) + (end-of-line) + (delete-region beg (point))) + (insert (format "%s: %s %s%%" id state progress))))))) (defun iplayer-download-process-filter (process string) (catch 'no-progress -- 2.39.5