]> rhodes.io Git - squeeze-el.git/commitdiff
Christophe Weblog Wiki Code Publications Music
save point within squeeze-control-display-players
authorChristophe Rhodes <csr21@cantab.net>
Sat, 5 Apr 2014 20:09:10 +0000 (21:09 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Sat, 5 Apr 2014 20:09:10 +0000 (21:09 +0100)
squeeze.el

index 16359dc6a14a21f1a11eaa198a3fbb3bbf653c7b..c4a229ad0249a345a0691b2e4914c03e504e36b9 100644 (file)
 
 (defun squeeze-control-display-players ()
   (interactive)
-  (cond
-   (squeeze-control-display-syncgroups
-    (with-current-buffer (get-buffer-create "*squeeze-control*")
+  (with-current-buffer (get-buffer-create "*squeeze-control*")
+    (let ((saved (point)))
       (squeeze-control-mode)
       (read-only-mode -1)
       (erase-buffer)
-      (let ((syncgroups squeeze-syncgroups)
-            (seen))
-        (while syncgroups
-          (let ((names (getf syncgroups :names))
-                (members (split-string (getf syncgroups :members) ",")))
-            (insert (propertize names 'face 'squeeze-syncgroup-face) "\n")
-            (dolist (member members)
-              (let ((player (squeeze-find-player member)))
-                (squeeze-control-insert-player player)
-                (push player seen))))
-          (setq syncgroups (cddddr syncgroups)))
-        (insert (propertize "No syncgroup" 'face 'squeeze-syncgroup-face) "\n")
+      (cond
+       (squeeze-control-display-syncgroups
+        (let ((syncgroups squeeze-syncgroups)
+              (seen))
+          (while syncgroups
+            (let ((names (getf syncgroups :names))
+                  (members (split-string (getf syncgroups :members) ",")))
+              (insert (propertize names 'face 'squeeze-syncgroup-face) "\n")
+              (dolist (member members)
+                (let ((player (squeeze-find-player member)))
+                  (squeeze-control-insert-player player)
+                  (push player seen))))
+            (setq syncgroups (cddddr syncgroups)))
+          (insert (propertize "No syncgroup" 'face 'squeeze-syncgroup-face) "\n")
+          (dolist (player squeeze-players)
+            (unless (member player seen)
+              (squeeze-control-insert-player player)))))
+       (t
         (dolist (player squeeze-players)
-          (unless (member player seen)
-            (squeeze-control-insert-player player))))))
-   (t
-    (with-current-buffer (get-buffer-create "*squeeze-control*")
-      (squeeze-control-mode)
-      (read-only-mode -1)
-      (erase-buffer)
-      (dolist (player squeeze-players)
-        (squeeze-control-insert-player player))
-      (read-only-mode 1)))))
+          (squeeze-control-insert-player player))
+        (read-only-mode 1)))
+      (goto-char saved))))
 
 (cl-defstruct (squeeze-player (:constructor squeeze-make-player))
   playerindex playerid uuid ip name model isplayer displaytype canpoweroff connected power volume)