From: Christophe Rhodes Date: Thu, 24 Jul 2014 18:40:14 +0000 (+0100) Subject: slightly nicer iplayer-progress management X-Git-Tag: v0.1~1 X-Git-Url: http://christophe.rhodes.io/gitweb/?p=iplayer-el.git;a=commitdiff_plain;h=9ada771e3df04aa49f295d46e75ba8d2e8012444;hp=9868c8ed623fb6c9d8b5ce1da431535bf7396762 slightly nicer iplayer-progress management --- 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