Yoni Rabkin
2018-09-24 17:20:42 UTC
Hi,
Some news: I made good progress on a more robust implementation but
hit a wall when I realised when I realised that I had not understood
how emms handles multiple playlist buffers.
I'm happy to hear you've been working on it.Some news: I made good progress on a more robust implementation but
hit a wall when I realised when I realised that I had not understood
how emms handles multiple playlist buffers.
My idea had been that limiting by artist (say) creates a new playlist
buffer which was not necessarily current (so I can limit to Led
Zeppelin while still listening to whatever is playing in the current
unlimited buffer).Â
I would say that this is the right direction. But maybe we've beenbuffer which was not necessarily current (so I can limit to Led
Zeppelin while still listening to whatever is playing in the current
unlimited buffer).Â
thinking about this in a manner which is too... limited: perhaps we can
first implement an `emms-playlist-derived' mechanism. This would be a
general mechanism which takes as input playlist-A, applies a series of
functions to it and outputs playlist-B as a result. Then we could
implement `emms-playlist-limit' using `emms-playlist-derived'.
This would allow people to then use `emms-playlist-derived' to implement
other interesting playlist modification functions (Emacs already uses
this technique to define modes with `define-derived-mode'.) For
instance, code could use `emms-playlist-derived' to iterate over a
playlist and split it into multiple playlists which are per-artist or
album.
I implemented a mechanism for edits (deletions, maybe also insertions)
to the limited buffer to propagate back to the source buffer.Â
However, then I realised that some emms buffer operations, notably
emms-playlist-save, apply to the current playlist even when that is
not be the playlist buffer from which it is called.  So, for example,
I cannot save a new Led Zeppelin playlist to disc from my limited
buffer unless I first make it current.
I would recommend against such a mechanism; operations on one playlistto the limited buffer to propagate back to the source buffer.Â
However, then I realised that some emms buffer operations, notably
emms-playlist-save, apply to the current playlist even when that is
not be the playlist buffer from which it is called.  So, for example,
I cannot save a new Led Zeppelin playlist to disc from my limited
buffer unless I first make it current.
buffer shouldn't affect another.
But perhaps I don't fully understand what type of operations you wanted
to do with the limited buffer. Stuff like narrow-to-region?
At this point I lost momentum because I could not decide whether the
limited playlist should automatically become current.Â
In such a case my policy is to choose a default behavior (in this case Ilimited playlist should automatically become current.Â
would say that the default would be that the new buffer would be made
current) but build in the option so that people can change the
behavior. For example, a `emms-playlist-limit-new-current-p' variable
set by default to t. But see more on this below.
I wanted to be able to limit arbitrary (non-current) playlists as an
aid for editing such playlists but this does not seem such a good fit
with how emms works (at least according to my current understanding).
This makes me think that when invoked pragmatically (which can beaid for editing such playlists but this does not seem such a good fit
with how emms works (at least according to my current understanding).
implicit from the user's perspective) the function shouldn't change the
current playlist buffer unless an argument is passed to the function
saying otherwise, but when invoked interactively (which is an explicit
action by the user) it would obey `emms-playlist-limit-new-current-p' as
above.
So advice would be very welcome here! How do you want the limit
feature to work?Â
I hope my thoughts above make some sense. Also, do you mind if I postfeature to work?Â
this latest conversation onto the mailing list so that:
* everyone else can read and weigh-in
* we can continue the conversation there, where it will be archived
P.S. Please feel free to create a remote branch on the repo once you
have code so that we can poke at it as well.
---Fran
  "Cut your own wood and it will warm you twice"
I agree that the current implementation is a little fragile, to
saythe least!
If the re-implementation is a long way down the to-do list,
would itIf the re-implementation is a long way down the to-do list,
be helpful if I had a go at doing it? (It won't hurt my
feelings ifyou say no!)
---Fran
Any news on this front?---Fran
 Â
   > The (not very important) issue: in a playlist buffer I
hit   > The (not very important) issue: in a playlist buffer I
   > // (emms-playlist-limit-to-all).
   >
   > What I expect to happen: nothing if the playlist is
already   >
   > What I expect to happen: nothing if the playlist is
   > unlimited.
   >
   > What happens: the playlist has its order reversed.
   >
   > Commentary: emms-playlist-limit-to-all refills the
playlist   >
   > What happens: the playlist has its order reversed.
   >
   > Commentary: emms-playlist-limit-to-all refills the
   > from a list created by a previous application of
   > emms-playlist-tracks-in-region. The latter lists the
tracks of   > emms-playlist-tracks-in-region. The latter lists the
   the
   > region in reverse order on account of just consing up
said list   > region in reverse order on account of just consing up
   > from the top.
   >
   > Please consider applying the following tiny patch to
   > emms-playlist-tracks-in-region.
   >
   > ---Fran
   >
   > diff --git a/lisp/emms.el b/lisp/emms.el
   > index 062b6eb..7a14a9e 100644
   > --- a/lisp/emms.el
   > +++ b/lisp/emms.el
to   >
   > Please consider applying the following tiny patch to
   > emms-playlist-tracks-in-region.
   >
   > ---Fran
   >
   > diff --git a/lisp/emms.el b/lisp/emms.el
   > index 062b6eb..7a14a9e 100644
   > --- a/lisp/emms.el
   > +++ b/lisp/emms.el
   the source."
   >    (emms-walk-tracks
   >     (setq tracks (cons (emms-playlist-track-at
(point))Â Â Â >Â Â Â Â (emms-walk-tracks
   >     (setq tracks (cons (emms-playlist-track-at
   >               tracks))))
   > -  tracks))
   > +  (nreverse tracks)))
   >Â
   > (defun emms-playlist-track-updated (track)
   >  "Update TRACK in all playlist buffers."
 Â
   I think that the way emms-playlist-limit currently works is
   essentially
   a kludge (indeed, the very idea behind
`emms-playlist-limit' is a   > -  tracks))
   > +  (nreverse tracks)))
   >Â
   > (defun emms-playlist-track-updated (track)
   >  "Update TRACK in all playlist buffers."
 Â
   I think that the way emms-playlist-limit currently works is
   essentially
   a kludge (indeed, the very idea behind
   strange way of replicating a subset of the browser.)
Storing the   entire
   playlist in a variable is bad. We already have a data
structure   playlist in a variable is bad. We already have a data
   for
   storing playlists: it's called a playlist!
 Â
   Once we re-write it, these issues will go away by dint of
   emms-playlist-limit being re-implemented correctly. For
example,   storing playlists: it's called a playlist!
 Â
   Once we re-write it, these issues will go away by dint of
   emms-playlist-limit being re-implemented correctly. For
   we
   could make it so that limiting creates a new playlist with
the   could make it so that limiting creates a new playlist with
   selected
   tracks and makes that playlist the current playlist. If the
   original
   playlist was called "Classical" and was limited to the
artist   tracks and makes that playlist the current playlist. If the
   original
   playlist was called "Classical" and was limited to the
   Beethoven,
   the new playlist would be generated as "Classical (limited
to   the new playlist would be generated as "Classical (limited
   artist/Beethoven)". The new playlist can have a local
variable   pointing
   to the original playlist so that a "//" can be equivalent
to   to the original playlist so that a "//" can be equivalent
   "kill this
   buffer and make the original playlist current (if it still
   exists)".
 Â
   I'm sure that there are other implementation ideas which
are as   buffer and make the original playlist current (if it still
   exists)".
 Â
   I'm sure that there are other implementation ideas which
   good.
 Â
   --
     "Cut your own wood and it will warm you twice"
--Â Â
   --
     "Cut your own wood and it will warm you twice"
  "Cut your own wood and it will warm you twice"
--
"Cut your own wood and it will warm you twice"
"Cut your own wood and it will warm you twice"