Discussion:
[emms-help] BUG: emms-playlist-limit trashes persisted playlists
Fran Burstall
2018-06-17 11:57:34 UTC
Permalink
I have a playlist created from emms-history-load. In the
playlist buffer I do /a to limit to an artist and then // to
get the whole playlist back.

What I expect: to see the whole playlist in the buffer.

What I get: the buffer has been erased and is now completely
empty.

Reason: emms-playlist-limit-to-all repopulates the buffer
from the contents of the var emms-playlist-limit-tracks but
this is apparently not set for playlists created by
emms-history-load.

A possible fix would be to do

(run-hooks 'emms-playlist-source-inserted-hook)

in emms-history-load but that would only work if
emms-playlist-limit-tracks was buffer-local (or there was
only one playlist in the history.)

---Fran
Yoni Rabkin
2018-06-18 16:21:32 UTC
Permalink
Post by Fran Burstall
I have a playlist created from emms-history-load. In the
playlist buffer I do /a to limit to an artist and then // to
get the whole playlist back.
What I expect: to see the whole playlist in the buffer.
What I get: the buffer has been erased and is now completely
empty.
Reason: emms-playlist-limit-to-all repopulates the buffer
from the contents of the var emms-playlist-limit-tracks but
this is apparently not set for playlists created by
emms-history-load.
A possible fix would be to do
(run-hooks 'emms-playlist-source-inserted-hook)
in emms-history-load but that would only work if
emms-playlist-limit-tracks was buffer-local (or there was
only one playlist in the history.)
The fact that `emms-playlist-limit-tracks' isn't buffer-local is a
bug. I fixed that.

The rest of the code in emms-playlist-limit.el is pretty basic and needs
a lot of work to avoid several other issues. I'll add that to the list,
but I can't guarantee when it'll all get done.

In the meantime if you feel like sending in patches...

In any case, thank you for the bug reports.
--
"Cut your own wood and it will warm you twice"
Fran Burstall (Gmail)
2018-06-20 20:17:11 UTC
Permalink
Here is a tiny patch that fixes the problem for me: emms-history-load
should run emms-playlist-source-inserted-hook when loading each playlist.

---Fran

diff --git a/lisp/emms-history.el b/lisp/emms-history.el
index 9b913b2..2f75571 100644
--- a/lisp/emms-history.el
+++ b/lisp/emms-history.el
@@ -120,6 +120,7 @@ Emacs."
(setq buf (current-buffer)))
(mapc 'emms-playlist-insert-track
(nth 2 playlist))
+ (run-hooks 'emms-playlist-source-inserted-hook)
(ignore-errors
(emms-playlist-select (cadr playlist)))))
(setq emms-playlist-buffer buf)
Post by Yoni Rabkin
Post by Fran Burstall
I have a playlist created from emms-history-load. In the
playlist buffer I do /a to limit to an artist and then // to
get the whole playlist back.
What I expect: to see the whole playlist in the buffer.
What I get: the buffer has been erased and is now completely
empty.
Reason: emms-playlist-limit-to-all repopulates the buffer
from the contents of the var emms-playlist-limit-tracks but
this is apparently not set for playlists created by
emms-history-load.
A possible fix would be to do
(run-hooks 'emms-playlist-source-inserted-hook)
in emms-history-load but that would only work if
emms-playlist-limit-tracks was buffer-local (or there was
only one playlist in the history.)
The fact that `emms-playlist-limit-tracks' isn't buffer-local is a
bug. I fixed that.
The rest of the code in emms-playlist-limit.el is pretty basic and needs
a lot of work to avoid several other issues. I'll add that to the list,
but I can't guarantee when it'll all get done.
In the meantime if you feel like sending in patches...
In any case, thank you for the bug reports.
--
"Cut your own wood and it will warm you twice"
Yoni Rabkin
2018-06-20 20:24:08 UTC
Permalink
Post by Fran Burstall (Gmail)
Here is a tiny patch that fixes the problem for me: emms-history-load
should run emms-playlist-source-inserted-hook when loading each
playlist.
---Fran
diff --git a/lisp/emms-history.el b/lisp/emms-history.el
index 9b913b2..2f75571 100644
--- a/lisp/emms-history.el
+++ b/lisp/emms-history.el
@@ -120,6 +120,7 @@ Emacs."                  (setq buf (current-buffer)))              (mapc 'emms-playlist-insert-track
                   (nth 2 playlist))
+     (run-hooks 'emms-playlist-source-inserted-hook)
             (ignore-errors
               (emms-playlist-select (cadr playlist)))))
         (setq emms-playlist-buffer buf)
Seems to work here too.

applied

thanks!
Post by Fran Burstall (Gmail)
I have a playlist created from emms-history-load.  In the
playlist buffer I do /a to limit to an artist and then // to
get the whole playlist back.
What I expect: to see the whole playlist in the buffer.
What I get: the buffer has been erased and is now completely
empty.
Reason: emms-playlist-limit-to-all repopulates the buffer
from the contents of the var emms-playlist-limit-tracks but
this is apparently not set for playlists created by
emms-history-load.
A possible fix would be to do
(run-hooks 'emms-playlist-source-inserted-hook)
in emms-history-load but that would only work if
emms-playlist-limit-tracks was buffer-local (or there was
only one playlist in the history.)
The fact that `emms-playlist-limit-tracks' isn't buffer-local is a
bug. I fixed that.
The rest of the code in emms-playlist-limit.el is pretty basic and needs
a lot of work to avoid several other issues. I'll add that to the list,
but I can't guarantee when it'll all get done.
In the meantime if you feel like sending in patches...
In any case, thank you for the bug reports.
--
   "Cut your own wood and it will warm you twice"
--
"Cut your own wood and it will warm you twice"
Loading...