aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Neidhardt <ambrevar@gmail.com>2017-12-09 16:00:36 +0100
committerPierre Neidhardt <ambrevar@gmail.com>2017-12-09 16:34:57 +0100
commitd4a75dda9316dfe8ec9dfe7368b226121ad5e898 (patch)
tree28f1d9679eee3fab7e432862951bcbe0f7bc08d3
parentd8a9539576903c8f06eb87a048b4d9ba7b6a6061 (diff)
Add progress reporter to EMMS browser expansion
The thumbnail display makes expansion even slower because of cache building and querying.
-rw-r--r--lisp/emms-browser.el29
1 files changed, 22 insertions, 7 deletions
diff --git a/lisp/emms-browser.el b/lisp/emms-browser.el
index 0c348a9..73e359e 100644
--- a/lisp/emms-browser.el
+++ b/lisp/emms-browser.el
@@ -1135,13 +1135,28 @@ Stops at the next line at the same level, or EOF."
(defun emms-browser-expand-to-level (level)
"Expand to a depth specified by LEVEL.
After expanding, jump to the currently marked entry."
- (goto-char (point-min))
- (while (not (eq (buffer-end 1) (point)))
- (if (< (emms-browser-level-at-point) level)
- (emms-browser-show-subitems))
- (emms-browser-next-non-track))
- (emms-browser-pop-mark)
- (recenter '(4)))
+ (let ((count 1)
+ (total 0)
+ progress-reporter)
+ (goto-char (point-min))
+ (while (not (eq (buffer-end 1) (point)))
+ (when (= (emms-browser-level-at-point) 1)
+ (setq total (1+ total)))
+ (emms-browser-next-non-track))
+ (goto-char (point-min))
+ (setq progress-reporter
+ (make-progress-reporter "Expanding EMMS browser entries..."
+ 0 total))
+ (while (not (eq (buffer-end 1) (point)))
+ (when (= (emms-browser-level-at-point) 1)
+ (progress-reporter-update progress-reporter count)
+ (setq count (1+ count)))
+ (if (< (emms-browser-level-at-point) level)
+ (emms-browser-show-subitems))
+ (emms-browser-next-non-track))
+ (progress-reporter-done progress-reporter)
+ (emms-browser-pop-mark)
+ (recenter '(4))))
(defun emms-browser-mark-and-collapse ()
"Save the current top level element, and collapse."